airflow - Can you specify the number of threads for certain tasks in a DAG?
问题描述
I'm very new to Airflow and while I have read the docs and some answers about Airflow's configuration regarding parallelism, it seems I have not yet found the answer to specifying threads used in a task.
My current case is I have 5 tasks (in the form of a Python script) that only do API calls (but to different API service) and transform the data. For each task I can make up to 1000+ calls, so I try to utilize multithreading in the script. Unfortunately, when I try to run the multithreaded script in Airflow, it doesn't use the multithreading mechanism in the script. I feel like this is because of Airflow configuration that overrides the child script or am I wrong? Any help or answer is appreciated, thank you.
解决方案
使用KubernetesPodOperator运行您的脚本。
您可以使用 python 基础映像并按原样运行您的脚本。这应该与您在本地执行脚本的方式非常相似,但现在它是在 kubernetes pod 中完成的。
推荐阅读
- sql - 为什么我没有收到错误?数据库如何理解嵌套子查询中的相关列?
- .net - .Net - 在同一 IIS 上的两个 webapi 之间共享令牌
- javascript - Angular2中的通用变量名机制
- objective-c - 在 Objective-C 完成块内运行 C 回调函数
- java - 如何使用 mockito 模拟 java.util.base64 方法
- ios - 为 UINavigationBar 的标题设置没有特定大小的自定义字体
- r - 如何在 R 中的日期序列中包含年份值?
- c# - 来自 ajax 的 Web api Post 调用失败
- javascript - Angular 5 和 6 之间导入 javascript 库的差异 - 这是正确的语法
- java - YARN“user.dir”上的火花