是否可以使用 .NET SDK 检查使用管道名称运行的最新数据工厂管道的当前状态?这是我现在尝试的:
using (var client = new DataFactoryManagementClient(cred) {SubscriptionId = subscriptionId})
{
RunQueryFilter pipeline = new RunQueryFilter("PipelineName", "Equals", new List<string> { "Pipeline" });
var before = DateTime.UtcNow;
var after = before.AddHours(-24);
var param = new RunFilterParameters(after, before, null, new List<RunQueryFilter> { pipeline }, null);
PipelineRunsQueryResponse pipelineResponse = client.PipelineRuns.QueryByFactory(
resourceGroup,
dataFactoryName, param
);
}
How do I get latest run id?
想通了——
using (var client = new DataFactoryManagementClient(cred) {SubscriptionId = subscriptionId})
{
RunQueryFilter pipeline = new RunQueryFilter("PipelineName", "Equals", new List<string> { "Pipeline" });
var pipelineRuns = new RunQueryOrderBy("RunEnd", "DESC");
var before = DateTime.UtcNow;
var after = before.AddHours(-24);
var param = new RunFilterParameters(after, before, null, new List<RunQueryFilter> { pipeline }, new List<RunQueryOrderBy> { pipelineRuns });
PipelineRunsQueryResponse pipelineResponse = client.PipelineRuns.QueryByFactory(
resourceGroup,
dataFactoryName, param
);
var runId = pipelineResponse?.Value?[0]?.RunId;
}