Esempio n. 1
0
 def abort_computation_tasks(cls, task_ids: List[str]) -> None:
     for task_id in task_ids:
         task_result = AbortableAsyncResult(task_id)
         if task_result:
             task_result.abort()
             logger.info(
                 "Aborted celery task %s, status: %s",
                 task_id,
                 task_result.is_aborted(),
             )
Esempio n. 2
0
 def abort(self):
     """
     Abort a task.
     """
     if not self.is_active():
         return
     asyncres = AbortableAsyncResult(self.task_id)
     if self.is_abortable():
         asyncres.abort()
         if asyncres.is_aborted():
             self.status = "ABORTED"
             self.save()
     celery.task.control.revoke(self.task_id,
             terminate=True, signal="SIGTERM")
Esempio n. 3
0
 def abort(self):
     """
     Abort a task.
     """
     if not self.is_active():
         return
     asyncres = AbortableAsyncResult(self.task_id)
     if self.is_abortable():
         asyncres.abort()
         if asyncres.is_aborted():
             self.status = "ABORTED"
             self.save()
     celery.task.control.revoke(self.task_id,
                                terminate=True,
                                signal="SIGTERM")
Esempio n. 4
0
 def abort_func():
     """
     Check whether the task in question has been aborted.
     """
     asyncres = AbortableAsyncResult(task_id)
     return asyncres.is_aborted()
Esempio n. 5
0
 def abort_func():
     """
     Check whether the task in question has been aborted.
     """
     asyncres = AbortableAsyncResult(task_id)
     return asyncres.is_aborted()