Skip to content

Commit

Permalink
minor: detail 接口支持retry参数
Browse files Browse the repository at this point in the history
  • Loading branch information
hanshuaikang committed Sep 7, 2023
1 parent 9dbfce7 commit c6dcc6c
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 2 deletions.
10 changes: 9 additions & 1 deletion gcloud/taskflow3/apis/django/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -200,14 +200,22 @@ def detail(request, project_id):
task_id = request.query_params["instance_id"]
node_id = request.query_params["node_id"]
loop = request.query_params.get("loop")
retry = request.query_params.get("retry") == "true"
component_code = request.query_params.get("component_code")
include_data = int(request.query_params.get("include_data", 1))

subprocess_stack = json.loads(request.query_params.get("subprocess_stack", "[]"))

task = TaskFlowInstance.objects.get(pk=task_id, project_id=project_id)
ctx = task.get_node_detail(
node_id, request.user.username, component_code, subprocess_stack, loop, include_data, project_id=project_id
node_id,
request.user.username,
component_code,
subprocess_stack,
loop,
include_data,
project_id=project_id,
retry=retry,
)

return JsonResponse(ctx)
Expand Down
4 changes: 3 additions & 1 deletion gcloud/taskflow3/domains/dispatchers/node.py
Original file line number Diff line number Diff line change
Expand Up @@ -504,7 +504,9 @@ def get_node_data_v2(
if node_info["type"] == "SubProcess":
# remove prefix '${' and subfix '}' in subprocess execution input
inputs = {k[2:-1]: v for k, v in data["inputs"].items()}
elif node_info["type"] == "ServiceActivity" and node_code == "subprocess_plugin":
elif (
node_info["type"] == "ServiceActivity" and node_code == "subprocess_plugin" and kwargs.get("retry")
):
raw_inputs = data["inputs"]["subprocess"]["pipeline"]["constants"]
inputs = {key[2:-1]: value.get("value") for key, value in raw_inputs.items()}
else:
Expand Down
1 change: 1 addition & 0 deletions gcloud/taskflow3/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -958,6 +958,7 @@ def get_node_detail(
pipeline_instance=self.pipeline_instance,
subprocess_stack=subprocess_stack,
project_id=kwargs["project_id"],
retry=kwargs.get("retry", False),
)
if not node_data_result["result"]:
return node_data_result
Expand Down

0 comments on commit c6dcc6c

Please sign in to comment.