From 9589c55fdc370931a4c143e173ba25e1c28c25ee Mon Sep 17 00:00:00 2001 From: liujun Date: Tue, 7 May 2024 18:53:42 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8Dcreate=5Ftask=20api=20?= =?UTF-8?q?execute=5Ftask=5Fnodes=5Fid=20=E4=BC=A0=E5=8F=82=E6=97=B6?= =?UTF-8?q?=E6=9C=89=E4=B8=A4=E6=AC=A1replace=5Fid=E6=93=8D=E4=BD=9C?= =?UTF-8?q?=E5=AF=BC=E8=87=B4=E6=8A=A5=E9=94=99=E9=97=AE=E9=A2=98=20#7435?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- gcloud/template_base/utils.py | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/gcloud/template_base/utils.py b/gcloud/template_base/utils.py index be54301b62..3e8232f7bb 100644 --- a/gcloud/template_base/utils.py +++ b/gcloud/template_base/utils.py @@ -71,12 +71,15 @@ def replace_template_id(template_model, pipeline_data, reverse=False): apps.get_model("template", "CommonTemplate") if act.get("template_source") == COMMON else template_model ) if not reverse: - act["template_id"] = subprocess_template_model.objects.get( - pk=act["template_id"] - ).pipeline_template.template_id + template = subprocess_template_model.objects.filter(pk=act["template_id"]).first() + if template: + act["template_id"] = template.pipeline_template.template_id else: - template = subprocess_template_model.objects.get(pipeline_template__template_id=act["template_id"]) - act["template_id"] = str(template.pk) + template = subprocess_template_model.objects.filter( + pipeline_template__template_id=act["template_id"] + ).first() + if template: + act["template_id"] = str(template.pk) def inject_template_node_id(pipeline_tree: dict):