コード例 #1
0
 def release_hold(self, hold_type=None):
     """Release hold on job of specified type."""
     # we can't set this default for hold_type in function signature,
     # because we need to be able to load this module even when the pbs module is not available
     if hold_type is None:
         hold_type = pbs.USER_HOLD
     # only release hold if it was set
     if hold_type in self.holds:
         if hold_type not in KNOWN_HOLD_TYPES:
             raise EasyBuildError(
                 "release_hold: unknown hold type: %s (supported: %s)",
                 hold_type, KNOWN_HOLD_TYPES)
         # release hold, check for errors, remove from list of holds
         ec = pbs.pbs_rlsjob(self.pbsconn, self.jobid, hold_type, NULL)
         self.log.debug("Released hold of type %s for job %s" %
                        (hold_type, self.jobid))
         is_error, errormsg = pbs.error()
         if is_error or ec:
             raise EasyBuildError(
                 "Failed to release hold type %s on job %s (is_error: %s, exit code: %s, msg: %s)",
                 hold_type, self.jobid, is_error, ec, errormsg)
         else:
             self.holds.remove(hold_type)
     else:
         self.log.warning(
             "No hold type %s was set for %s, so skipping hold release" %
             (hold_type, self.jobid))
コード例 #2
0
ファイル: torque.py プロジェクト: liek51/civet
 def release_job(self, job_id):
     """
     Release a user hold on a job
     :param job_id: job to release
     """
     connection = _connect_to_server(self.pbs_server)
     rval = pbs.pbs_rlsjob(self.connection, job_id, 'u', '')
     pbs.pbs_disconnect(connection)
     return rval
コード例 #3
0
ファイル: utils.py プロジェクト: triicst/TORQUE-PBS-APP
 def hold_rls_job(self, job_id, server, mode, permission):
     '''
     Example:
     job_id: 183
     server: jim-desktop
     mode: hold | rls
     permission: u | o | s
     '''
     c = pbs.pbs_connect(str(
         pbs.pbs_default()))  # Create new connection for the child process
     if server is None:
         server = pbs.pbs_default()
     job_full_id = job_id + '.' + server
     if mode == 'hold':
         result = pbs.pbs_holdjob(c, job_full_id, permission, 'NULL')
     elif mode == 'rls':
         result = pbs.pbs_rlsjob(c, job_full_id, permission, 'NULL')
     return result  # If operation is successfull, result == 0
コード例 #4
0
ファイル: torque.py プロジェクト: liek51/civet
    def release_job(self, job_id, connection=None):
        """
            Release a user hold from a held batch job.
            
            :param job_id: job id to release (short form not allowed)
            :param id: job id to release (short form not allowed)
            :param connection: optional connection to a pbs_server, if not
                  passed release_job will establish a new connection
        """
        c = connection if connection else _connect_to_server(self._server)

        rval = pbs.pbs_rlsjob(c, job_id, 'u', '')

        if not connection:
            pbs.pbs_disconnect(c)

        if rval == 0:
            self.held_jobs.remove(job_id)
        return rval
コード例 #5
0
 def release_hold(self, hold_type=None):
     """Release hold on job of specified type."""
     # we can't set this default for hold_type in function signature,
     # because we need to be able to load this module even when the pbs module is not available
     if hold_type is None:
         hold_type = pbs.USER_HOLD
     # only release hold if it was set
     if hold_type in self.holds:
         if hold_type not in KNOWN_HOLD_TYPES:
             self.log.error("release_hold: unknown hold type: %s (supported: %s)" % (hold_type, KNOWN_HOLD_TYPES))
         # release hold, check for errors, remove from list of holds
         ec = pbs.pbs_rlsjob(self.pbsconn, self.jobid, hold_type, NULL)
         self.log.debug("Released hold of type %s for job %s" % (hold_type, self.jobid))
         is_error, errormsg = pbs.error()
         if is_error or ec:
             tup = (hold_type, self.jobid, is_error, ec, errormsg)
             self.log.error("Failed to release hold type %s on job %s (is_error: %s, exit code: %s, msg: %s)" % tup)
         else:
             self.holds.remove(hold_type)
     else:
         self.log.warning("No hold type %s was set for %s, so skipping hold release" % (hold_type, self.jobid))