Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/258.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# Azure持久功能。编排会产生许多不需要的活动_C#_Azure_Orchestration_Azure Durable Functions - Fatal编程技术网

C# Azure持久功能。编排会产生许多不需要的活动

C# Azure持久功能。编排会产生许多不需要的活动,c#,azure,orchestration,azure-durable-functions,C#,Azure,Orchestration,Azure Durable Functions,我正在尝试使用持久的函数进行一些数据转换。为此,我有一个TimerTriggered函数,它调用编排函数,然后生成转换活动 我的问题是,在调用编排函数时,它会立即生成许多活动,甚至在到达启动该函数的代码部分之前。由于我的数据列表仅包含3个元素,因此我的编排功能只应启动3个活动 但是可以看到,在我下面包含的日志输出中,在调用编排函数之后,在包含context.CallActivityAsync的循环开始之前,许多活动函数将立即运行 我根本找不到任何原因。在这些活动启动之后,我的循环将实际运行并启动

我正在尝试使用持久的函数进行一些数据转换。为此,我有一个TimerTriggered函数,它调用编排函数,然后生成转换活动

我的问题是,在调用编排函数时,它会立即生成许多活动,甚至在到达启动该函数的代码部分之前。由于我的数据列表仅包含3个元素,因此我的编排功能只应启动3个活动

但是可以看到,在我下面包含的日志输出中,在调用编排函数之后,在包含context.CallActivityAsync的循环开始之前,许多活动函数将立即运行

我根本找不到任何原因。在这些活动启动之后,我的循环将实际运行并启动我期望的3个活动

TimerTriggered函数:

[FunctionName("StartupFunc")]
public static async Task Run([TimerTrigger("0 */5 * * * *", RunOnStartup = true, UseMonitor = false)]TimerInfo myStartTimer, [OrchestrationClient] DurableOrchestrationClient orchestrationClient, TraceWriter log)
{
    log.Info("*** STARTUP FUNCTION *** - Time triggered");
    List<OrchestrationModel> ExportModels = await getData();

    log.Info("** Orchestration Start **");
    string id = await orchestrationClient.StartNewAsync("OrchestratorFunc", ExportModels);
    log.Info("** Orchestration End **");
}
首先,不要对计时器触发器使用runnstartup=true。它将在未来的版本中被删除,因为它会给人们带来很多问题和困惑。这可能与你看到的问题有关

您所描述的听起来像是您在过去创建了一系列尚未完成的编排,这些活动执行对应于这些旧的、未完成的编排。编排是持久且长期运行的,因此它们将继续尝试运行,直到完成或失败为止,即使在您关闭并重新启动函数应用程序之后也是如此

如果要从头开始,请更改Azure存储队列中的名称或删除所有邮件。

首先,不要对计时器触发器使用runnstartup=true。它将在未来的版本中被删除,因为它会给人们带来很多问题和困惑。这可能与你看到的问题有关

您所描述的听起来像是您在过去创建了一系列尚未完成的编排,这些活动执行对应于这些旧的、未完成的编排。编排是持久且长期运行的,因此它们将继续尝试运行,直到完成或失败为止,即使在您关闭并重新启动函数应用程序之后也是如此


如果您想从头开始,请更改您的名称或删除Azure存储队列中的所有邮件。

非常感谢,最后让我继续测试!我的功能仍在开发中,仅在本地执行。我无法确定任务中心存储在本地的何处。但至少我现在可以在每次出现问题时更改任务中心名称。@Jeppe如果您正在使用本地Azure存储仿真器运行,则可以使用命令行删除调试会话之间的所有状态AzureStorageEmulator.exe全部清除。我就是这么做的谢谢,你的回答实际上已经促使我问了这个问题,得到了准确的答案。非常感谢,最后让我继续我的测试!我的功能仍在开发中,仅在本地执行。我无法确定任务中心存储在本地的何处。但至少我现在可以在每次出现问题时更改任务中心名称。@Jeppe如果您正在使用本地Azure存储仿真器运行,则可以使用命令行删除调试会话之间的所有状态AzureStorageEmulator.exe全部清除。我就是这么做的谢谢,你的回答实际上已经促使我提出了这个问题,得到了确切的答案
[FunctionName("OrchestratorFunc")]
public static async Task<string> TransformOrchestration([OrchestrationTrigger] DurableOrchestrationContext context, TraceWriter log)
{
    var dataList = context.GetInput<List<OrchestrationModel>>();

    foreach (var data in dataList)
    {
        await context.CallActivityAsync<string>("TransformToFormat", new TransformModel(data));
    }
}
[FunctionName("TransformToFormat")]
[public static async Task<string> RunTransformation([ActivityTrigger] DurableActivityContext context, TraceWriter log)
{
    log.Info($"*** TRANSFORM FUNCTION - ACTIVITY *** executed at: {DateTime.Now}  ({context.InstanceId})");
    TransformModel = context.GetInput<TransformModel>();

    //Do some work with TransformModel
    log.Info($"* 1 ({context.InstanceId})");
    //Do more work
    log.Info($"* 4 ({context.InstanceId})");
    return $"return value ({context.InstanceId})");
}
[21/9/2018 03:09:02] Reading host configuration file 'D:\git\TopoAPI\SyncToSQL\bin\Debug\net461\host.json'
[21/9/2018 03:09:02] Host configuration file read:
[21/9/2018 03:09:02] {}
[21/9/2018 03:09:02] Starting Host (HostId=topored-988367233, Version=1.0.11913.0, InstanceId=fe4247ff-d15f-4587-8efe-4c3e53fd776d, ProcessId=22320, AppDomainId=1, Debug=False, ConsecutiveErrors=0, StartupCount=1, FunctionsExtensionVersion=)
[21/9/2018 03:09:02] Loaded custom extension 'BotFrameworkConfiguration'
[21/9/2018 03:09:02] Loaded custom extension 'SendGridConfiguration'
[21/9/2018 03:09:02] Loaded custom extension 'EventGridExtensionConfig'
[21/9/2018 03:09:02] Loaded binding extension 'DurableTaskExtension' from 'referenced by: Method='TransformToRelational.Transform.RunTransformation', Parameter='context'.'
[21/9/2018 03:09:03] registered EventGrid Endpoint = http://localhost:7071/admin/extensions/EventGridExtensionConfig
[21/9/2018 03:09:03] Generating 3 job function(s)
[21/9/2018 03:09:03] Found the following functions:
[21/9/2018 03:09:03] TransformToRelational.Orchestrator.TransformOrchestration
[21/9/2018 03:09:03] TransformToRelational.Startup.Run
[21/9/2018 03:09:03] TransformToRelational.Transform.RunTransformation
[21/9/2018 03:09:03]
[21/9/2018 03:09:03] Host initialized (1353ms)
[21/9/2018 03:09:04] Host lock lease acquired by instance ID '00000000000000000000000059E1D128'.
[21/9/2018 03:09:04] Function started (Id=45f7d798-95a7-46c9-8769-8d17bf7fb18f)
[21/9/2018 03:09:04] Executing 'StartupFunc' (Reason='Timer fired at 2018-09-21T11:09:04.7440997+08:00', Id=45f7d798-95a7-46c9-8769-8d17bf7fb18f)
Debugger listening on [::]:5858
[21/9/2018 03:09:05] Function started (Id=6b83b8f2-0489-4fa0-a9be-9afb5179649c)
[21/9/2018 03:09:05] Executing 'TransformAndFormat' (Reason='', Id=6b83b8f2-0489-4fa0-a9be-9afb5179649c)
[21/9/2018 03:09:05] Function started (Id=c4ffc3ee-b02a-4786-a8ce-a8bb503b4523)
[21/9/2018 03:09:05] Executing 'TransformAndFormat' (Reason='', Id=c4ffc3ee-b02a-4786-a8ce-a8bb503b4523)
[21/9/2018 03:09:06] Function started (Id=ad33ef92-45eb-4759-b3ef-363b7fe95fd5)
[21/9/2018 03:09:06] Executing 'TransformAndFormat' (Reason='', Id=ad33ef92-45eb-4759-b3ef-363b7fe95fd5)
[21/9/2018 03:09:06] Function started (Id=b66452d4-04b8-4f32-b934-4ebcf7cfeed9)
[21/9/2018 03:09:06] Executing 'TransformAndFormat' (Reason='', Id=b66452d4-04b8-4f32-b934-4ebcf7cfeed9)
[21/9/2018 03:09:06] Function started (Id=bc4f7c77-10dc-4a2f-95b2-86de3a7199e6)
[21/9/2018 03:09:06] Executing 'TransformAndFormat' (Reason='', Id=bc4f7c77-10dc-4a2f-95b2-86de3a7199e6)
[21/9/2018 03:09:06] Function started (Id=f4e79a26-7cbb-44e9-a77f-df643990f89a)
[21/9/2018 03:09:06] Executing 'TransformAndFormat' (Reason='', Id=f4e79a26-7cbb-44e9-a77f-df643990f89a)
[21/9/2018 03:09:06] Function started (Id=2098e488-ba76-4684-afcb-31cb8789ee14)
[21/9/2018 03:09:06] Executing 'TransformAndFormat' (Reason='', Id=2098e488-ba76-4684-afcb-31cb8789ee14)
[21/9/2018 03:09:11] Function started (Id=5277d6bf-4024-40b9-b52f-d833d7fb8c81)
[21/9/2018 03:09:12] Function started (Id=476fe0b2-d577-4e97-9880-8cb7795efd44)
[21/9/2018 03:10:14] Executing 'TransformAndFormat' (Reason='', Id=476fe0b2-d577-4e97-9880-8cb7795efd44)
[21/9/2018 03:10:14] Executing 'TransformAndFormat' (Reason='', Id=5277d6bf-4024-40b9-b52f-d833d7fb8c81)
[21/9/2018 03:10:14] Function started (Id=05799036-9476-450f-abb6-f0fff061b225)
[21/9/2018 03:10:14] Function started (Id=3d486a91-17ff-4d80-86ee-74dc88599470)
[21/9/2018 03:10:14] Executing 'TransformAndFormat' (Reason='', Id=3d486a91-17ff-4d80-86ee-74dc88599470)
[21/9/2018 03:10:14] Function started (Id=110e9add-d7f5-4f5f-a0ef-242f4438ea39)
[21/9/2018 03:10:14] Executing 'TransformAndFormat' (Reason='', Id=110e9add-d7f5-4f5f-a0ef-242f4438ea39)
[21/9/2018 03:10:14] Function started (Id=022e6a88-8c54-4ea7-9f27-154200cd40f4)
[21/9/2018 03:10:14] Executing 'TransformAndFormat' (Reason='', Id=022e6a88-8c54-4ea7-9f27-154200cd40f4)
[21/9/2018 03:10:14] Function started (Id=f0c3e8a2-24f2-4e09-9043-3d50c1ecba16)
[21/9/2018 03:10:14] Executing 'TransformAndFormat' (Reason='', Id=f0c3e8a2-24f2-4e09-9043-3d50c1ecba16)
[21/9/2018 03:10:14] Function started (Id=99218445-2ce5-494a-a654-f8d4fbf11a95)
[21/9/2018 03:10:14] Executing 'TransformAndFormat' (Reason='', Id=99218445-2ce5-494a-a654-f8d4fbf11a95)
[21/9/2018 03:10:14] Executing 'TransformAndFormat' (Reason='', Id=05799036-9476-450f-abb6-f0fff061b225)
[21/9/2018 03:10:14] Function started (Id=a4f91185-6048-4d4a-b262-72d883af0425)
[21/9/2018 03:10:14] Executing 'TransformAndFormat' (Reason='', Id=a4f91185-6048-4d4a-b262-72d883af0425)
[21/9/2018 03:10:14] Function started (Id=1e981e76-c1f3-44c7-acff-1d4f3434b714)
[21/9/2018 03:10:14] Executing 'TransformAndFormat' (Reason='', Id=1e981e76-c1f3-44c7-acff-1d4f3434b714)
[21/9/2018 03:10:14] Function started (Id=28c01a28-762f-4ac6-99b6-04d203aa8494)
[21/9/2018 03:10:14] Executing 'TransformAndFormat' (Reason='', Id=28c01a28-762f-4ac6-99b6-04d203aa8494)
[21/9/2018 03:10:14] Function started (Id=797a4709-e6b7-499f-9d59-3341d6f07978)
[21/9/2018 03:10:14] Executing 'TransformAndFormat' (Reason='', Id=797a4709-e6b7-499f-9d59-3341d6f07978)
[21/9/2018 03:10:14] Function started (Id=8441563d-c2da-4524-b7e6-1f4cc020efbc)
[21/9/2018 03:10:14] Executing 'TransformAndFormat' (Reason='', Id=8441563d-c2da-4524-b7e6-1f4cc020efbc)
[21/9/2018 03:10:14] Function started (Id=6c8000c0-5ec2-4ca8-be56-95330ca23765)
[21/9/2018 03:10:14] Executing 'TransformAndFormat' (Reason='', Id=6c8000c0-5ec2-4ca8-be56-95330ca23765)
[21/9/2018 03:10:14] Function started (Id=27c68235-e52b-492c-a8bc-45e91b3929d1)
[21/9/2018 03:10:14] Executing 'TransformAndFormat' (Reason='', Id=27c68235-e52b-492c-a8bc-45e91b3929d1)
[21/9/2018 03:10:15] *** STARTUP FUNCTION *** - Time triggered
[21/9/2018 03:10:15] *** TRANSFORM FUNCTION - ACTIVITY *** executed at: 21/9/2018 11:10:15   (51f1ef294cf04351804736cae5f22a07)
[21/9/2018 03:10:15] *** TRANSFORM FUNCTION - ACTIVITY *** executed at: 21/9/2018 11:10:15   (76e3044b7a0849c18991b10fd6b34075)
[21/9/2018 03:10:15] *** TRANSFORM FUNCTION - ACTIVITY *** executed at: 21/9/2018 11:10:15   (ced17a0553c14d138c9feb7b72e44b50)
[21/9/2018 03:10:15] *** TRANSFORM FUNCTION - ACTIVITY *** executed at: 21/9/2018 11:10:15   (35cc4b30355049938c59aa8880d0203e)
[21/9/2018 03:10:15] *** TRANSFORM FUNCTION - ACTIVITY *** executed at: 21/9/2018 11:10:15   (d166b287697140b5beb80ba02109cfcb)
[21/9/2018 03:10:15] *** TRANSFORM FUNCTION - ACTIVITY *** executed at: 21/9/2018 11:10:15   (a8afa4ebc24c4a5596d36e32f7acb687)
[21/9/2018 03:10:15] *** TRANSFORM FUNCTION - ACTIVITY *** executed at: 21/9/2018 11:10:15   (57ef1d9f3e6649a9bc6f1628126b7f38)
[21/9/2018 03:10:15] *** TRANSFORM FUNCTION - ACTIVITY *** executed at: 21/9/2018 11:10:15   (bd3e3a2751cb48438c2465540dc61e97)
[21/9/2018 03:10:15] *** TRANSFORM FUNCTION - ACTIVITY *** executed at: 21/9/2018 11:10:15   (40dfd72548134412901a5ff2f7566cc2)
[21/9/2018 03:10:15] *** TRANSFORM FUNCTION - ACTIVITY *** executed at: 21/9/2018 11:10:15   (93b6ed9c00b04d9fb626c09d0b696d9c)
[21/9/2018 03:10:15] *** TRANSFORM FUNCTION - ACTIVITY *** executed at: 21/9/2018 11:10:15   (8fd9fb5c1ea94954896acf3780add1ad)
[21/9/2018 03:10:15] *** TRANSFORM FUNCTION - ACTIVITY *** executed at: 21/9/2018 11:10:15   (66401ebba4794869aebf043caab8c427)
[21/9/2018 03:10:15] *** TRANSFORM FUNCTION - ACTIVITY *** executed at: 21/9/2018 11:10:15   (fb6be8992f984e24b61237f3082ff54e)
[21/9/2018 03:10:15] *** TRANSFORM FUNCTION - ACTIVITY *** executed at: 21/9/2018 11:10:15   (e6c732ab6b7c4f57892ff7d95c952c8b)
[21/9/2018 03:10:15] *** TRANSFORM FUNCTION - ACTIVITY *** executed at: 21/9/2018 11:10:15   (90de278cf5a84cb981672a1c3432a5e4)
[21/9/2018 03:10:15] *** TRANSFORM FUNCTION - ACTIVITY *** executed at: 21/9/2018 11:10:15   (30825f010c3d4982a10f3a034d9adef7)
[21/9/2018 03:10:15] *** TRANSFORM FUNCTION - ACTIVITY *** executed at: 21/9/2018 11:10:15   (47e7aea0bc1e47fe970ef43bd6409baf)
[21/9/2018 03:10:15] *** TRANSFORM FUNCTION - ACTIVITY *** executed at: 21/9/2018 11:10:15   (1cca0179bdcc438b84a0a3b82a8ad807)
[21/9/2018 03:10:15] *** TRANSFORM FUNCTION - ACTIVITY *** executed at: 21/9/2018 11:10:15   (42ac98ba32e641afb92cd72cb4728b58)
[21/9/2018 03:10:15] *** TRANSFORM FUNCTION - ACTIVITY *** executed at: 21/9/2018 11:10:15   (f833676170834d4a936544b4ce6ba9d2)
[21/9/2018 03:10:15] *** TRANSFORM FUNCTION - ACTIVITY *** executed at: 21/9/2018 11:10:15   (f366d84806e34503bdb4ba7d982711aa)
[21/9/2018 03:10:15] *** TRANSFORM FUNCTION - ACTIVITY *** executed at: 21/9/2018 11:10:15   (d55121d270394755b88b4f34cd3b3c97)
[21/9/2018 03:10:17] ** Orchestration Start **
[21/9/2018 03:10:17] * 1  (57ef1d9f3e6649a9bc6f1628126b7f38)
[21/9/2018 03:10:17] * 1  (93b6ed9c00b04d9fb626c09d0b696d9c)
[21/9/2018 03:10:17] * 1  (ced17a0553c14d138c9feb7b72e44b50)
[21/9/2018 03:10:17] * 1  (d166b287697140b5beb80ba02109cfcb)
[21/9/2018 03:10:17] * 1  (51f1ef294cf04351804736cae5f22a07)
[21/9/2018 03:10:17] * 1  (40dfd72548134412901a5ff2f7566cc2)
[21/9/2018 03:10:17] ** Orchestration End **
[21/9/2018 03:10:17] Function completed (Success, Id=45f7d798-95a7-46c9-8769-8d17bf7fb18f, Duration=72573ms)
[21/9/2018 03:10:17] Executed 'StartupFunc' (Succeeded, Id=45f7d798-95a7-46c9-8769-8d17bf7fb18f)
[21/9/2018 03:10:17] The next 5 occurrences of the schedule will be:
[21/9/2018 03:10:17] 21/9/2018 11:15:00
[21/9/2018 03:10:17] 21/9/2018 11:20:00
[21/9/2018 03:10:17] 21/9/2018 11:25:00
[21/9/2018 03:10:17] 21/9/2018 11:30:00
[21/9/2018 03:10:17] 21/9/2018 11:35:00
[21/9/2018 03:10:17] * 1  (76e3044b7a0849c18991b10fd6b34075)
[21/9/2018 03:10:17] * 1  (35cc4b30355049938c59aa8880d0203e)
[21/9/2018 03:10:17] * 1  (a8afa4ebc24c4a5596d36e32f7acb687)
[21/9/2018 03:10:17] * 1  (bd3e3a2751cb48438c2465540dc61e97)
[21/9/2018 03:10:17] * 1  (8fd9fb5c1ea94954896acf3780add1ad)
[21/9/2018 03:10:17] * 1  (66401ebba4794869aebf043caab8c427)
[21/9/2018 03:10:17] * 1  (fb6be8992f984e24b61237f3082ff54e)
[21/9/2018 03:10:17] * 1  (e6c732ab6b7c4f57892ff7d95c952c8b)
[21/9/2018 03:10:17] * 1  (90de278cf5a84cb981672a1c3432a5e4)
[21/9/2018 03:10:17] * 1  (30825f010c3d4982a10f3a034d9adef7)
[21/9/2018 03:10:17] * 1  (47e7aea0bc1e47fe970ef43bd6409baf)
[21/9/2018 03:10:17] * 1  (1cca0179bdcc438b84a0a3b82a8ad807)
[21/9/2018 03:10:17] * 1  (42ac98ba32e641afb92cd72cb4728b58)
[21/9/2018 03:10:17] * 1  (f833676170834d4a936544b4ce6ba9d2)
[21/9/2018 03:10:17] * 1  (f366d84806e34503bdb4ba7d982711aa)
[21/9/2018 03:10:17] * 1  (d55121d270394755b88b4f34cd3b3c97)