Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Gelencsér Szabolcs
/
cloud
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
A prog2-höz tartozó friss repo anyagok itt elérhetőek:
https://git.iit.bme.hu/
Commit
f931d0f6
authored
Mar 14, 2014
by
Guba Sándor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
storage: changed is_downloading and get_download_precentage
parent
1135d99d
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
11 deletions
+10
-11
circle/storage/models.py
+10
-11
No files found.
circle/storage/models.py
View file @
f931d0f6
...
@@ -17,7 +17,8 @@ from acl.models import AclBase
...
@@ -17,7 +17,8 @@ from acl.models import AclBase
from
.tasks
import
local_tasks
,
remote_tasks
from
.tasks
import
local_tasks
,
remote_tasks
from
celery.exceptions
import
TimeoutError
from
celery.exceptions
import
TimeoutError
from
manager.mancelery
import
celery
from
manager.mancelery
import
celery
from
common.models
import
ActivityModel
,
activitycontextimpl
,
WorkerNotFound
from
common.models
import
(
ActivityModel
,
activitycontextimpl
,
WorkerNotFound
,
method_cache
)
logger
=
logging
.
getLogger
(
__name__
)
logger
=
logging
.
getLogger
(
__name__
)
...
@@ -111,6 +112,7 @@ class Disk(AclBase, TimeStampedModel):
...
@@ -111,6 +112,7 @@ class Disk(AclBase, TimeStampedModel):
return
self
.
activity_log
.
filter
(
activity_code__endswith
=
"deploy"
,
return
self
.
activity_log
.
filter
(
activity_code__endswith
=
"deploy"
,
succeeded__isnull
=
False
)
succeeded__isnull
=
False
)
@property
def
path
(
self
):
def
path
(
self
):
"""The path where the files are stored.
"""The path where the files are stored.
"""
"""
...
@@ -153,15 +155,16 @@ class Disk(AclBase, TimeStampedModel):
...
@@ -153,15 +155,16 @@ class Disk(AclBase, TimeStampedModel):
}[
self
.
type
]
}[
self
.
type
]
def
is_downloading
(
self
):
def
is_downloading
(
self
):
da
=
DiskActivity
.
objects
.
filter
(
disk
=
self
)
.
latest
(
"created"
)
return
self
.
activity_log
.
filter
(
return
(
da
.
activity_code
==
"storage.Disk.download"
activity_code__endswith
=
"downloading_disk"
,
and
da
.
succeeded
is
Non
e
)
succeeded__isnull
=
Tru
e
)
def
get_download_percentage
(
self
):
def
get_download_percentage
(
self
):
if
not
self
.
is_downloading
():
if
not
self
.
is_downloading
():
return
None
return
None
task
=
self
.
activity_log
.
filter
(
task
=
DiskActivity
.
objects
.
latest
(
"created"
)
.
task_uuid
activity_code__endswith
=
"deploy"
,
succeeded__isnull
=
True
)[
0
]
.
task_uuid
result
=
celery
.
AsyncResult
(
id
=
task
)
result
=
celery
.
AsyncResult
(
id
=
task
)
return
result
.
info
.
get
(
"percent"
)
return
result
.
info
.
get
(
"percent"
)
...
@@ -270,8 +273,7 @@ class Disk(AclBase, TimeStampedModel):
...
@@ -270,8 +273,7 @@ class Disk(AclBase, TimeStampedModel):
self
.
save
()
self
.
save
()
if
self
.
ready
:
if
self
.
ready
:
return
False
return
True
with
disk_activity
(
code_suffix
=
'deploy'
,
disk
=
self
,
with
disk_activity
(
code_suffix
=
'deploy'
,
disk
=
self
,
task_uuid
=
task_uuid
,
user
=
user
)
as
act
:
task_uuid
=
task_uuid
,
user
=
user
)
as
act
:
...
@@ -289,9 +291,6 @@ class Disk(AclBase, TimeStampedModel):
...
@@ -289,9 +291,6 @@ class Disk(AclBase, TimeStampedModel):
queue
=
queue_name
queue
=
queue_name
)
.
get
(
timeout
=
timeout
)
)
.
get
(
timeout
=
timeout
)
self
.
ready
=
True
self
.
save
()
return
True
return
True
def
deploy_async
(
self
,
user
=
None
):
def
deploy_async
(
self
,
user
=
None
):
...
...
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