Serverless并行步骤(type:foreach)怎么做异常处理? 当我把errorMappings和catch节点放在foreach这一level的时候,会报错“Additional property catch is not allowed”和“Additional property errorMappings is not allowed”。而我把这两个节点放在内部循环步骤(type:task)这个level的时候,会报错“The goto target 'ParallelCallback' must be on the same level as the step 'TransToTargetFormat'.”

对于Serverless的并行步骤(type:foreach),异常处理的正确做法是在内部循环步骤(type:task)的level上进行处理。具体操作可以按照以下步骤进行:

1、在foreach的“itemsPath”节点中,指定需要循环的数据数组。

2、在foreach的“batchSize”节点中,指定每个批次需要处理的数据数量。

3、在foreach的“parallelization”节点中,指定并行处理的级别。

4、在foreach的内部循环步骤(type:task)的level上,添加“errorMappings”和“catch”节点进行异常处理。

5、在内部循环步骤(type:task)中,使用try-catch语句对可能发生异常的代码进行异常捕获和处理。

6、如果需要在内部循环步骤(type:task)中跳出整个并行步骤,则可以使用“goto”语句加上对应的跳转目标。

注意,需要将“goto”语句的目标放在并行步骤(type:foreach)的level上,而不能放在内部循环步骤(type:task)的level上,否则会报错“The goto target 'xxx' must be on the same level as the step 'xxx'.”。

2023-04-04 16:38:44 train_test_split.py代码解释 《Play with Serverless Kubernetes》电子版地址 假设测试数据集test_data为随机生成的,并设置小批次。model神经网络已经训练好了,怎么用MSE来做测试 借力函数计算 FC,HEROZ 打造专业级 AI 日本将棋服务