def check_for_cancel(self): if self.cancellable: if self.storage is None: raise ReferenceError( "storage is not defined on this job, cannot check for cancellation" ) if self.storage.check_job_canceled(self.job_id): raise UserCancelledError()
def _check_for_cancel(self, job_id): """ Check if a job has been requested to be cancelled. When called, the calling function can optionally give the stage it is currently in, so the user has information on where the job was before it was cancelled. :param job_id: The job_id to check :return: raises a UserCancelledError if we find out that we were cancelled. """ future = self.future_job_mapping[job_id] if getattr(future, "_is_cancelled", False): raise UserCancelledError()
def _check_for_cancel(self, job_id): """ Check if a job has been requested to be cancelled. When called, the calling function can optionally give the stage it is currently in, so the user has information on where the job was before it was cancelled. :param job_id: The job_id to check :param current_stage: Where the job currently is :return: raises a UserCancelledError if we find out that we were cancelled. """ future = self.future_job_mapping[job_id] is_cancelled = future._state in [CANCELLED, CANCELLED_AND_NOTIFIED] if is_cancelled: raise UserCancelledError()
def _raise_cancel(self, *args, **kwargs): if self.is_cancelled() and (not self.job or self.job.cancellable): raise UserCancelledError()