|
|
@ -27,17 +27,18 @@ logger = get_logger(__file__)
|
|
|
|
@shared_task(soft_time_limit=60, queue="ansible", verbose_name=_("Run ansible task"))
|
|
|
|
@shared_task(soft_time_limit=60, queue="ansible", verbose_name=_("Run ansible task"))
|
|
|
|
def run_ops_job(job_id):
|
|
|
|
def run_ops_job(job_id):
|
|
|
|
job = get_object_or_none(Job, id=job_id)
|
|
|
|
job = get_object_or_none(Job, id=job_id)
|
|
|
|
execution = job.create_execution()
|
|
|
|
with tmp_to_org(job.org):
|
|
|
|
run_ops_job_execution(execution)
|
|
|
|
execution = job.create_execution()
|
|
|
|
|
|
|
|
execution.creator = job.creator
|
|
|
|
|
|
|
|
run_ops_job_execution(execution.id)
|
|
|
|
#
|
|
|
|
try:
|
|
|
|
# @shared_task(soft_time_limit=60, queue="ansible")
|
|
|
|
execution.start()
|
|
|
|
# def show_env():
|
|
|
|
except SoftTimeLimitExceeded:
|
|
|
|
# import json
|
|
|
|
execution.set_error('Run timeout')
|
|
|
|
# print(os.environ)
|
|
|
|
logger.error("Run adhoc timeout")
|
|
|
|
# data = json.dumps(dict(os.environ), indent=4)
|
|
|
|
except Exception as e:
|
|
|
|
# return data
|
|
|
|
execution.set_error(e)
|
|
|
|
|
|
|
|
logger.error("Start adhoc execution error: {}".format(e))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@shared_task(soft_time_limit=60, queue="ansible", verbose_name=_("Run ansible task execution"))
|
|
|
|
@shared_task(soft_time_limit=60, queue="ansible", verbose_name=_("Run ansible task execution"))
|
|
|
|