使用云功能触发数据流(Python SDK)作业

时间:2019-10-22 03:13:08

标签: google-cloud-dataflow

我需要处理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)

云功能未执行外壳执行部分(日志中未看到任何内容)。 如何达到使用云函数触发数据流(Python-SDK)的要求?

1 个答案:

答案 0 :(得分:2)

您不能使用子流程命令从Cloud Functions调用数据流作业。您将必须从云功能代码进行REST或gRPC调用。

可以在此处找到运行模板的示例作业[1]。

您可以参考并提交自己的工作。

1-https://github.com/GoogleCloudPlatform/python-docs-samples/tree/master/dataflow/run_template