我的orchestrator接收一个负载,该负载包含需要与其他数据集一起传递给活动函数的指令
如何将多个参数传递给活动函数?还是我必须将所有数据混合在一起
def orchestrator_function(context: df.DurableOrchestrationContext):
# User defined configuration
instructions: str = context.get_input()
task_batch = yield context.call_activity("get_tasks", None)
# Need to pass in instructions too
parallel_tasks = [context.call_activity("perform_task", task) for task in task_batch]
results = yield context.task_all(parallel_tasks)
return results
perform_task
活动需要来自task_batch
的项和用户输入instructions
我在我的function.json
中做了什么吗
解决方法 不太理想,但我可以将多个参数作为一个元组传递
something = yield context.call_activity("activity", ("param_1", "param_2"))
然后,我只需要在活动中引用参数的正确索引
为了补充@Ari的好答案,这里的代码将数据从客户端函数(本例中为HTTP请求)一直传递到活动函数:
Client -> Orchestrator -> Activity
客户
编曲
活动
似乎没有课本上的方法可以做到这一点。我选择给我的单个参数一个通用名称,如
parameter
或payload
然后,在orchestrator中传入值时,我会这样做:
然后在activity函数中,我再次解包
编辑:一些隐藏的文档似乎显示https://docs.microsoft.com/en-us/azure/azure-functions/durable/durable-functions-error-handling?tabs=python
相关问题 更多 >
编程相关推荐