最终,我想做的是有一个Python脚本,该脚本可以在创建HTTP请求时动态地运行.就像这样:App 1运行并发出一个Webhook,Python脚本立即捕获该Webhook并执行其所有操作.
Ultimately, what I want to do is have a Python script that runs whenever a HTTP request is created, dynamically. It'd be like: App 1 runs and sends out a webhook, Python script catches the webhook immediately and does whatever it does.
我看到您可以在GCP中使用Composer和Airflow来做到这一点.
I saw that you could do this in GCP with Composer and Airflow.
但是在这些工具之后,我遇到了几个问题 cloud.google/composer/docs/how-to/using/triggering-with-gcf :
But I'm having several issues following these instrutions cloud.google/composer/docs/how-to/using/triggering-with-gcf:
在Cloud Shell中运行此操作以授予Blob签名权限:
Running this in Cloud Shell to grant blob signing permissions:
gcloud iam服务帐户add-iam-policy-binding your-project-id@appspot.gserviceaccount --member = serviceAccount:your-project-id@appspot.gserviceaccount --role = roles/iam.serviceAccountTokenCreator
gcloud iam service-accounts add-iam-policy-binding your-project-id@appspot.gserviceaccount --member=serviceAccount:your-project-id@appspot.gserviceaccount --role=roles/iam.serviceAccountTokenCreator
当我输入项目ID时,我会得到一个找不到针对您的project-id@appspot.gserviceaccount的盖亚ID"
When I put in my project ID, I get a "Gaia id not found for your-project-id@appspot.gserviceaccount"
是否有更好的方法来做我想做的事情(即动态运行Python脚本)?
Is there a better way to do what I'm trying to do (i.e. run Python scripts dynamically)?
推荐答案获得原因:未找到电子邮件的盖亚ID< project-id> @ appspot.gserviceaccount 错误在您的项目中启用所有必需的API.请按照以下步骤操作:
The reason for getting: Gaia id not found for email <project-id>@appspot.gserviceaccount error is not enabling all needed APIs in your project. Please follow the steps:
我测试了该方案,首先没有启用API,并且检索到与您相同的错误.启用API后,错误消失并且IAM策略已正确更新.
I tested the scenario, firstly without enabling APIs and I've retrieved the same error as you. After enabling the APIs, error disappear and IAM policy has been updated correctly.
已经充分描述了代码实验室教程,其中显示了使用Google Cloud Functions触发DAG的工作流程.
There is already well described Codelabs tutorial, which shows the workflow of triggering the DAG with Google Cloud Functions.
更多推荐
Cloud Composer + Airflow:设置DAW以在HTTP上触发(或者我应该使用Cloud Functions吗?)
发布评论