def is_in_gallery(id_job, mode="webserver"): if mode == "webserver": from dgenies.database import Gallery, Job from peewee import DoesNotExist try: return len(Gallery.select().where(Gallery.job == Job.get(id_job=id_job))) > 0 except DoesNotExist: return False return False
def prepare_job(id_job): _printer("Prepare data for job:", id_job) with Job.connect(): job = Job.get(Job.id_job == id_job) job.status = "preparing" job.save() job_mng = JobManager(id_job=id_job, email=job.email, tool=job.tool) job_mng.set_inputs_from_res_dir() job_mng.prepare_data_in_thread()
def start_job(id_job, batch_system_type="local"): _printer("Start job", id_job) with Job.connect(): job = Job.get(Job.id_job == id_job) job.status = "starting" job.save() job_mng = JobManager(id_job=id_job, email=job.email, tool=job.tool) job_mng.set_inputs_from_res_dir() job_mng.run_job_in_thread(batch_system_type)
def move_job_to_cluster(id_job): """ Change local job to be run on the cluster :param id_job: :return: """ with Job.connect(): job = Job.get(Job.id_job == id_job) job.batch_type = config_reader.batch_system_type job.save()
def get_mail_for_job(id_job): """ Retrieve associated mail for a job :param id_job: job id :type id_job: int :return: associated mail address :rtype: str """ from dgenies.database import Job with Job.connect(): j1 = Job.get(Job.id_job == id_job) return j1.email
def prepare_job(id_job): """ Launch job preparation of data :param id_job: job id :type id_job: str """ _printer("Prepare data for job:", id_job) with Job.connect(): job = Job.get(Job.id_job == id_job) job.status = "preparing" job.save() job_mng = JobManager(id_job=id_job, email=job.email, tool=job.tool) job_mng.set_inputs_from_res_dir() job_mng.prepare_data_in_thread()
def start_job(id_job, batch_system_type="local"): """ Start a job (mapping step) :param id_job: job id :type id_job: str :param batch_system_type: local, slurm or sge :type batch_system_type: str """ _printer("Start job", id_job) with Job.connect(): job = Job.get(Job.id_job == id_job) job.status = "starting" job.save() job_mng = JobManager(id_job=id_job, email=job.email, tool=job.tool) job_mng.set_inputs_from_res_dir() job_mng.run_job_in_thread(batch_system_type)
def is_in_gallery(id_job, mode="webserver"): """ Check whether a job is in the gallery :param id_job: job id :type id_job: str :param mode: webserver or standalone :type mode: str :return: True if job is in the gallery, else False :rtype: bool """ if mode == "webserver": from dgenies.database import Gallery, Job from peewee import DoesNotExist try: return len(Gallery.select().where(Gallery.job == Job.get( id_job=id_job))) > 0 except DoesNotExist: return False return False
def get_mail_for_job(id_job): from dgenies.database import Job with Job.connect(): j1 = Job.get(Job.id_job == id_job) return j1.email
def move_job_to_cluster(id_job): with Job.connect(): job = Job.get(Job.id_job == id_job) job.batch_type = config_reader.batch_system_type job.save()