How to check the status of pipeline A from Pipeline B. I have to pass the status of Pipeline A into If activity in pipeline B

huangapple go评论73阅读模式
英文:

How to check the status of pipeline A from Pipeline B. I have to pass the status of Pipeline A into If activity in pipeline B

问题

如何从管道B中检查管道A的状态。我必须将管道A的状态传递给管道B中的If活动。

我已经创建了一个管道A,其中包含3个Databricks笔记本,在管道B上,我必须使用If活动并传递管道A的状态。在False条件下,我必须重新运行管道A。
是否有一种通过代码/活动来检查管道状态的方式,以便我可以将其传递到if条件中。

管道B的流程将如下所示:
If活动:
管道A执行失败:
重新运行它
否则:
添加等待活动

英文:

How to check the status of pipeline A from Pipeline B. I have to pass the status of Pipeline A into If activity in pipeline B

I have created a pipeline A which has 3 databricks notebook and on Pipeline B i have to use If activity and pass the status of pipeline A. On False condition i have to rerun the pipeline A.
Is there any way through which I can check the status of pipeline through code/activity so that I can pass that inside the if condition.

Flow of Pipeline B will look like this:
If activity :
Pipeline A executes unsuccessful:
Rerun it
Otherwise:
Add wait activity

答案1

得分: 0

  1. 您可以为整个需求创建一个主管道
  2. 创建一个变量,并将默认值设置为'False'
  3. 使用执行管道活动来执行PipelineA。将Waitoncompletion设置为True
  4. 通过'完成后'(绿色)箭头将其连接到设置变量活动
  5. 在设置变量活动中将状态变量设置为'True'
  6. 通过'完成后'路径(蓝色)将其与If活动连接
  7. 在If活动中,检查'status'变量是否为true
  8. 在true块中,通过执行管道活动调用管道B
  9. 在false块中,使用Web活动调用REST API以再次运行管道A

这是运行管道的REST API链接: https://learn.microsoft.com/en-us/rest/api/datafactory/pipelines/create-run?tabs=HTTP

英文:

How to check the status of pipeline A from Pipeline B. I have to pass the status of Pipeline A into If activity in pipeline B

You can create a master pipeline for the whole requirement

  1. Create a variable and assign the default value as 'False'
  2. Use execute pipeline activity to execute PipelineA . Set Waitoncompletion to True
  3. Connect it to Set variable activity via 'on completion' (green) arrow
  4. Set the status variable to 'True' in the set variable activity
  5. Connect it with If activity via 'on completion' path (blue)
  6. In If activity , check if 'status' variable is true
  7. In true block call pipeline B via execute pipeline activity
  8. In false block, use web activity to call the rest API to run pipeline A again

Here is the link for rest api to run a pipeline: https://learn.microsoft.com/en-us/rest/api/datafactory/pipelines/create-run?tabs=HTTP

答案2

得分: 0

Here is the translated content:

  • 由于您希望在管道A(P_A)未成功运行时执行它,您可以使用until循环和一个标志变量来实现此要求。
  • 我已经设置了一个初始值为“false”的标志变量。
  • 在until循环中,我有我的管道A(P_A),如果它失败了,那么我会使用另一个设置变量活动,并将其值设置为“false”本身。
  • 如果管道A成功运行,则我将标志变量的值设置为true,从而停止until循环。

以下是您可以用作管道B模板的管道JSON结构:

{
    "name": "P_B",
    "properties": {
        "activities": [
            {
                "name": "设置变量1",
                "type": "SetVariable",
                "dependsOn": [],
                "userProperties": [],
                "typeProperties": {
                    "variableName": "flag",
                    "value": {
                        "value": "true",
                        "type": "Expression"
                    }
                }
            },
            {
                "name": "Until1",
                "type": "Until",
                "dependsOn": [
                    {
                        "activity": "设置变量1",
                        "dependencyConditions": [
                            "Succeeded"
                        ]
                    }
                ],
                "userProperties": [],
                "typeProperties": {
                    "expression": {
                        "value": "@not(equals(variables('flag'),'false'))",
                        "type": "Expression"
                    },
                    "activities": [
                        {
                            "name": "执行管道1",
                            "type": "ExecutePipeline",
                            "dependsOn": [],
                            "userProperties": [],
                            "typeProperties": {
                                "pipeline": {
                                    "referenceName": "P_A",
                                    "type": "PipelineReference"
                                },
                                "waitOnCompletion": true
                            }
                        },
                        {
                            "name": "设置变量3",
                            "type": "SetVariable",
                            "dependsOn": [
                                {
                                    "activity": "执行管道1",
                                    "dependencyConditions": [
                                        "Succeeded"
                                    ]
                                }
                            ],
                            "userProperties": [],
                            "typeProperties": {
                                "variableName": "flag",
                                "value": "true"
                            }
                        },
                        {
                            "name": "设置变量4",
                            "type": "SetVariable",
                            "dependsOn": [
                                {
                                    "activity": "执行管道1",
                                    "dependencyConditions": [
                                        "Failed"
                                    ]
                                }
                            ],
                            "userProperties": [],
                            "typeProperties": {
                                "variableName": "flag",
                                "value": "false"
                            }
                        }
                    ],
                    "timeout": "0.12:00:00"
                }
            },
            {
                "name": "等待1",
                "type": "Wait",
                "dependsOn": [
                    {
                        "activity": "Until1",
                        "dependencyConditions": [
                            "Succeeded"
                        ]
                    }
                ],
                "userProperties": [],
                "typeProperties": {
                    "waitTimeInSeconds": 10
                }
            }
        ],
        "variables": {
            "flag": {
                "type": "String"
            }
        },
        "annotations": []
    }
}

Please note that I have translated the JSON structure as requested, and you can use this as a template for your pipeline B.

英文:
  • Since you want to execute the pipeline A (P_A) as long as it runs unsuccessfully, you can use until loop and a flag variable to achieve this requirement.
  • I have set a flag variable with value as false to begin with.

How to check the status of pipeline A from Pipeline B. I have to pass the status of Pipeline A into If activity in pipeline B

  • Inside until, I have my pipeline A (P_A), if it fails, then I would use another set variable activity and set it value to false itself.
  • If the pipeline A runs successfully, then I set flag variable value to true and thus stopping the until loop.

How to check the status of pipeline A from Pipeline B. I have to pass the status of Pipeline A into If activity in pipeline B

  • The following is a pipeline JSON structure you can follow as a template for your pipeline B.
{
"name": "P_B",
"properties": {
"activities": [
{
"name": "Set variable1",
"type": "SetVariable",
"dependsOn": [],
"userProperties": [],
"typeProperties": {
"variableName": "flag",
"value": {
"value": "true",
"type": "Expression"
}
}
},
{
"name": "Until1",
"type": "Until",
"dependsOn": [
{
"activity": "Set variable1",
"dependencyConditions": [
"Succeeded"
]
}
],
"userProperties": [],
"typeProperties": {
"expression": {
"value": "@not(equals(variables('flag'),'false'))",
"type": "Expression"
},
"activities": [
{
"name": "Execute Pipeline1",
"type": "ExecutePipeline",
"dependsOn": [],
"userProperties": [],
"typeProperties": {
"pipeline": {
"referenceName": "P_A",
"type": "PipelineReference"
},
"waitOnCompletion": true
}
},
{
"name": "Set variable3",
"type": "SetVariable",
"dependsOn": [
{
"activity": "Execute Pipeline1",
"dependencyConditions": [
"Succeeded"
]
}
],
"userProperties": [],
"typeProperties": {
"variableName": "flag",
"value": "true"
}
},
{
"name": "Set variable4",
"type": "SetVariable",
"dependsOn": [
{
"activity": "Execute Pipeline1",
"dependencyConditions": [
"Failed"
]
}
],
"userProperties": [],
"typeProperties": {
"variableName": "flag",
"value": "false"
}
}
],
"timeout": "0.12:00:00"
}
},
{
"name": "Wait1",
"type": "Wait",
"dependsOn": [
{
"activity": "Until1",
"dependencyConditions": [
"Succeeded"
]
}
],
"userProperties": [],
"typeProperties": {
"waitTimeInSeconds": 10
}
}
],
"variables": {
"flag": {
"type": "String"
}
},
"annotations": []
}
}

huangapple
  • 本文由 发表于 2023年5月26日 15:42:18
  • 转载请务必保留本文链接:https://go.coder-hub.com/76338662.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定