2016-10-28 09:28:32 +00:00
|
|
|
from __future__ import unicode_literals
|
|
|
|
|
2016-10-28 09:43:56 +00:00
|
|
|
from .tasks import *
|
2016-10-28 09:28:32 +00:00
|
|
|
from celery.result import AsyncResult
|
|
|
|
|
|
|
|
|
|
|
|
def start_get_hardware_info(*assets):
|
|
|
|
result = get_asset_hardware_info.delay(*assets)
|
|
|
|
return result.id
|
|
|
|
|
|
|
|
|
2016-10-28 09:43:56 +00:00
|
|
|
def get_result(task_id):
|
2016-10-28 09:28:32 +00:00
|
|
|
result = AsyncResult(task_id)
|
|
|
|
if result.ready():
|
2016-10-28 09:43:56 +00:00
|
|
|
return {"Completed": True, "data": result.get()}
|
2016-10-28 09:28:32 +00:00
|
|
|
else:
|
2016-10-28 09:43:56 +00:00
|
|
|
return {"Completed": False, "data": None}
|
|
|
|
|
|
|
|
|
|
|
|
def start_ping_test(*assets):
|
|
|
|
result = asset_test_ping_check.delay(*assets)
|
|
|
|
return result.id
|
|
|
|
|
|
|
|
|