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
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
Show 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):
...
@@ -140,14 +140,14 @@ class InstanceActivity(ActivityModel):
return
(
self
.
task_uuid
and
op
and
op
.
has_percentage
and
return
(
self
.
task_uuid
and
op
and
op
.
has_percentage
and
not
self
.
finished
)
not
self
.
finished
)
#
def get_percentage(self):
def
get_percentage
(
self
):
#
"""Returns the percentage of the running operation if available.
"""Returns the percentage of the running operation if available.
#
"""
"""
#
result = celery.AsyncResult(id=self.task_uuid)
result
=
celery
.
AsyncResult
(
id
=
self
.
task_uuid
)
#
if self.has_percentage() and result.info is not None:
if
self
.
has_percentage
()
and
result
.
info
is
not
None
:
#
return result.info.get("percent")
return
result
.
info
.
get
(
"percent"
)
#
else:
else
:
#
return 0
return
0
@property
@property
def
is_abortable
(
self
):
def
is_abortable
(
self
):
...
...
circle/vm/models/instance.py
View file @
3ce45c05
...
@@ -851,10 +851,10 @@ class Instance(AclBase, VirtualMachineDescModel, StatusModel, OperatedMixin,
...
@@ -851,10 +851,10 @@ class Instance(AclBase, VirtualMachineDescModel, StatusModel, OperatedMixin,
order_by
(
'-started'
)
.
order_by
(
'-started'
)
.
select_related
(
'user'
)
.
prefetch_related
(
'children'
))
select_related
(
'user'
)
.
prefetch_related
(
'children'
))
# Check latest activity for percentage
# Check latest activity for percentage
#
for i in acts:
for
i
in
acts
:
#
if i.has_percentage():
if
i
.
has_percentage
():
#
i.has_percent = True
i
.
has_percent
=
True
#
i.percentage = i.get_percentage()
i
.
percentage
=
i
.
get_percentage
()
if
user
is
not
None
:
if
user
is
not
None
:
for
i
in
acts
:
for
i
in
acts
:
i
.
is_abortable_for_user
=
partial
(
i
.
is_abortable_for
,
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
...
@@ -23,6 +23,7 @@ from django.conf import settings
from
manager.mancelery
import
celery
from
manager.mancelery
import
celery
from
vm.models
import
Node
,
Instance
from
vm.models
import
Node
,
Instance
from
vm.models.activity
import
ActivityInProgressError
logger
=
logging
.
getLogger
(
__name__
)
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