Commit 7b247bfd by Guba Sándor

storagedriver: added download abortable task

parent cfdc07d9
from disk import Disk
from storagecelery import celery
from os import path, unlink, statvfs
from celery.contrib.abortable import AbortableTask
@celery.task()
......@@ -14,6 +15,17 @@ def create(disk_desc):
disk.create()
class download(AbortableTask):
time_limit = 18000 # TODO: calculate proper value it's 5h now
def run(self, **kwargs):
disk_desc = kwargs['disk']
url = kwargs['url']
disk = Disk.deserialize(disk_desc)
disk.download(self, url)
return disk.size
@celery.task()
def delete(json_data):
disk = Disk.deserialize(json_data)
......
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