def stop(self):
"""
To be called when the job is completed. Can be called multiple times, will only be applied once.
Returns
-------
state : EStates
status : EStatuses
duration : datetime.timedelta
Duration of the job
"""
self._set_duration()
if self.state is not AJob.EStates.COMPLETED:
self.status = AJob.EStatuses.FAILURE if self.has_failed() else AJob.EStatuses.SUCCESS
self.progress(AJob.EStates.COMPLETED) # This will also save the job
logger.debug(
"{} terminated in {}s with status '{}'".format(self, self.duration, self.status.label))
return self.state, self.status, self.duration
评论列表
文章目录