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

import os, sys

THIS = os.path.dirname(os.path.abspath(__file__))
ROOT = os.path.dirname(THIS)
CONF = os.path.join(ROOT, "etc/supervisord.conf")

SUPERD = os.path.join(ROOT, "supervisord")
SUPERCTL = os.path.join(ROOT, "supervisorctl")



def start():
    cmd = "cd %s && %s -c %s" % (ROOT, SUPERD, CONF)
    ret = os.system(cmd)
    if ret != 0:
        raise Exception('Error starting RealTime Server')
    
def stop(quiet=False):
    cmd = "cd %s && %s -c %s shutdown" % (ROOT, SUPERCTL, CONF)
    if quiet:
        cmd = "%s &> /dev/null" % cmd
    ret = os.system(cmd)
    if ret != 0:
        raise Exception('Error stopping RealTime Server')

def restart(quiet=False):
    try:
        stop(quiet)
    except:
        pass
    
    while True:
        try:
            status(quiet=True)
        except:
            continue
        break
    
    start()
    
    
def status(quiet=False):
    cmd = "cd %s && %s -c %s status" % (ROOT, SUPERCTL, CONF)
    if quiet:
        cmd = "%s &> /dev/null" % cmd
    ret = os.system(cmd)
    if ret != 0:
        raise Exception('Error getting status of RealTime Server')<commit_msg>lib/actions.py: updating PYTHONPATH<commit_after>#!/usr/bin/env python

import os, sys

THIS = os.path.dirname(os.path.abspath(__file__))
ROOT = os.path.dirname(THIS)
CONF = os.path.join(ROOT, "etc/supervisord.conf")

SUPERD = os.path.join(ROOT, "supervisord")
SUPERCTL = os.path.join(ROOT, "supervisorctl")

os.environ["PYTHONPATH"] = ':'.join([os.environ["PYTHONPATH"], os.path.join(THIS, "supervisor")])


def start():
    cmd = "cd %s && %s -c %s" % (ROOT, SUPERD, CONF)
    ret = os.system(cmd)
    if ret != 0:
        raise Exception('Error starting RealTime Server')
    
def stop(quiet=False):
    cmd = "cd %s && %s -c %s shutdown" % (ROOT, SUPERCTL, CONF)
    if quiet:
        cmd = "%s &> /dev/null" % cmd
    ret = os.system(cmd)
    if ret != 0:
        raise Exception('Error stopping RealTime Server')

def restart(quiet=False):
    try:
        stop(quiet)
    except:
        pass
    
    while True:
        try:
            status(quiet=True)
        except:
            continue
        break
    
    start()
    
    
def status(quiet=False):
    cmd = "cd %s && %s -c %s status" % (ROOT, SUPERCTL, CONF)
    if quiet:
        cmd = "%s &> /dev/null" % cmd
    ret = os.system(cmd)
    if ret != 0:
        raise Exception('Error getting status of RealTime Server')
        

{'fraction_non_alphanumeric': 0.15060728744939272, 'fraction_numerical': 0.0024291497975708503, 'mean_word_length': 2.325706594885599, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, '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': '7340710', 'n_tokens_mistral': 904, 'n_tokens_neox': 870, 'n_words': 227}