示例#1
0
文件: task.py 项目: VUIIS/api
 def launch(self,jobdir,job_email=None,job_email_options='bae'):
     cmds = self.commands(jobdir)
     pbsfile = self.pbs_path()
     outlog = self.outlog_path()
     pbs = PBS(pbsfile,outlog,cmds,self.processor.walltime_str,self.processor.memreq_mb,self.processor.ppn,job_email,job_email_options)
     pbs.write()
     jobid = pbs.submit()
     
     if jobid == '' or jobid == '0':
         # TODO: raise exception
         print('ERROR:failed to launch job on cluster')
         return False
     else:
         self.set_status(JOB_RUNNING)
         self.set_jobid(jobid)
         self.set_jobstartdate_today()
         
         #save record on redcap for the job that has been launch
         project=self.assessor_label.split('-x-')[0]
         SM_name=self.get_processor_name()
         data,record_id=XnatUtils.create_record_redcap(project, SM_name)
         run=XnatUtils.save_job_redcap(data,record_id)
         if not run:
             print(' ->ERROR: did not send the job to redcap for jobID <'+str(jobid)+'>: '+record_id)
         
         return True
示例#2
0
文件: task.py 项目: VUMC-VMAC/api
    def launch(self, jobdir, job_email=None, job_email_options='bae'):
        cmds = self.commands(jobdir)
        pbsfile = self.pbs_path()
        outlog = self.outlog_path()
        pbs = PBS(pbsfile, outlog, cmds, self.processor.walltime_str,
                  self.processor.memreq_mb, self.processor.ppn, job_email,
                  job_email_options)
        pbs.write()
        jobid = pbs.submit()

        if jobid == '' or jobid == '0':
            # TODO: raise exception
            print('ERROR:failed to launch job on cluster')
            return False
        else:
            self.set_status(JOB_RUNNING)
            self.set_jobid(jobid)
            self.set_jobstartdate_today()

            #save record on redcap for the job that has been launch
            project = self.assessor_label.split('-x-')[0]
            SM_name = self.get_processor_name()
            data, record_id = XnatUtils.create_record_redcap(project, SM_name)
            run = XnatUtils.save_job_redcap(data, record_id)
            if not run:
                print(' ->ERROR: did not send the job to redcap for jobID <' +
                      str(jobid) + '>: ' + record_id)

            return True
示例#3
0
文件: task.py 项目: Raab70/dax
    def launch(
        self, jobdir, job_email=None, job_email_options=DEFAULT_EMAIL_OPTS, xnat_host=None, writeonly=False, pbsdir=None
    ):
        """
        Method to launch a job on the grid

        :param jobdir: absolute path to where the data will be stored on the node
        :param job_email: who to email if the job fails
        :param job_email_options: grid-specific job email options (e.g.,
         fails, starts, exits etc)
        :param xnat_host: set the XNAT_HOST in the PBS job
        :param writeonly: write the job files without submitting them
        :param pbsdir: folder to store the pbs file
        :raises: cluster.ClusterLaunchException if the jobid is 0 or empty
         as returned by pbs.submit() method
        :return: True if the job failed

        """
        cmds = self.commands(jobdir)
        pbsfile = self.pbs_path(writeonly, pbsdir)
        outlog = self.outlog_path()
        pbs = PBS(
            pbsfile,
            outlog,
            cmds,
            self.processor.walltime_str,
            self.processor.memreq_mb,
            self.processor.ppn,
            job_email,
            job_email_options,
            xnat_host,
        )
        pbs.write()
        if writeonly:
            mes_format = """   filepath: {path}"""
            LOGGER.info(mes_format.format(path=pbsfile))
            return True
        else:
            jobid = pbs.submit()

            if jobid == "" or jobid == "0":
                LOGGER.error("failed to launch job on cluster")
                raise cluster.ClusterLaunchException
            else:
                self.set_launch(jobid)
                return True
示例#4
0
    def launch(self, jobdir, job_email=None, job_email_options=DAX_SETTINGS.get_email_opts(), xnat_host=None, writeonly=False, pbsdir=None):
        """
        Method to launch a job on the grid

        :param jobdir: absolute path to where the data will be stored on the node
        :param job_email: who to email if the job fails
        :param job_email_options: grid-specific job email options (e.g.,
         fails, starts, exits etc)
        :param xnat_host: set the XNAT_HOST in the PBS job
        :param writeonly: write the job files without submitting them
        :param pbsdir: folder to store the pbs file
        :raises: cluster.ClusterLaunchException if the jobid is 0 or empty
         as returned by pbs.submit() method
        :return: True if the job failed

        """
        cmds = self.commands(jobdir)
        pbsfile = self.pbs_path(writeonly, pbsdir)
        outlog = self.outlog_path()
        outlog_dir = os.path.dirname(outlog)
        mkdirp(outlog_dir)
        pbs = PBS(pbsfile, outlog, cmds, self.processor.walltime_str, self.processor.memreq_mb,
                  self.processor.ppn, job_email, job_email_options, xnat_host)
        pbs.write()
        if writeonly:
            mes_format = """   filepath: {path}"""
            LOGGER.info(mes_format.format(path=pbsfile))
            return True
        else:
            jobid = pbs.submit()

            if jobid == '' or jobid == '0':
                LOGGER.error('failed to launch job on cluster')
                raise cluster.ClusterLaunchException
            else:
                self.set_launch(jobid)
                return True