Ejemplo n.º 1
0
 def continue_job(self, jobid=None, job=None):
     """ Resubmit one job with given jobid.
         
         Args:
             jobid: jobid of the job to continue
             job: (sqlite3.Row) If this is given, jobid is not necessary and is ignored if given
         
         Raises:
             EligibilityError if job not eligible to be continued
     """
     
     if job == None:
         job = self.select_job(jobid)
     
     eligible, id, msg = self.eligible_to_continue(job)
     if not eligible:
         raise EligibilityError(id, msg)
     
     wd = os.getcwd()
     os.chdir( job["rundir"])
     
     new_jobid = misc.submit(qsubstr=job["qsubstr"])
     
     self.curs.execute("UPDATE jobs SET taskstatus='Continued', modifytime=?, continuation_jobid=? WHERE jobid=?",(int(time.time()),new_jobid,job["jobid"]))
     status = job_status_dict(jobid = new_jobid, jobname = job["jobname"], rundir = os.getcwd(), \
                jobstatus = "?", auto = job["auto"], qsubstr = job["qsubstr"], nodes = job["nodes"], \
                procs = job["procs"], walltime = job["walltime"])
     self.add(status)
     
     os.chdir(wd)
Ejemplo n.º 2
0
    def continue_job(self, jobid=None, job=None):
        """ Resubmit one job with given jobid.
            
            Args:
                jobid: jobid of the job to continue
                job: (sqlite3.Row) If this is given, jobid is not necessary and is ignored if given
            
            Raises:
                EligibilityError if job not eligible to be continued
        """

        if job == None:
            job = self.select_job(jobid)

        eligible, id, msg = self.eligible_to_continue(job)
        if not eligible:
            raise EligibilityError(id, msg)

        wd = os.getcwd()
        os.chdir(job["rundir"])

        new_jobid = misc.submit(qsubstr=job["qsubstr"])

        self.curs.execute(
            "UPDATE jobs SET taskstatus='Continued', modifytime=?, continuation_jobid=? WHERE jobid=?",
            (int(time.time()), new_jobid, job["jobid"]))
        status = job_status_dict(jobid = new_jobid, jobname = job["jobname"], rundir = os.getcwd(), \
                   jobstatus = "?", auto = job["auto"], qsubstr = job["qsubstr"], nodes = job["nodes"], \
                   procs = job["procs"], walltime = job["walltime"])
        self.add(status)

        os.chdir(wd)
Ejemplo n.º 3
0
Archivo: job.py Proyecto: Johnlihj/pbs
 def submit(self, add=True, dbpath=None):
     """Submit this Job using qsub
     
        add: Should this job be added to the JobDB database?
        dbpath: Specify a non-default JobDB database
        
        Raises PBSError if error submitting the job.
     
     """
     
     try:
         self.jobID = misc.submit(qsubstr=self.qsub_string())
     except PBSError as e:
         raise e
     
     if add:
         db = jobdb.JobDB(dbpath=dbpath)
         status = jobdb.job_status_dict(jobid = self.jobID, jobname = self.name, rundir = os.getcwd(), \
                    jobstatus = "?", auto = self.auto, qsubstr = self.qsub_string(), \
                    walltime = misc.seconds(self.walltime), nodes = self.nodes, procs = self.nodes*self.ppn)
         db.add(status)
         db.close()
Ejemplo n.º 4
0
Archivo: job.py Proyecto: demis001/pbs
    def submit(self, add=True, dbpath=None):
        """Submit this Job using qsub

           add: Should this job be added to the JobDB database?
           dbpath: Specify a non-default JobDB database

           Raises PBSError if error submitting the job.

        """
        #TODO: fix generic exception catching
        try:
            self.jobID = misc.submit(qsubstr=self.qsub_string())
        except Exception as e:
            raise e

        if add:
            db = jobdb.JobDB(dbpath=dbpath)
            status = jobdb.job_status_dict(jobid = self.jobID, jobname = self.name, rundir = os.getcwd(), \
                       jobstatus = "?", auto = self.auto, qsubstr = self.qsub_string(), \
                       walltime = misc.seconds(self.walltime), nodes = self.nodes, procs = self.nodes*self.ppn)
            db.add(status)
            db.close()