Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
CIRCLE
/
storagedriver
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
2
Merge Requests
4
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
7b247bfd
authored
Feb 17, 2014
by
Guba Sándor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
storagedriver: added download abortable task
parent
cfdc07d9
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
0 deletions
+12
-0
storagedriver.py
+12
-0
No files found.
storagedriver.py
View file @
7b247bfd
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
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment