<commit_before>import os
import time
import signal
import tutum
import requests
import sys


def check_connectivity():
    my_service = tutum.Utils.fetch_by_resource_uri(os.getenv("TUTUM_SERVICE_API_URI"))
    containers = tutum.Container.list(service=my_service.resource_uri, state="Running")
    print "%s: Trying to contact: %s" % (time.asctime(), " ".join([c.private_ip for c in containers]))
    for container in containers:
        try:
            r = requests.get("http://%s:8000" % container.private_ip, timeout=2)
            r.raise_for_status()
            print "%s: %s on %s is reachable" % (time.asctime(), container.name, container.node)
        except requests.exceptions.RequestException as e:
            print "%s: %s on %s is NOT reachable: %s" % (time.asctime(), container.name, container.node, e)


if __name__ == '__main__':<commit_msg>flush logs on every iteration<commit_after>import os
import time
import signal
import tutum
import requests
import sys


def check_connectivity():
    my_service = tutum.Utils.fetch_by_resource_uri(os.getenv("TUTUM_SERVICE_API_URI"))
    containers = tutum.Container.list(service=my_service.resource_uri, state="Running")
    print "%s: Trying to contact: %s" % (time.asctime(), " ".join([c.private_ip for c in containers]))
    for container in containers:
        try:
            r = requests.get("http://%s:8000" % container.private_ip, timeout=2)
            r.raise_for_status()
            print "%s: %s on %s is reachable" % (time.asctime(), container.name, container.node)
        except requests.exceptions.RequestException as e:
            print "%s: %s on %s is NOT reachable: %s" % (time.asctime(), container.name, container.node, e)
    sys.stdout.flush()


if __name__ == '__main__':
{'fraction_non_alphanumeric': 0.12848209209778283, 'fraction_numerical': 0.005685048322910745, 'mean_word_length': 3.607329842931937, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '6007001', 'n_tokens_mistral': 561, 'n_tokens_neox': 552, 'n_words': 146}