使用云函数触发数据流(Python SDK)作业
Trigger Dataflow(Python SDK) Job using cloud-functions
我需要在 gcs 中处理传入的 csv 文件。
我无法通过 shell 云函数中的命令触发执行,例如:
subprocess.run([
"python", "-W", "ignore", "dataflow_ingestion_engine.py",
"gs://logs-check/csv_input/input2.csv", "--runner", "DataflowRunner"]
)
或
command = """
python tmp/dataflow_ingestion_engine.py gs://logs-check/csv_input/input2.csv --runner DataflowRunner
"""
os.system(command)
云函数未执行 shell 执行部分(在日志中未看到任何内容)。
如何使用cloud-function实现触发dataflow(Python-SDK)的需求?
您不能使用子流程命令从 Cloud Functions 调用数据流作业。您将必须从您的云函数代码进行 REST 或 gRPC 调用。
可在此处 [1] 找到 运行 模板的示例作业。
你可以参考这个提交自己的作业
1 - https://github.com/GoogleCloudPlatform/python-docs-samples/tree/master/dataflow/run_template
我需要在 gcs 中处理传入的 csv 文件。
我无法通过 shell 云函数中的命令触发执行,例如:
subprocess.run([
"python", "-W", "ignore", "dataflow_ingestion_engine.py",
"gs://logs-check/csv_input/input2.csv", "--runner", "DataflowRunner"]
)
或
command = """
python tmp/dataflow_ingestion_engine.py gs://logs-check/csv_input/input2.csv --runner DataflowRunner
"""
os.system(command)
云函数未执行 shell 执行部分(在日志中未看到任何内容)。 如何使用cloud-function实现触发dataflow(Python-SDK)的需求?
您不能使用子流程命令从 Cloud Functions 调用数据流作业。您将必须从您的云函数代码进行 REST 或 gRPC 调用。
可在此处 [1] 找到 运行 模板的示例作业。
你可以参考这个提交自己的作业
1 - https://github.com/GoogleCloudPlatform/python-docs-samples/tree/master/dataflow/run_template