mirror of https://github.com/jumpserver/jumpserver
Administrator
8 years ago
6 changed files with 49 additions and 21 deletions
@ -1,3 +1,5 @@
|
||||
# ~*~ coding: utf-8 ~*~ |
||||
# |
||||
|
||||
from __future__ import unicode_literals |
||||
|
||||
|
||||
|
@ -1,9 +0,0 @@
|
||||
from .tasks import longtime_add |
||||
import time |
||||
|
||||
result = longtime_add.delay(1,2) |
||||
print 'Task finished? ', result.ready() |
||||
print 'Task result: ', result.result |
||||
time.sleep(10) |
||||
print 'Task finished? ', result.ready() |
||||
print 'Task result: ', result.result |
@ -0,0 +1,17 @@
|
||||
from __future__ import unicode_literals |
||||
|
||||
from .tasks import get_asset_hardware_info |
||||
from celery.result import AsyncResult |
||||
|
||||
|
||||
def start_get_hardware_info(*assets): |
||||
result = get_asset_hardware_info.delay(*assets) |
||||
return result.id |
||||
|
||||
|
||||
def get_hardware_info(task_id): |
||||
result = AsyncResult(task_id) |
||||
if result.ready(): |
||||
return {"Completed": False, "data": result.get()} |
||||
else: |
||||
return {"Completed": True, "data": None} |
Loading…
Reference in new issue