Commit 3ce45c05 by Szeberényi Imre

vm_priodic task + percentage fix

parent 32dfeb71
...@@ -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):
......
...@@ -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,
......
...@@ -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__)
......
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