def stop(self, failed=False, shutting_down=False):
'''
Stops a job if running. If the optional "failed" argument is true,
outputs will not be set as available.
'''
if self.is_running:
with self._lock:
if not self.is_running:
# another thread could have changed the status
return
failed = bool(failed)
DEFAULT_LOGGER.info("Stopping job failed = %r", bool(failed))
if shutting_down:
DEFAULT_LOGGER.warning("Stopping job as part of atexit/signal handler exit")
try:
_finish_job(self.conn, self.inputs, self.outputs, self.identifier,
failed=failed)
finally:
self.last_refreshed = None
self.auto_refresh = None
LOCKED.discard(self)
AUTO_REFRESH.discard(self)
评论列表
文章目录