Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
CIRCLE3
/
cloud
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
5
Merge Requests
0
Pipelines
Wiki
Snippets
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
3ce45c05
authored
Jan 26, 2022
by
Szeberényi Imre
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
vm_priodic task + percentage fix
parent
32dfeb71
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
13 additions
and
12 deletions
+13
-12
circle/vm/models/activity.py
+8
-8
circle/vm/models/instance.py
+4
-4
circle/vm/tasks/local_periodic_tasks.py
+1
-0
No files found.
circle/vm/models/activity.py
View file @
3ce45c05
...
...
@@ -140,14 +140,14 @@ class InstanceActivity(ActivityModel):
return
(
self
.
task_uuid
and
op
and
op
.
has_percentage
and
not
self
.
finished
)
#
def get_percentage(self):
#
"""Returns the percentage of the running operation if available.
#
"""
#
result = celery.AsyncResult(id=self.task_uuid)
#
if self.has_percentage() and result.info is not None:
#
return result.info.get("percent")
#
else:
#
return 0
def
get_percentage
(
self
):
"""Returns the percentage of the running operation if available.
"""
result
=
celery
.
AsyncResult
(
id
=
self
.
task_uuid
)
if
self
.
has_percentage
()
and
result
.
info
is
not
None
:
return
result
.
info
.
get
(
"percent"
)
else
:
return
0
@property
def
is_abortable
(
self
):
...
...
circle/vm/models/instance.py
View file @
3ce45c05
...
...
@@ -851,10 +851,10 @@ class Instance(AclBase, VirtualMachineDescModel, StatusModel, OperatedMixin,
order_by
(
'-started'
)
.
select_related
(
'user'
)
.
prefetch_related
(
'children'
))
# Check latest activity for percentage
#
for i in acts:
#
if i.has_percentage():
#
i.has_percent = True
#
i.percentage = i.get_percentage()
for
i
in
acts
:
if
i
.
has_percentage
():
i
.
has_percent
=
True
i
.
percentage
=
i
.
get_percentage
()
if
user
is
not
None
:
for
i
in
acts
:
i
.
is_abortable_for_user
=
partial
(
i
.
is_abortable_for
,
...
...
circle/vm/tasks/local_periodic_tasks.py
View file @
3ce45c05
...
...
@@ -23,6 +23,7 @@ from django.conf import settings
from
manager.mancelery
import
celery
from
vm.models
import
Node
,
Instance
from
vm.models.activity
import
ActivityInProgressError
logger
=
logging
.
getLogger
(
__name__
)
...
...
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