airflow 1.10.1 简述及实例(ssh_script_hive_main_sub)
概述
结果示例
![在这里插入图片描述](https://note.youdao.com/yws/api/personal/file/7CFAE44FA1E14CFAAB6EDA56DE068703?method=download&shareKey=7727117b008f1680ef58b38ef09c8c13)
安装(采坑)
示例Code以及操作
示例操作
- airflow -h/version
- 查看帮助,记住这个就好了
- 其参数解析,可作为源码参考
parser = CLIFactory.get_parser()
args = parser.parse_args()
args.func(args)
- airflow list_dags
- airflow list_tasks ssh_run_test
- airflow test ssh_run_test print_date 20190121
- 测试ssh_run_test dag中的print_date任务示例
- airflow test ssh_run_test ssh_run_script 20190121
- 测试ssh_run_test dag中的ssh_run_script任务示例
- airflow backfill ssh_run_test -s 20190120 -e 20190121
- 测试ssh_run_test dag在指定时间内的任务调度
- 常用operator简介,参看 https://www.jianshu.com/p/6f5e1447c8fb
- 对于LocalExecutor方式,在airflow.cfg的同级建立dags目录,将相关py文件方式在其目录下
- python dags/python_run_test.py 即可提交调度,然后使用上面的命令进行测试
- script_run_test.py
- 脚本的命令,注意最后的空格,必须要保留,如果使用Jinja template,最后的空格则不用,airflow机制如此(空格其实是用于转义)
- python_run_test.py
- main_sub_dag_test.py
- ssh_run_test.py
- 需指定conn_id,在web界面的admin/connections下面进行配置
- hive_cli_run_test.py
- hive_cli_conn_id在web界面的admin/connections下面进行配置,同时本地需有hive-cli支持
- hive_server_run_test.py
- hive_cli_conn_id在web界面的admin/connections下面进行配置,使用jdbc进行连接hive-server
- 支持队列设置(mapred_queue)/参数传递(hiveconfs)/数据库设定(schema)/hql文件支持
- short_circuit_run_test.py