简体   繁体   English

如何使用 Prefect 使用不同的参数多次运行流程?

[英]How can I run a flow several times using different parameters using Prefect?

How can I run a flow several times using different parameters?如何使用不同的参数多次运行流程? I'm trying to use create_flow_run.map like this:我正在尝试像这样使用 create_flow_run.map :

dump_to_gcs_flow = create_flow_run.map(
    flow_name=unmapped(utils_constants.FLOW_DUMP_TO_GCS_NAME.value),
    project_name=unmapped(constants.PREFECT_DEFAULT_PROJECT.value),
    parameters=tables_to_zip,
    labels=unmapped(current_flow_labels),
    run_name=unmapped("Dump to GCS"),
)

except for parameters all the other arguments are constants, so I use unmapped on them.除了parameters之外,所有其他 arguments 都是常量,所以我对它们使用unmapped的。 tables_to_zip is a list of dictionaries containing the parameters values for each table to be zip. tables_to_zip是一个字典列表,其中包含要为 zip 的每个表的参数值。 However, this didn't work.然而,这并没有奏效。 I'm currently receiving the (somewhat crypt) error:我目前收到(有点隐秘)错误:

prefect.exceptions.ClientError: [{'message': 'parsing UUID failed, expected String, but encountered Array', 'locations': [{'line': 2, 'column': 5}], 'path': ['flow_run'], 'extensions': {'path': '$.selectionSet.flow_run.args.where.id._eq', 'code': 'parse-failed', 'exception': {'message': 'parsing UUID failed, expected String, but encountered Array'}}}]

what am I doing wrong here?我在这里做错了什么?

It would need to be a list of dictionaries with the key being parameter name - this Discourse topic discusses this problem in much more depth: https://discourse.prefect.io/t/how-to-map-over-flows-with-various-parameter-values/365/2它需要是一个字典列表,其中键是参数名称 - 这个 Discourse 主题更深入地讨论了这个问题: https://discourse.prefect.io/t/how-to-map-over-flows-with -各种参数值/365/2

LMK, if you still have issues implementing this pattern after reading this LMK,如果您在阅读本文后仍然遇到实施此模式的问题

(btw Prefect 2 is the default version now and makes this much easier: https://docs.prefect.io ) (顺便说一句,Prefect 2 现在是默认版本,这让这更容易: https://docs.prefect.io

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

相关问题 如何使用 cmd arguments 组织完美流程? - How to organize prefect flow with the using of cmd arguments? 使用 with 和 object Flow() 为 python 创建完美流时出错 - Error to create a flow in prefect for python using with and object Flow() 如何使用不同的参数多次运行 TestClass? - How to run TestClass several time with different parameters? 如何在失败时恢复 Prefect 流程而无需重新运行整个流程? - How to resume a Prefect flow on failure without having to re-run the entire flow? 如何在 Prefect 服务器上远程部署流程? - How to deploy flow remotly on Prefect server? 如何在Python 3中多次运行函数以获得不同的结果 - How to run a function several times for different results in Python 3 使用不同的参数多次运行 python 脚本 - Running python script several times with different parameters 如何在完美中为 control_flow 分配名称? - How to assign a name to a control_flow in prefect? 如何使用线程“生成”多个TCP客户端而不是打开多个终端实例并多次运行脚本? - How “generate ” multiple TCP clients using Threads instead of opening multiple instances of the terminal and run the script several times? 在完美任务“批处理”中使用迭代器 - using iterator in prefect task “batching”
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM