简体   繁体   English

如何在本地管理 Azure 持久功能任务中心?

[英]How to administer the Azure Durable functions Task Hub locally?

I am currently developing an Azure Durable Function and I ran into the issue that unfinished orchestrations would hang around for next time after I tried to run my functions.我目前正在开发一个 Azure Durable Function,我遇到了一个问题,即在我尝试运行我的函数后,未完成的编排会在下次出现。

The problem was the task hub, as explained in the answer to this question :问题是任务中心,正如在这个问题的答案中所解释的:

Orchestrations were created and did not finish in a previous run.编排已创建但未在上一次运行中完成。 Orchestrations are durable and long-running, so they will continue to try to run until they complete or fail, even after you shut down your function app and restart it.编排是持久且长期运行的,因此它们将继续尝试运行,直到完成或失败,即使在您关闭函数应用并重新启动它之后也是如此。

The problem now is that while there is information on how I'd manage the task hub on Azure, I cannot then find any information on how to administer it while I am doing local testing.现在的问题是,虽然有关于如何管理 Azure 上的任务中心的信息,但我在进行本地测试时找不到任何有关如何管理它的信息。

Right now, I change the name of the test hub every time the problem arises, but I would much rather have a few lines of code that simply clear any existing data in the task hub.现在,每次出现问题时我都会更改测试中心的名称,但我更希望有几行代码来简单地清除任务中心中的任何现有数据。

How do I administer the Azure Durable functions Task Hub locally, in code?如何使用代码在本地管理 Azure 持久功能任务中心?

As suggested in the comments, you can use the Azure Storage Emulator to clear out your local instances of the TaskHub.正如评论中所建议的,您可以使用 Azure 存储模拟器清除 TaskHub 的本地实例。 You can actually use the command AzureStorageEmulator.exe clear all if you don't have any other data stored in your local emulated storage that you care about.如果您关心的本地模拟存储中没有存储任何其他数据,您实际上可以使用命令AzureStorageEmulator.exe clear all According to this answer , you can find that exe in C:\\Program Files (x86)\\Microsoft SDKs\\Azure\\Storage Emulator .根据此答案,您可以在C:\\Program Files (x86)\\Microsoft SDKs\\Azure\\Storage Emulator找到该 exe。

If you do have blobs, tables, or queues that are being emulated locally that you don't want to wipe just to remove the reference to the TaskHub, you can do as Murray Foxcroft suggested in the comments and use the storage explorer to connect to your local emulator, and remove all references to your specific TaskHub.如果您确实有在本地模拟的 blob、表或队列,您不想擦除只是为了删除对 TaskHub 的引用,则可以按照 Murray Foxcroft 在评论中的建议进行操作,并使用存储资源管理器连接到您的本地模拟器,并删除对您的特定 TaskHub 的所有引用。 The TaskHub uses a combination of tables, blobs, and queues, so make sure to be thorough. TaskHub 使用表、blob 和队列的组合,所以一定要彻底。

Durable Functions Monitor VsCode 扩展显示您所有的任务中心,并允许管理、清理甚至删除它们。

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

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