<commit_before>from .job import Job
from ._example_job import ExampleJob
#from .classic_job import ClassicJob, IteratedJob
#from .experiment_job import ExperimentJob, GraphExpJob, ExperimentDBJob, GraphExpDBJob, MultipleGraphExpDBJob
#from .cjob import CJob

from importlib import import_module

import os
import time
import jsonpickle


job_class={
	'example_job':'_example_job.ExampleJob',
	'cjob':'cjob.CJob',
	'classic_job':'classic_job.ClassicJob',
	'iterated_job':'classic_job.IteratedJob',
	'notebook_job':'notebook_job.NotebookJob',
	'experiment_job':'experiment_job.ExperimentDBJob',
	'experiment_job_nostorage':'experiment_job.ExperimentDBJobNoStorage',
	'experiment_job_multigraph':'experiment_job.MultiGraphExpDBJob',
	}

def get_job(job_type='example_job', **jq_cfg2):
	tempstr = job_type
	if tempstr in list(job_class.keys()):
		tempstr = job_class[tempstr]
	templist = tempstr.split('.')
	temppath = '.'.join(templist[:-1])
	tempclass = templist[-1]
	_tempmod = import_module('.'+temppath,package=__name__)
	job = getattr(_tempmod,tempclass)(**job_cfg2)
	return job

def run_job_from_path(path):
	file_path = os.path.join(path,'job.json')
	if not os.path.exists(file_path):
		raise OSError('file doesnt exist: '+filepath)
	with open(file_path,'r') as f:
		job_json = f.read()
	if not job_json:
		time.sleep(0.5) # if concurrent access to the file job.json
		with open(file_path,'r') as f:
			job_json = f.read()<commit_msg>first job tests<commit_after>from .job import Job
from ._example_job import ExampleJob
#from .classic_job import ClassicJob, IteratedJob
#from .experiment_job import ExperimentJob, GraphExpJob, ExperimentDBJob, GraphExpDBJob, MultipleGraphExpDBJob
#from .cjob import CJob

from importlib import import_module

import os
import time
import jsonpickle


job_class={
	'example_job':'_example_job.ExampleJob',
	'cjob':'cjob.CJob',
	'classic_job':'classic_job.ClassicJob',
	'iterated_job':'classic_job.IteratedJob',
	'notebook_job':'notebook_job.NotebookJob',
	'experiment_job':'experiment_job.ExperimentDBJob',
	'experiment_job_nostorage':'experiment_job.ExperimentDBJobNoStorage',
	'experiment_job_multigraph':'experiment_job.MultiGraphExpDBJob',
	}

def get_job(job_type='example_job', **job_cfg2):
	tempstr = job_type
	if tempstr in list(job_class.keys()):
		tempstr = job_class[tempstr]
	templist = tempstr.split('.')
	temppath = '.'.join(templist[:-1])
	tempclass = templist[-1]
	_tempmod = import_module('.'+temppath,package=__name__)
	job = getattr(_tempmod,tempclass)(**job_cfg2)
	return job

def run_job_from_path(path):
	file_path = os.path.join(path,'job.json')
	if not os.path.exists(file_path):
		raise OSError('file doesnt exist: '+filepath)
	with open(file_path,'r') as f:
		job_json = f.read()
	if not job_json:
		time.sleep(0.5) # if concurrent access to the file job.json
		with open(file_path,'r') as f:
			job_json = f.read()
{'fraction_non_alphanumeric': 0.12712747481764503, 'fraction_numerical': 0.004168113928447377, 'mean_word_length': 6.762803234501348, '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': '5880564', 'n_tokens_mistral': 1098, 'n_tokens_neox': 1048, 'n_words': 205}