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

import sys, tempfile, os, configparser, time
from datetime import timedelta, datetime
import subprocess as sp

sample_config = '''[jobe]
# Command to execute
# Can also refer to any files in this folder (i.e sh foo.sh)
command = uname -a

# Base name of your results branch
name = run_date

# Don't wait for the job to complete
detach = yes

# Time to execute the command (server timezone). 
# To execute instantly, set this to a date in the past.
run_at = 2000-01-01T12:00:00.0

# Print all debug information
verbose = no
'''

class Worker:
    def __init__(self, job_id):
        self.job_id = job_id
        
    def spawn(self, detach):
        proc = sp.Popen(["python3", os.path.realpath(__file__), self.job_id], stdout=sp.PIPE, stderr=sp.PIPE, stdin=sp.PIPE)
        
        if not detach:
            stdout, stderr = proc.communicate()
            
            p.debug(stdout)
            p.debug(stderr)      
    
    def execute(self, config, repo):
        if config.wait > 0:
            time.sleep(config.wait)
        proc = sp.Popen(config.command, stdout=repo.open_file("stdout.log"), 
                stderr=repo.open_file("stderr.log"), cwd=repo.work_dir, shell=True)
        proc.wait(timeout = config.timeout)
        with repo.open_file("exitcode.log") as exit_file:
            print(proc.returncode, file=exit_file)
    
    def run(self):
        with Repo(repo_dir) as repo:
            repo.clone()
            repo.checkout(self.job_id)
            config = Config(repo, p)
            self.execute(config, repo)
            repo.add_all()
            repo.commit("Job complete")
            repo.push()
    
class Printer:
    verbose = False
    
    info = lambda _, output: print('\033[94m>>> ' + output + '\033[0m')
    ok = lambda _, output: print('\033[92m>>> ' + output + '\033[0m')
    warn = lambda _, output: print('\033[93m>>> ' + output + '\033[0m')   
    err = lambda _, output: print('\033[91m>>> ' + output + '\033[0m')
    banner = lambda self: self.info("JOBE - git\'in the job done")
    
    def debug(self, output):<commit_msg>Remove timeout parameter for Python 3.2 subprocess<commit_after>#!/usr/bin/env python3

import sys, tempfile, os, configparser, time
from datetime import timedelta, datetime
import subprocess as sp

sample_config = '''[jobe]
# Command to execute
# Can also refer to any files in this folder (i.e sh foo.sh)
command = uname -a

# Base name of your results branch
name = run_date

# Don't wait for the job to complete
detach = yes

# Time to execute the command (server timezone). 
# To execute instantly, set this to a date in the past.
run_at = 2000-01-01T12:00:00.0

# Print all debug information
verbose = no
'''

class Worker:
    def __init__(self, job_id):
        self.job_id = job_id
        
    def spawn(self, detach):
        proc = sp.Popen(["python3", os.path.realpath(__file__), self.job_id], stdout=sp.PIPE, stderr=sp.PIPE, stdin=sp.PIPE)
        
        if not detach:
            stdout, stderr = proc.communicate()
            
            p.debug(stdout)
            p.debug(stderr)      
    
    def execute(self, config, repo):
        if config.wait > 0:
            time.sleep(config.wait)
        proc = sp.Popen(config.command, stdout=repo.open_file("stdout.log"), 
                stderr=repo.open_file("stderr.log"), cwd=repo.work_dir, shell=True)
        proc.wait()
        with repo.open_file("exitcode.log") as exit_file:
            print(proc.returncode, file=exit_file)
    
    def run(self):
        with Repo(repo_dir) as repo:
            repo.clone()
            repo.checkout(self.job_id)
            config = Config(repo, p)
            self.execute(config, repo)
            repo.add_all()
            repo.commit("Job complete")
            repo.push()
    
class Printer:
    verbose = False
    
    info = lambda _, output: print('\033[94m>>> ' + output + '\033[0m')
    ok = lambda _, output: print('\033[92m>>> ' + output + '\033[0m')
    warn = lambda _, output: print('\033[93m>>> ' + output + '\033[0m')   
    err = lambda _, output: print('\033[91m>>> ' + output + '\033[0m')
    banner = lambda self: self.info("JOBE - git\'in the job done")
    
    def debug(self, output):
{'fraction_non_alphanumeric': 0.12779477524123323, 'fraction_numerical': 0.02588844433984467, 'mean_word_length': 2.3972821742605914, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 29, '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': '5402870', 'n_tokens_mistral': 1433, 'n_tokens_neox': 1359, 'n_words': 370}