Commit 7b247bfd by Guba Sándor

storagedriver: added download abortable task

parent cfdc07d9
from disk import Disk from disk import Disk
from storagecelery import celery from storagecelery import celery
from os import path, unlink, statvfs from os import path, unlink, statvfs
from celery.contrib.abortable import AbortableTask
@celery.task() @celery.task()
...@@ -14,6 +15,17 @@ def create(disk_desc): ...@@ -14,6 +15,17 @@ def create(disk_desc):
disk.create() 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() @celery.task()
def delete(json_data): def delete(json_data):
disk = Disk.deserialize(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