airflow常见问题汇总

Airflow2.1.1实战中踩过的坑总结!!     从初次接触Airflow到正式使用已经过取一个月,对Airflow也有了一个最基本的了解.使用过程中,踩了不少坑. 同时根据实际使用情况对airflow做了一些优化,现在把踩过的坑分享给大家,共勉!     博客列举的所有问题均是自己亲身经历,如有不严谨或者不正确的地方,烦请指出. 遇到什么问题或者有什么心得也欢迎与我交流! 注: 本博客使用的Airflow版本为2.1.1,细节之处可能与其它版本有所出入! 文章目录一. 阅读详情

AirFlow常见问题汇总

airflow常见问题的排查记录如下:


1,airflow怎么批量unpause大量的dag任务

​ 普通少量任务可以通过命令airflow unpause dag_id命令来启动,或者在web界面点击启动按钮实现,但是当任务过多的时候,一个个任务去启动就比较麻烦。其实dag信息是存储在数据库中的,可以通过批量修改数据库信息来达到批量启动dag任务的效果。假如是用mysql作为sql_alchemy_conn,那么只需要登录airflow数据库,然后更新表dag的is_paused字段为0即可启动dag任务。

示例: update dag set is_paused = 0 where dag_id like "benchmark%";


2,airflow的scheduler进程在执行一个任务后就挂起进入假死状态

出现这个情况的一般原因是scheduler调度器生成了任务,但是无法发布出去。而日志中又没有什么错误信息。

可能原因是Borker连接依赖库没安装:
如果是redis作为broker则执行pip install apache‐airflow[redis]
如果是rabbitmq作为broker则执行pip install apache-airflow[rabbitmq]
还有要排查scheduler节点是否能正常访问rabbitmq。


3,当定义的dag文件过多的时候,airflow的scheduler节点运行效率缓慢

airflow的scheduler默认是起两个线程,可以通过修改配置文件airflow.cfg改进:

[scheduler]
# The scheduler can run multiple threads in parallel to schedule dags.
# This defines how many threads will run.
#默认是2这里改为100
max_threads = 100

4,airflow日志级别更改

$ vi airflow.cfg
[core]
#logging_level = INFO
logging_level = WARNING

NOTSET < DEBUG < INFO < WARNING < ERROR < CRITICAL

如果把log的级别设置为INFO, 那么小于INFO级别的日志都不输出, 大于等于INFO级别的日志都输出。也就是说,日志级别越高,打印的日志越不详细。默认日志级别为WARNING。

注意: 如果将logging_level改为WARNING或以上级别,则不仅仅是日志,命令行输出明细也会同样受到影响,也只会输出大于等于指定级别的信息,所以如果命令行输出信息不全且系统无错误日志输出,那么说明是日志级别过高导致的。


5,AirFlow: jinja2.exceptions.TemplateNotFound

​ 这是由于airflow使用了jinja2作为模板引擎导致的一个陷阱,当使用bash命令的时候,尾部必须加一个空格:

  • Described here : see below. You need to add a space after the script name in cases where you are directly calling a bash scripts in the bash_command attribute of BashOperator - this is because the Airflow tries to apply a Jinja template to it, which will fail.
t2 = BashOperator(
task_id='sleep',
bash_command="/home/batcher/test.sh", // This fails with `Jinja template not found` error
#bash_command="/home/batcher/test.sh ", // This works (has a space after)
dag=dag)

参考链接:

Airflow2.x分布式部署dag执行失败日志无法正常获取问题 在上一篇博客中,我总结了使用Airflow过程中踩过的坑.和一些解决方案, 链接如下: Airflow2.1.1实战中踩过的坑总结!! 篇幅所限,把该博客的第11个问题单独整理出来 11. 分布式部署场景下,dag执行失败,日志无法正常查看的问题 文章目录一. 问题详细表现1.1 Airflow必要环境信息1.2 报错表现二. 问题排查与处理2.1 初步分析源码,大致定位问题2.2 确定解决方向2.3 单节点和分布式执行对比三. 进一步排查测试四.经验与教训思维固化不够细心五. 吐槽 一. 问题详细表现 1 阅读详情

相关推荐

Airflow 常见问题汇总

1- 中文注释导致dag 不显示。Airflow 常见问题汇总。2- task 依赖关系。

qq_39466612的博客 541

【入门Airflow】 使用Docker在本地快速搭建Airflow

本文主要参考官方文档编写。我将顺着官方文档的流程在本地安装Airflow ,并且附上安装过程的截图。 其实官方文档步骤写得都是比较详细,奈何这英语能力真的拉跨。 不过还是建议大家在使用过程中遇到的任何问题,优先去查看官方文档,有奇效。 ​ 官方文档: https://airflow.apache.org/docs/apache-airflow/stable/start/docker.html 生产准备 这里Airflow官方建议我们不要使用当前这种“快速入门”的方式用在生产环境。本文的这种方式就供我们

mkdir700的博客 9139

【Airflow】光速入门指南

Airflow中最为关键的概念就是DAG,中文名称是有向无环图(Directed Acyclic Graph)一个DAG代表着一个较为完整的流程,其中的组成部分是执行不同步骤的Task。如果说DAG是一条珍珠项链,那么TASK就是其中的珍珠。珍珠项链可以有不同的形态、数量和组合方式,DAG和TASK也是同理。#方式一:类的实例化test_task = PythonOperator( #以PythonOperator为例,也可以定义使用其他的Operator。

jocelyn_hhhhhh的博客 6119

airflow配置相关

airflow配置信息Airflow 1.10+安装整体流程建库、建用户Airflow安装airflow 配置1. 安装Mysql模块2. 用户认证3. 配置邮件服务4、配置Executor5. 修改log地址6. 修改webserver地址7. 可选配置8.celery配置信息9.scheduler配置信息调度程序尝试触发新任务的时间运行airflow安装问题汇总配置任务 Airflow 1.10+安装 本次安装Airflow版本为1.10+,其需要依赖Python和DB,本次选择的DB为Mysql。 本

仰望星空的小随 2136

Airflow【部署 01】Airflow官网Quick Start实操(一篇学会部署Airflow)_apache airflow教程(1)

【代码】Airflow【部署 01】Airflow官网Quick Start实操(一篇学会部署Airflow)_apache airflow教程(1)

2401_86454699的博客 1521

Airflow【部署 01】Airflow官网Quick Start实操(一篇学会部署Airflow)_apache airflow教程

【代码】Airflow【部署 01】Airflow官网Quick Start实操(一篇学会部署Airflow)_apache airflow教程。

2401_86454712的博客 1461

airflow调度问题排查

文章目录问题描述排查总结分析过程 问题描述 现在公司使用的airflow调度器很慢,每次clear一个task之后,这个task要过一段时间才会被调度器调度到,这个时间大约需要15-30s。 使用的airflow版本较老:v1.7.1.3 排查 参数问题 airflow.cfg这个文件里面有很多的关于scheduler的参数,其中跟调度密切相关的有几个: max_threads :这个是调度dag的进程数量,最多有CPU个数的进程。 scheduler_heartbeat_sec :这个是调度的时间间隔,如果上一次调度时间小于这个值,则在这个周期里面不会进行调度。 min_file_proce

无人自行车平衡控制:最小二乘法动态零点拟合实践

本文探讨了无人自行车平衡控制中动态零点的重要性及实现方法。通过最小二乘法拟合车头角度与ROL值的线性关系,解决了固定零点在转向时导致的稳定性问题。实践表明,动态零点拟合能显著提升系统平衡稳定性并降低能耗。

uran的专栏 668

R语言影像组学实战:从医学图像到预测模型的完整流程(附代码)

本文详细介绍了使用R语言进行影像组学分析的完整实战流程。从环境搭建、数据准备,到医学图像的特征提取与筛选,再到利用机器学习构建预测模型并进行评估,提供了清晰的步骤和可运行的R代码示例,帮助研究者和数据分析师掌握从医学图像到临床预测模型的核心技术。

qsc901234的博客 738

labview汽车电子通用测试程序架构,CAN通讯上位机

结合做过的汽车电子测试项目,车身控制器测试,CAN网络模块测试,电机控制器功能测试,汽车仪表盘视觉及功能测试、电气盒功能测试、EOL下线检测、车用空调控制器功能测试等项目,结合实际项目,整理编写的一个汽车电子,通用测试架构,包含项目的讲解等。6、数据保存 、数据处理、 曲线显示 、报警处理等。7、CAN总线故障信息监控及记录保存。2、参数设置(CAN端口及参数)5、CAN通讯+数据解析。

ali2805486883的博客 2775

PostgreSQL+PostGIS空间数据入库实战:从矢量栅格到GeoServer发布全流程

本文详细介绍了将矢量与栅格空间数据导入PostgreSQL并利用PostGIS扩展进行管理的完整流程。内容涵盖环境搭建、使用shp2pgsql和raster2pgsql工具进行数据入库、基础空间查询验证,以及最终通过GeoServer发布为地图服务的实战步骤,为构建空间数据平台提供清晰指引。

weixin_29268267的博客 294

PCB过流能力设计:走线与过孔电流承载计算与实践指南

在电子硬件设计中,电流承载能力是确保电路可靠性的基础。PCB走线和过孔作为电流传输的物理通道,其过流能力直接关系到系统的稳定与安全。核心原理基于焦耳定律,电流通过导体产生热量,温升成为关键约束。工程师需要综合考虑线宽、铜厚、允许温升、内外层差异及环境温度等因素。从IPC-2152标准到在线计算工具,量化评估方法帮助实现从理论到实践的跨越。在电源路径、电机驱动等大电流应用场景中,精确计算并合理布局走线与过孔阵列,是避免过热、压降乃至硬件失效的关键。本文结合工程实践,深入解析PCB过流能力的设计要点与常见误区,

weixin_33842304的博客 577

从数字后端角度谈谈occ电路(二)

从图中,我们可以清晰的看出,当scan_en为1时,test mode为1时,经过一系列逻辑单元后,得到clk_sel输出信号为1,同样可推算fast_clk_en = 0,slow_clk_en为1,此时clk_out输出为slow clk,符合我们预期。在该模式下,是使用slow clock进行scan shift,接着我们开始进行推导;从图中,我们根据逻辑运算可以看出,clk_sel输出信号为0,fast clk en为1,此时通过mux选择,clk out即为fast clk;

芯冰乐 367

【python股票价格预测】基于LSTM(长短期记忆网络)的股票价格预测(附python代码)

【python股票价格预测】基于LSTM(长短期记忆网络)的股票价格预测(附python代码)

k8291121的博客 1017

第八节:Orin NX 修改pinmux

读SPI1对应的寄存器,看对应的GPIO口是否被复用为SPI功能。说明GPIO口的功能已经被复用为SPI。烧录或者命令行烧录,都是根据。这里我们把文件统一命名成。文件,Orin NX的。测试SPI功能,基于。

孤独旅客的博客 798

win10 跳过U8环境检测的IE WebControls.rar

win10 安装u8的时候 提示IE WebControls 不通过,这个工具可以欺骗u8的检查。 跳过U8环境检测的IE WebControls。提示导入失败后,重新检测通过。

温度PID控制PLC程序

温度PID稳定控制程序,适用于欧姆龙PLC,对其他PLC也具有很大参考价值

Outlook Express 6 (OE6) for Win7/Win8/Win10

英文版 Outlook Express6.0, 兼容Win7/Win10/WinXP,解压就可用。

深度学习工具包 DeepLearningToolbox

深度学习工具包Deprecation notice.-----This toolbox is outdated and no longer maintained.There are much better tools available for deep learning than this toolbox, e.g. [Theano](http://deeplearning.net/software/theano/), [torch](http://torch.ch/) or [tensorflow](http://www.tensorflow.org/)I would suggest you use one of the tools mentioned above rather than use this toolbox.Best, Rasmus.DeepLearnToolbox================A Matlab toolbox for Deep Learning.Deep Learning is a new subfield of machine learning that focuses on learning deep hierarchical models of data.It is inspired by the human brain's apparent deep (layered, hierarchical) architecture.A good overview of the theory of Deep Learning theory is[Learning Deep Architectures for AI](http://www.iro.umontreal.ca/~bengioy/papers/ftml_book.pdf)For a more informal introduction, see the following videos by Geoffrey Hinton and Andrew Ng.* [The Next Generation of Neural Networks](http://www.youtube.com/watch?v=AyzOUbkUf3M) (Hinton, 2007)* [Recent Developments in Deep Learning](http://www.youtube.com/watch?v=VdIURAu1-aU) (Hinton, 2010)* [Unsupervised Feature Learning and Deep Learning](http://www.youtube.com/watch?v=ZmNOAtZIgIk) (Ng, 2011)If you use this toolbox in your research please cite [Prediction as a candidate for learning deep hierarchical models of data](http://www2.imm.dtu.dk/pubdb/views/publication_details.php?id=6284)```@MASTERSTHESIS\{IMM2012-06284, author = "R. B. Palm", title = "Prediction as a candidate for learning deep hierarchical models of data", year = "2012",}```Contact: rasmusbergpalm at gmail dot comDirectories included in the toolbox-----------------------------------`NN/` - A library for Feedforward Backpropagation Neural Networks`CNN/` - A library for Convolutional Neural Networks`DBN/` - A library for Deep Belief Networks`SAE/` - A library for Stacked Auto-Encoders`CAE/` - A library for Convolutional Auto-Encoders`util/` - Utility functions used by the libraries`data/` - Data used by the examples`tests/` - unit tests to verify toolbox is workingFor references on each library check REFS.mdSetup-----1. Download.2. addpath(genpath('DeepLearnToolbox'));Example: Deep Belief Network---------------------```matlabfunction test_example_DBNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit RBM and visualize its weightsrand('state',0)dbn.sizes = [100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);figure; visualize(dbn.rbm{1}.W'); % Visualize the RBM weights%% ex2 train a 100-100 hidden unit DBN and use its weights to initialize a NNrand('state',0)%train dbndbn.sizes = [100 100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);%unfold dbn to nnnn = dbnunfoldtonn(dbn, 10);nn.activation_function = 'sigm';%train nnopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.10, 'Too big error');```Example: Stacked Auto-Encoders---------------------```matlabfunction test_example_SAEload mnist_uint8;train_x = double(train_x)/255;test_x = double(test_x)/255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit SDAE and use it to initialize a FFNN% Setup and train a stacked denoising autoencoder (SDAE)rand('state',0)sae = saesetup([784 100]);sae.ae{1}.activation_function = 'sigm';sae.ae{1}.learningRate = 1;sae.ae{1}.inputZeroMaskedFraction = 0.5;opts.numepochs = 1;opts.batchsize = 100;sae = saetrain(sae, train_x, opts);visualize(sae.ae{1}.W{1}(:,2:end)')% Use the SDAE to initialize a FFNNnn = nnsetup([784 100 10]);nn.activation_function = 'sigm';nn.learningRate = 1;nn.W{1} = sae.ae{1}.W{1};% Train the FFNNopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.16, 'Too big error');```Example: Convolutional Neural Nets---------------------```matlabfunction test_example_CNNload mnist_uint8;train_x = double(reshape(train_x',28,28,60000))/255;test_x = double(reshape(test_x',28,28,10000))/255;train_y = double(train_y');test_y = double(test_y');%% ex1 Train a 6c-2s-12c-2s Convolutional neural network %will run 1 epoch in about 200 second and get around 11% error. %With 100 epochs you'll get around 1.2% errorrand('state',0)cnn.layers = { struct('type', 'i') %input layer struct('type', 'c', 'outputmaps', 6, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %sub sampling layer struct('type', 'c', 'outputmaps', 12, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %subsampling layer};cnn = cnnsetup(cnn, train_x, train_y);opts.alpha = 1;opts.batchsize = 50;opts.numepochs = 1;cnn = cnntrain(cnn, train_x, train_y, opts);[er, bad] = cnntest(cnn, test_x, test_y);%plot mean squared errorfigure; plot(cnn.rL);assert(er<0.12, 'Too big error');```Example: Neural Networks---------------------```matlabfunction test_example_NNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);% normalize[train_x, mu, sigma] = zscore(train_x);test_x = normalize(test_x, mu, sigma);%% ex1 vanilla neural netrand('state',0)nn = nnsetup([784 100 10]);opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samples[nn, L] = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.08, 'Too big error');%% ex2 neural net with L2 weight decayrand('state',0)nn = nnsetup([784 100 10]);nn.weightPenaltyL2 = 1e-4; % L2 weight decayopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex3 neural net with dropoutrand('state',0)nn = nnsetup([784 100 10]);nn.dropoutFraction = 0.5; % Dropout fraction opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex4 neural net with sigmoid activation functionrand('state',0)nn = nnsetup([784 100 10]);nn.activation_function = 'sigm'; % Sigmoid activation functionnn.learningRate = 1; % Sigm require a lower learning rateopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex5 plotting functionalityrand('state',0)nn = nnsetup([784 20 10]);opts.numepochs = 5; % Number of full sweeps through datann.output = 'softmax'; % use softmax outputopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex6 neural net with sigmoid activation and plotting of validation and training error% split training data into training and validation datavx = train_x(1:10000,:);tx = train_x(10001:end,:);vy = train_y(1:10000,:);ty = train_y(10001:end,:);rand('state',0)nn = nnsetup([784 20 10]); nn.output = 'softmax'; % use softmax outputopts.numepochs = 5; % Number of full sweeps through dataopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, tx, ty, opts, vx, vy); % nntrain takes validation set as last two arguments (optionally)[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');```[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/rasmusbergpalm/deeplearntoolbox/trend.png)](https://bitdeli.com/free "Bitdeli Badge")

上一篇: airflow分布式部署
下一篇: python3实现获取图片中的文字含中文
Glyann
博客等级 码龄9年 592粉丝 47原创
评论 1
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值
⌂ 换网址