gpt4 book ai didi

azure - 如何查看运行状态并停止耐用功能

转载 作者:行者123 更新时间:2023-12-02 05:51:29 24 4
gpt4 key购买 nike

我想按需处理数百万条记录,处理时间大约需要 2-3 小时。我想要无服务器,这就是为什么尝试持久功能(第一次)。我想检查一下,我可以运行持久函数多长时间,所以我创建了 3 个函数

  1. 用于启动 Orchestrator 功能的 Http 函数
  2. 协调器功能 enter image description here
  3. 事件功能

enter image description here

我的 DurableFunction 正在运行,并在过去 5 天的 Application Insights 中发出日志,根据我的代码,还需要 15 天才能完成。

我想知道如何手动停止Orchestrator功能?

我可以在 ApplicationInsights 请求表中看到数千个条目用于单次执行,有什么方法可以检查后端运行了多少个 DurableFunction?单次执行需要多长时间?

我可以在“DurableFunctionHubInstance”表中看到有关协调器功能的一些信息,但 MS 建议不要依赖表。

最佳答案

由于 Durable Functions 做了很多 checkpointing and replays the orchestration ,正常的日志记录可能并不总是很有洞察力。

获取状态

有多种方法可以查询编排的状态。其中之一是通过Azure Functions Core tools正如乔治陈提到的。

另一种查询状态的方法是直接使用 Durable Functions 的 HTTP API:

GET <rooturl>/runtime/webhooks/durableTask/instances?
taskHub={taskHub}
&connection={connectionName}
&code={systemKey}
&createdTimeFrom={timestamp}
&createdTimeTo={timestamp}
&runtimeStatus={runtimeStatus1,runtimeStatus2,...}
&showInput=[true|false]
&top={integer}

更多信息请参见 docs

HTTP API 还具有清除编排的方法。要么 single one by IDmultiple by datetime/status .

DELETE <rooturl>/runtime/webhooks/durabletask/instances/{instanceId}
?taskHub={taskHub}
&connection={connection}
&code={systemKey}

最后,您还可以使用 C# 中的 DurableOrchestrationClient API 来管理实例。以下是 GitHub 上的示例:HttpGetStatusForMany.cs

我有written & vlogged如果您想了解有关如何在 C# 中使用该 API 的更多信息,请了解如何使用 DurableOrchestrationClient API。

自定义状态

小补充:可以添加 custom status object到编排,以便您可以添加有关编排进度的丰富信息。

获取持续时间

当您查询编排实例的状态时,您会得到 DurableOrchestrationStatus目的。这包含两个属性:

  • 创建时间
  • 上次更新时间

我猜你可以减去这些并得到所花费时间的合理指示。

关于azure - 如何查看运行状态并停止耐用功能,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55982540/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com