【发布时间】:2022-02-01 03:04:49
【问题描述】:
我在 GCS 存储桶中有一个脚本。我想使用 BashOperator 在我的气流 dag 中运行脚本。 VM 中存在气流。
我的限制是我无法在 VM 中复制该脚本并运行,因为它内部运行了一些作业和连接。如果我复制脚本,我还必须复制依赖的 jar 和文件。
我尝试使用gsutil cat <script path in bucket> | sh,但它不起作用。
我还遇到了使用以下代码访问存储桶文件的帖子,但我不知道如何在 BashOperator 中使用它或运行它。
from google.cloud import storage
client = storage.Client()
bucket = client.get_bucket('test_bucket')
blob = bucket.get_blob('temp_files_folder/test.txt')
任何建议!
【问题讨论】:
标签: bash google-cloud-platform google-cloud-storage virtual-machine airflow