一个基于python的可视化流程调度工具——dagobah
标签:
开源系统pythonit |
分类: 工具 |
官网说的很清楚了,https://github.com/thieman/dagobah,觉得好用,还是宣传宣传
==What is dagobah==
大家做多任务的调度,通常是用 【
crontab+shel+可执行程序或脚本】,来执行一个定时的多任务调度的负责逻辑,负责点的可能你自己包装一个任务调度脚本(别人读起来用起来很痛苦啊,每个人包装自己的任务调度脚本)
现在跟大家介绍一个 可视化任务调度工具,让你摆脱 crontab+shell ,妈妈再也不也担心我的学习
他也可以支持多机任务调度(还未尝试),使用http通讯或者搭个zookeeper即可(有时间我包装包装贡献上去)
当然OOZIE,zookeeper做分布式流程调度是很好用的,但太重了一些且主要服务于分布式任务
示例:task1运行完,2,3准备运行,task4还未调度到
==install==
使用SQLite后端(默认)
pip
install -i http://pypi.v2ex.com/simple pysqlite sqlalchemy
alembic
使用MongoDB后端
pip install -i
http://pypi.v2ex.com/simple pymongo
pip install -i http://pypi.v2ex.com/simple dagobah
加-i 是为了使用国内下载的镜像
==启动==
vi ~/.dagobahd.yml
修改
host: 0.0.0.0
nohup dagobahd &
==编辑job,task==
访问 http://xx.xx.xx.xx:9000/
(如果有防火墙记得开9000端口)
密码见 ~/.dagobahd.yml
==> task1.py <==
# coding: gbk
defmain():
outf=open('testfile','a')
outf.write('11111\n')
outf.write('2222\n')
outf.write('adfa\n')
outf.write('aadfss\n')
outf.write('eeee\n')
outf.close()
if__name__ == '__main__':
main()
==>task2.py <==
defmain():
print 'task2'
inf=open('testfile','r')
outf=open('outfile1','w')
for line in inf:
outf.write(line.strip()+'task2\n')
inf.close()
outf.close()
if__name__ == '__main__':
main()
==>task3.py <==
defmain():
print 'task3'
inf=open('testfile','r')
outf=open('outfile2','w')
for line in inf:
outf.write(line.strip()+'task3\n')
inf.close()
outf.close()
if__name__ == '__main__':
main()
# coding: gbk
def
if
==>
def
if
==>
def
if
==运行任务==
每个任务都可以定制crontab,运行时将变成红色,运行完成变成绿色
==查看运行结果==
点击view job,view task即可查看stdout,stderr
==后续==
在dagobah基础上,我需要一个可以导入配置文件供task和job使用,还有多机调度功能(借助zookeeper),期待我的github发布
前一篇:3个互联网公司的性价比
后一篇:python读写protobuf

加载中…