Exemple #1
0
def reset_timer(request):
    form = request.form.clean()
    node_id = form['node_id']

    result = task_service.forced_fail(node_id)
    if not result.result:
        return action_result(False, _(u"计时器不存在或已完成,或 pipeline 当前状态不允许重置计时器"))

    inputs = form['inputs']
    result = task_service.retry_activity(node_id, inputs)
    if not result.result:
        return action_result(False, _(u"重试计时器失败,请稍后再次尝试"))

    return action_result(True, 'success')
Exemple #2
0
def force_fail_node(request):
    data = json.loads(request.body)

    task_id = data.get("task_id")
    node_id = data.get("node_id")

    taskflow = TaskFlowInstance.objects.get(id=task_id)

    if not taskflow.pipeline_instance.is_started:
        return JsonResponse({"result": False, "message": f"task[{task_id}] is not start"})

    if not taskflow.has_node(node_id):
        return JsonResponse({"result": False, "message": f"task[{task_id}] does not have node[{node_id}]"})

    result = task_service.forced_fail(node_id)

    return JsonResponse({"result": result.result, "message": result.message})
Exemple #3
0
def force_fail_node(modeladmin, request, queryset):
    for item in queryset:
        task_service.forced_fail(item.id)
Exemple #4
0
 def forced_fail_v1(self, operator: str, **kwargs) -> dict:
     return task_service.forced_fail(act_id=self.node_id, ex_data="forced fail by {}".format(operator))