Ejemplo n.º 1
0
 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
Ejemplo n.º 2
0
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()
Ejemplo n.º 3
0
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)
Ejemplo n.º 4
0
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()
Ejemplo n.º 5
0
    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
Ejemplo n.º 6
0
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()
Ejemplo n.º 7
0
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)
Ejemplo n.º 8
0
    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
Ejemplo n.º 9
0
 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
Ejemplo n.º 10
0
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()