简体   繁体   English

如何从 ADF 中的 Executed Pipeline 获取输出参数?

[英]How to get output parameter from Executed Pipeline in ADF?

I have a databricks pipeline that will give an output, but at the moment, I need run the databricks from the Executed Pipelines, when I tried to run it, my databricks output didn't show up on Executed Pipelines ?我有一个 databricks 管道可以提供输出,但目前,我需要从 Executed Pipelines 运行 databricks,当我尝试运行它时,我的 databricks 输出没有显示在 Executed Pipelines 上? Is this pipeline can't show the output ?这个管道不能显示输出吗?

So this is my Databricks output result.所以这是我的 Databricks 输出结果。

在此处输入图片说明

And this is my Executed Pipeline.这是我的执行管道。

在此处输入图片说明

How can I get the runOutput result from Executed Pipeline ?如何从 Executed Pipeline 获取runOutput结果?

Data bricks activity is inside child pipeline.数据砖活动在子管道内。 So execute pipeline activity will not show output properties of child pipeline activites.因此执行管道活动不会显示子管道活动的输出属性。

You can try this work around, You can write Child pipeline's output to a database table.您可以尝试解决此问题,您可以将子管道的输出写入数据库表。 Output means A blob name or writing the parent runID to a SQL table.输出表示 blob 名称或将父 runID 写入 SQL 表。

By doing this parent pipeline will get reference to get the output.通过这样做,父管道将获得参考以获取输出。

You can use the Azure REST API to query activity runs, so you could do an API call to get the last pipeline run of the pipeline you are interested in. Then you use those details to call another REST API to get the Activity output for that pipeline RunID you are interested in.您可以使用 Azure REST API 查询活动运行,因此您可以执行 API 调用以获取您感兴趣的管道的最后一个管道运行。然后您使用这些详细信息调用另一个 REST API 以获取该管道的 Activity 输出您感兴趣的管道 RunID。

This method has the benefit of not needing to write output to a file or DB, rather you can just lookup the output of that activity in the Azure Monitor Logs for ADF.此方法的优点是无需将输出写入文件或数据库,而只需在 ADF 的 Azure Monitor 日志中查找该活动的输出。 It can also be used for getting activity output from a completely different Data Factory.它还可以用于从完全不同的数据工厂获取活动输出。

You can actually refer to this post to show how to use the Azure REST API for ADF to query pipeline and activity runs:您实际上可以参考这篇文章来展示如何使用用于 ADF 的 Azure REST API 来查询管道和活动运行:

Azure data factory and Log analytics Azure 数据工厂和日志分析

The important part here is the body and the operands:这里的重要部分是主体和操作数:

API 调用中的示例正文

Here is the Microsoft Documentation on how to use the query pipeline API:以下是有关如何使用查询管道 API 的 Microsoft 文档:

https://docs.microsoft.com/en-us/rest/api/datafactory/pipeline-runs/query-by-factory https://docs.microsoft.com/en-us/rest/api/datafactory/pipeline-runs/query-by-factory

And here is the Microsoft documentation on how to query the activity API:这是有关如何查询活动 API 的 Microsoft 文档:

https://docs.microsoft.com/en-us/rest/api/datafactory/pipeline-runs/query-by-factory https://docs.microsoft.com/en-us/rest/api/datafactory/pipeline-runs/query-by-factory

So what you can do is find the Pipeline RunID of the child pipeline that ran using the pipeline API, then use that to query for the specific activity execution within that pipeline using the Activity API.因此,您可以做的是找到使用管道 API 运行的子管道的管道运行 ID,然后使用它来使用活动 API 查询该管道内的特定活动执行。

Real Example:真实例子:

Parent Pipeline:父管道:

父管道

Child Pipeline:子管道:

子管道

To get the Last Pipeline Run of the Child Pipeline using Web Request:使用 Web 请求获取子管道的最后一个管道运行:

获取上次管道运行

URL:网址:

https://management.azure.com/subscriptions/@{pipeline().parameters.SubscriptionId}/resourceGroups/@{pipeline().parameters.ResourceGroupName}/providers/Microsoft.DataFactory/factories/@{pipeline().DataFactory}/queryPipelineRuns?api-version=2018-06-01

BODY:身体:

{
  "lastUpdatedAfter": "2018-06-16T00:36:44.3345758Z",
  "lastUpdatedBefore": "@{utcnow()}",
  "filters": [
    {
      "operand": "PipelineName",
      "operator": "Equals",
      "values": [
        "@{pipeline().parameters.PipelineName}"
      ]
    },
    {
      "operand": "LatestOnly",
      "operator": "Equals",
      "values": [
        true
      ]
    }
  ]
}

To get the Activity Output using the Pipeline details from Previous Web call:要使用上一个 Web 调用中的管道详细信息获取活动输出:

从孩子获取活动输出

URL:网址:

https://management.azure.com/subscriptions/@{pipeline().parameters.SubscriptionId}/resourceGroups/@{pipeline().parameters.ResourceGroupName}/providers/Microsoft.DataFactory/factories/@{pipeline().DataFactory}/pipelineruns/@{activity('Get Last ChildPipeline Run Details').output.value[0].runId}/queryActivityruns?api-version=2018-06-01

BODY:身体:

{
  "lastUpdatedAfter": "2018-06-16T00:36:44.3345758Z",
  "lastUpdatedBefore": "@{utcnow()}",
  "filters": [
    {
      "operand": "ActivityName",
      "operator": "Equals",
      "values": [
        "@{pipeline().parameters.ActivityName}"
      ]
    }
  ]
}

Here is the successful output in the Parent Pipeline using this process shown above:这是使用上面显示的过程在父管道中成功的输出:

最终输出

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM