Commit d9b61936 by Guba Sándor

storage/local_tasks: made abortable for async jobs

parent 0e9a8a65
from manager.mancelery import celery from manager.mancelery import celery
from celery.contrib.abortable import AbortableTask
@celery.task @celery.task
...@@ -35,9 +36,15 @@ def restore(disk, user): ...@@ -35,9 +36,15 @@ def restore(disk, user):
disk.restore(task_uuid=restore.request.id, user=user) disk.restore(task_uuid=restore.request.id, user=user)
@celery.task class create_from_url(AbortableTask):
def create_from_url(Disk, url, params, user):
Disk.create_from_url(url=url, def run(self, **kwargs):
params=params, Disk = kwargs['cls']
task_uuid=create_from_url.request.id, url = kwargs['url']
user=user) params = kwargs['params']
user = kwargs['user']
Disk.create_from_url(url=url,
params=params,
task_uuid=create_from_url.request.id,
abortable_task=self,
user=user)
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