Commit 692f0819 by Dudás Ádám

vm: revised implementation of InstanceActivity.is_abortable

parent c13f128d
......@@ -67,6 +67,15 @@ class InstanceActivity(ActivityModel):
return 'failed'
def is_abortable(self):
"""Can the activity be aborted?
:returns: True if the activity can be aborted; otherwise, False.
op = self.instance.get_operation_from_activity_code(self.activity_code)
return self.task_uuid and op and op.abortable and not self.finished
def create(cls, code_suffix, instance, task_uuid=None, user=None,
......@@ -108,10 +117,6 @@ class InstanceActivity(ActivityModel):
return ret
def is_abortable(self):
op = self.instance.get_operation_from_activity_code(self.activity_code)
return False if op is None else (op.abortable and not self.finished)
def abort(self):
AbortableAsyncResult(self.task_uuid, backend=celery.backend).abort()
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment