并行执行(长)操作,尊重这些操作之间的依赖关系
ActionTree的Python项目详细描述
actiontree是一个python(2.7和3.5+)库,用于并行执行(长)操作,同时考虑这些操作之间的依赖关系。 创建要执行的操作的依赖关系图,然后在其根上调用execute函数。
它是根据MIT license授权的。 在Python package index上有。 它的documentation 它的source code在github上。
有问题吗?评论?漏洞?想做贡献吗?Open an issue!
快速启动
从pypi安装:
$ pip install ActionTree
使用依赖项创建甘特图和依赖关系图:
$ pip install 'ActionTree[dependency_graphs,gantt]'
导入:
>>> from ActionTree import execute >>> from ActionTree.stock import CallSubprocess
执行一些操作:
>>> link = CallSubprocess(["g++", "a.o", "b.o", "-o", "test"]) >>> link.add_dependency(CallSubprocess(["g++", "-c", "a.cpp", "-o", "a.o"])) >>> link.add_dependency(CallSubprocess(["g++", "-c", "b.cpp", "-o", "b.o"])) >>> report = execute(link)
确认一切顺利:
>>> report.is_success True >>> os.path.isfile("test") True