<commit_before>#!/usr/bin/env python3

# This python checks if the Hillview service is running on all machines
# specified in the configuration file.

from hillviewCommon import *
from optparse import OptionParser

def check_webserver(config):
    """Checks if the Hillview web server is running"""
    rh = RemoteHost(config.user, config.webserver)
    rh.run_remote_shell_command("if pgrep -f tomcat; then true; else " +
                                " echo \"Web server not running on " + str(rh.host) +"\"; " +
                                " false; fi")

def check_backend(config, rh):
    """Check if the Hillview service is running on a remote machine"""
    rh.run_remote_shell_command("if pgrep -f hillview-server; then true; else " +
                                " echo \"Hillview not running on " + str(rh.host) +"\"; " +
                                " cat " + config.service_folder + "/hillview/nohup.out; false; fi")

def check_backends(config):
    """Starts all Hillview backend workers"""
    run_on_all_backends(config, lambda rh: check_backend(config, rh), True)

def main():
    parser = OptionParser(usage="%prog config_file")
    (options, args) = parser.parse_args()
    if len(args) != 1:
        usage(parser)
    config = load_config(parser, args[0])
    check_webserver(config)
    check_backends(config)

if __name__ == "__main__":
    main()<commit_msg>Update the docstring in status script (#400)<commit_after>#!/usr/bin/env python3

# This python checks if the Hillview service is running on all machines
# specified in the configuration file.

from hillviewCommon import *
from optparse import OptionParser

def check_webserver(config):
    """Checks if the Hillview web server is running"""
    rh = RemoteHost(config.user, config.webserver)
    rh.run_remote_shell_command("if pgrep -f tomcat; then true; else " +
                                " echo \"Web server not running on " + str(rh.host) +"\"; " +
                                " false; fi")

def check_backend(config, rh):
    """Checks if the Hillview service is running on a remote machine"""
    rh.run_remote_shell_command("if pgrep -f hillview-server; then true; else " +
                                " echo \"Hillview not running on " + str(rh.host) +"\"; " +
                                " cat " + config.service_folder + "/hillview/nohup.out; false; fi")

def check_backends(config):
    """Checks all Hillview backend workers"""
    run_on_all_backends(config, lambda rh: check_backend(config, rh), True)

def main():
    parser = OptionParser(usage="%prog config_file")
    (options, args) = parser.parse_args()
    if len(args) != 1:
        usage(parser)
    config = load_config(parser, args[0])
    check_webserver(config)
    check_backends(config)

if __name__ == "__main__":
    main()
{'fraction_non_alphanumeric': 0.1140724946695096, 'fraction_numerical': 0.0031982942430703624, 'mean_word_length': 2.758344459279039, 'pattern_counts': {'":': 2, '<': 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': 8, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2040156', 'n_tokens_mistral': 838, 'n_tokens_neox': 819, 'n_words': 247}