jumpserver/apps/ops/tasks.py

23 lines
558 B
Python
Raw Normal View History

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
from common.utils import get_logger
from .utils import run_AdHoc
2017-03-09 06:55:33 +00:00
logger = get_logger(__file__)
@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
return run_AdHoc(task_tuple, assets, pattern=pattern,
task_name=task_name, task_id=task_id)