def __call__(self): context = Context(self.options.endpoint) submitter = Submitter(context) job = submitter.cancel(self.jobId) self.logger.info(job['job_state'])
def cancel(context, job_id): """ Cancels a job Args: context: fts3.rest.client.context.Context instance job_id: The job to cancel Returns: The terminal state in which the job has been left. Note that it may not be CANCELED if the job finished already! """ submitter = Submitter(context) return submitter.cancel(job_id)
def cancel(context, job_id, file_ids=None): """ Cancels a job Args: context: fts3.rest.client.context.Context instance job_id: The job to cancel Returns: The terminal state in which the job has been left. Note that it may not be CANCELED if the job finished already! """ submitter = Submitter(context) return submitter.cancel(job_id, file_ids)
def run(self): if ':' in self.args[0]: job_id, file_ids = self.args[0].split(':') file_ids = file_ids.split(',') else: job_id = self.args[0] file_ids = None context = self._create_context() submitter = Submitter(context) result = submitter.cancel(job_id, file_ids) if file_ids: if isinstance(result, basestring): self.logger.info(result) else: self.logger.info('\n'.join(result)) else: self.logger.info(result['job_state'])