<commit_before>#!/bin/bash

set -e
set -x

umask 0007

docker=${docker:-docker}

sudo=sudo

function wait_for_ipa_container() {
	set +x
	N="$1" ; shift
	set -e
	MACHINE_ID=''
	$docker logs -f "$N" &
	EXIT_STATUS=999
	while true ; do
		sleep 10
		if [ -z "$MACHINE_ID" ] ; then
			MACHINE_ID=$( $docker exec "$N" cat /etc/machine-id || : )
		fi
		if [ "$( $docker inspect "$N" --format='{{.State.Status}}' )" == exited ] ; then
			EXIT_STATUS=$( $docker inspect "$N" --format='{{.State.ExitCode}}' )
			echo "The container has exited with .State.ExitCode [$EXIT_STATUS]."
			break
		elif [ "$1" != "exit-on-finished" ] ; then
			# With exit-on-finished, we expect the container to exit, seeing it exited above
			STATUS=$( $docker exec "$N" systemctl is-system-running 2> /dev/null || : )
			if [ "$STATUS" == 'running' ] ; then
				echo "The container systemctl is-system-running [$STATUS]."
				EXIT_STATUS=0
				break
			elif [ "$STATUS" == 'degraded' ] ; then
				echo "The container systemctl is-system-running [$STATUS]."
				EXIT_STATUS=1
				break
			fi
		fi
	done
	date
	if test -O $VOLUME/build-id ; then
		sudo=
	fi
	if [ "$EXIT_STATUS" -ne 0 ] ; then
		exit "$EXIT_STATUS"
	fi
	if $docker exec "$N" grep '^2' /data/volume-version \<commit_msg>Get more information when the system is degraded.<commit_after>#!/bin/bash

set -e
set -x

umask 0007

docker=${docker:-docker}

sudo=sudo

function wait_for_ipa_container() {
	set +x
	N="$1" ; shift
	set -e
	MACHINE_ID=''
	$docker logs -f "$N" &
	EXIT_STATUS=999
	while true ; do
		sleep 10
		if [ -z "$MACHINE_ID" ] ; then
			MACHINE_ID=$( $docker exec "$N" cat /etc/machine-id || : )
		fi
		if [ "$( $docker inspect "$N" --format='{{.State.Status}}' )" == exited ] ; then
			EXIT_STATUS=$( $docker inspect "$N" --format='{{.State.ExitCode}}' )
			echo "The container has exited with .State.ExitCode [$EXIT_STATUS]."
			break
		elif [ "$1" != "exit-on-finished" ] ; then
			# With exit-on-finished, we expect the container to exit, seeing it exited above
			STATUS=$( $docker exec "$N" systemctl is-system-running 2> /dev/null || : )
			if [ "$STATUS" == 'running' ] ; then
				echo "The container systemctl is-system-running [$STATUS]."
				EXIT_STATUS=0
				break
			elif [ "$STATUS" == 'degraded' ] ; then
				echo "The container systemctl is-system-running [$STATUS]."
				$docker exec "$N" systemctl
				$docker exec "$N" systemctl status
				EXIT_STATUS=1
				break
			fi
		fi
	done
	date
	if test -O $VOLUME/build-id ; then
		sudo=
	fi
	if [ "$EXIT_STATUS" -ne 0 ] ; then
		exit "$EXIT_STATUS"
	fi
	if $docker exec "$N" grep '^2' /data/volume-version \
{'fraction_non_alphanumeric': 0.16252390057361377, 'fraction_numerical': 0.012237093690248566, 'mean_word_length': 3.1656050955414012, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4417456', 'n_tokens_mistral': 1100, 'n_tokens_neox': 943, 'n_words': 284}