繁体   English   中英

如何从已执行的管道中获取自定义输出?

[英]How to get custom output from an executed pipeline?

我希望能够从“执行管道活动”中获得自定义输出。 在调用管道的执行过程中,我使用“设置变量”活动在变量中捕获一些信息。 我希望能够在主管道中使用该值。

我知道主管道可以使用“@activity('InvokedPipeline').output”读取调用管道的名称和 runId,但这些是唯一可用的属性。

我有可调用的管道,因为它可以配置为由多个其他管道使用,假设我们可以从中获取输出。 它目前由 8 个活动组成; 我不想仅仅因为我们无法从调用的管道中获取输出而不得不在多个管道中复制它们。

参考: 执行管道活动

[
  {
    "name": "MasterPipeline",
    "type": "Microsoft.DataFactory/factories/pipelines"
    "properties": {
        "description": "Uses the results of the invoked pipeline to do some further processing",
        "activities": [
            {
                "name": "ExecuteChildPipeline",
                "description": "Executes the child pipeline to get some value.",
                "type": "ExecutePipeline",
                "dependsOn": [],
                "userProperties": [],
                "typeProperties": {
                    "pipeline": {
                        "referenceName": "InvokedPipeline",
                        "type": "PipelineReference"
                    },
                    "waitOnCompletion": true
                }
            },
            {
                "name": "UseVariableFromInvokedPipeline",
                "description": "Uses the variable returned from the invoked pipeline.",
                "type": "Copy",
                "dependsOn": [
                    {
                        "activity": "ExecuteChildPipeline",
                        "dependencyConditions": [
                            "Succeeded"
                        ]
                    }
                ]
            }
        ],
        "parameters": {},
        "variables": {}
    }
  },
  {
    "name": "InvokedPipeline",
    "type": "Microsoft.DataFactory/factories/pipelines"
    "properties": {
        "description": "The child pipeline that makes some HTTP calls, gets some metadata, and sets a variable.",
        "activities": [
            {
                "name": "SetMyVariable",
                "description": "Sets a variable after some processing from other activities.",
                "type": "SetVariable",
                "dependsOn": [
                    {
                        "activity": "ProcessingActivity",
                        "dependencyConditions": [
                            "Succeeded"
                        ]
                    }
                ],
                "userProperties": [],
                "typeProperties": {
                    "variableName": "MyVariable",
                    "value": {
                        "value": "@activity('ProcessingActivity').output",
                        "type": "Expression"
                    }
                }
            }
        ],
        "parameters": {},
        "variables": {
            "MyVariable": {
                "type": "String"
            }
        }
    }
  }
]

您好希瑟,谢谢您的询问。 自定义输出目前不是内置功能。 您可以在Azure反馈论坛中请求/支持该功能。 目前,我确实有两种解决方法。

利用调用的管道的runID,我们可以查询REST API(使用Web Activity)以获取活动运行日志,然后从那里查询活动输出。 但是,在进行查询之前,有必要进行身份验证。 REST调用以获取管道的活动对于身份验证,我建议使用Web Activity来获取oauth2令牌。 该URL为https://login.microsoftonline.com/tenantid/oauth2/token 标题"Content-Type": "application/x-www-form-urlencoded"和正文"grant_type=client_credentials&client_id=xxxx&client_secret=xxxx&resource=https://management.azure.com/" 由于此请求是为了获取凭据,因此此请求的“身份验证”设置为“无”。 这些凭据与您通过Azure Active Directory>应用程序注册创建的应用程序相对应。 不要忘记在数据工厂访问控制(IAM)中分配应用RBAC。

另一个解决方法是让子管道写入其输出。 它可以写入数据库表,也可以写入blob(我将Data Factory变量传递给了写入blob存储的Logic App),或者写入了您选择的其他对象。 由于您计划将子管道用于许多不同的父管道,因此我建议向子管道传递一个参数,该参数用于标识到父管道的输出。 这可能意味着一个blob名称,或将父运行ID写入SQL表。 这样,父管道就可以知道在哪里获取输出。

刚刚与 ADF 团队聊天,得到了回应

[10:11 PM] Mark Kromer Brajesh Jaishwal:有关于执行管道活动的自定义输出的计划吗? 是的,这项工作在工程工作计划中

暂无
暂无

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

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