[英]GCP cloud composer PythonOperator hanging
I am using cloud composer 2.0.23 (airflow 2.2.5) My job is a gen2 cloud function, reading\writing data in BQ.我正在使用 cloud composer 2.0.23 (airflow 2.2.5) 我的工作是 gen2 cloud function,在 BQ 中读取\写入数据。 And I send HTTP requests in the operator.
我在操作员中发送 HTTP 请求。
I notice that if I have jobs with execution time more than 10~15min, even if the cloud function finished successfully, the status shown on airflow never updates.我注意到,如果我有执行时间超过 10~15 分钟的作业,即使云 function 成功完成,airflow 上显示的状态也不会更新。
[update1] Cloud function info: [update1] 云 function 信息:
Airflow job status: Airflow 作业状态:
It should be "success".
应该是“成功”。
Code snippet for calling cloud functions in my DAG file:在我的 DAG 文件中调用云函数的代码片段:
def call_cloud_function_endpoint(gcf_url, **kwargs):
req = urllib.request.Request(gcf_url)
auth_req = google.auth.transport.requests.Request()
id_token = google.oauth2.id_token.fetch_id_token(auth_req, gcf_url)
req.add_header('Authorization', f'Bearer {id_token}')
response = urllib.request.urlopen(req).read()
result = json.loads(response)
return result
PythonOperator(
task_id='tid',
python_callable=call_cloud_function_endpoint,
op_kwargs={}
)
Any suggestion is appreciated任何建议表示赞赏
Thanks in prior事先感谢
I have replicated your case with a large-sized public dataset, and it was stuck in "up for retry" or "running" in Airflow.我已经使用大型公共数据集复制了您的案例,并且它在 Airflow 中陷入“等待重试”或“正在运行”。 So I changed the
Memory allocated
and Timeout
in Cloud Functions configuration.所以我在 Cloud Functions 配置中更改了
Memory allocated
和Timeout
。 Try to increase both but I set Timeout into maximum.尝试增加两者,但我将超时设置为最大值。
It worked for me.它对我有用。
This image is the logs for Airflow.此图像是 Airflow 的日志。
This is for Cloud Function.这适用于云 Function。
Let me know if this can help or if not, we can still figure out the solution to your problem.让我知道这是否有帮助,如果没有,我们仍然可以找出解决您问题的方法。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.