2017-03-09 06:55:33 +00:00
|
|
|
# coding: utf-8
|
|
|
|
|
|
|
|
from __future__ import absolute_import, unicode_literals
|
2017-03-15 16:19:47 +00:00
|
|
|
|
2017-03-09 06:55:33 +00:00
|
|
|
from celery import shared_task
|
|
|
|
|
2017-03-22 13:57:05 +00:00
|
|
|
from common.utils import get_logger
|
|
|
|
from .utils import run_AdHoc
|
2017-03-09 06:55:33 +00:00
|
|
|
|
|
|
|
logger = get_logger(__file__)
|
|
|
|
|
|
|
|
|
2017-03-22 13:57:05 +00:00
|
|
|
@shared_task
|
|
|
|
def rerun_task(task_id):
|
|
|
|
from .models import Task
|
|
|
|
record = Task.objects.get(uuid=task_id)
|
2017-03-14 06:15:13 +00:00
|
|
|
assets = record.assets_json
|
|
|
|
task_tuple = record.module_args
|
|
|
|
pattern = record.pattern
|
|
|
|
task_name = record.name
|
2017-03-22 13:57:05 +00:00
|
|
|
return run_AdHoc(task_tuple, assets, pattern=pattern,
|
|
|
|
task_name=task_name, task_id=task_id)
|