任务分配。
fenpei的Python项目详细描述
这个小工具有助于调度、跟踪和汇总计算及其结果。它形成了一个步骤,将您从“一个具有作业工作代码的目录”转到“运行数十个作业并轻松获得结果”。
pip install fenpei
这将用于在(linux)集群上运行多个密集型计算。目前,它假定集群上有一个共享文件系统。
与你的情况相结合需要一点工作,但是它非常灵活,并且应该在设定之后让你的生活更轻松。一些功能:- 乔布斯是用Python文件创建的,使它简短而灵活。
- 它使用命令行界面(需要一些shell经验)来轻松地启动、停止或监视作业。
- 缓存、准备和结果提取的灵活性。
- 使用多处理,可以轻松地使用缓存以获得更高的性能,并使用符号链接节省空间。
请注意:
- 您必须为您的特定工作编写python代码,以及对提取的数据进行任何分析或可视化。
- 除了状态监视模式外,它在每次运行时派生状态,它不保留可能过时或损坏的数据库。
使用fenpei运行可复制作业的一个示例(有多种方法):
- 为一组参数生成一个从源代码到完成代码的脚本。
- 子类化shjobsingle作业,并在获取nosub\u文件中添加所需的所有文件。
- 将运行脚本和其他配置文件中的所有参数替换为{some_param_name}。将这些文件添加到获取子文件中。
- 为每个要运行的分析生成一个python文件(下面的示例),并用适当的值填写所有的some_param_name。
- 在shell中,使用python your_jobfile.py-s查看状态,然后使用其他标志获取更多功能(见下文)。
- 在你的工作中实现是完整的和结果(如果你想-t的话,还有崩溃原因(如果你需要特殊的行为,其他的也可以重写)。
- 如果要可视化结果,请将分析代码添加到作业文件中。
生成作业的示例文件:
def generate_jobs(): for alpha in [0.01, 0.10, 1.00]: for beta in range(0, 41): dict(name='a{0:.2f}_b{1:d}'.format(alpha, beta), subs=dict( alpha=alpha, beta=beta, gamma=5, delta='yes' ), use_symlink=True) def analyze(queue): results = queue.compare_results(('J', 'init_vib', 'init_rot',)) # You now have the results for all jobs, indexed by the above three parameters. # Visualization is up to you, and will be run when the user adds -x if __name__ == '__main__': jobs = create_jobs(JobCls=ShefJob, generator=generate_jobs(), default_batch=splitext(basename(__file__))[0]) queue = SlurmQueue(partition='example', jobs=jobs, summary_func=analyze) queue.run_argv()
这个文件为alpha和beta参数的组合注册了许多作业。现在可以使用命令行:
usage: results.py [-h] [-v] [-f] [-e] [-a] [-d] [-l] [-p] [-c] [-w WEIGHT] [-q LIMIT] [-k] [-r] [-g] [-s] [-m] [-x] [-t] [-j] [--jobs JOBS] [--cmd ACTIONS] distribute jobs over available nodes optional arguments: -h, --help show this help message and exit -v, --verbose more information (can be used multiple times, -vv) -f, --force force certain mistake-sensitive steps instead of failing with a warning -e, --restart with this, start and cleanup ignore complete (/running) jobs -a, --availability list all available nodes and their load (cache reload) -d, --distribute distribute the jobs over available nodes -l, --list show a list of added jobs -p, --prepare prepare all the jobs -c, --calc start calculating one jobs, or see -z/-w/-q -w WEIGHT, --weight WEIGHT -c will start jobs with total WEIGHT running -q LIMIT, --limit LIMIT -c will add jobs until a total LIMIT running -k, --kill terminate the calculation of all the running jobs -r, --remove clean up all the job files -g, --fix fix jobs, check cache etc (e.g. after update) -s, --status show job status -m, --monitor show job status every few seconds -x, --result run analysis code to summarize results -t, --whyfail print a list of failed jobs with the reason why they failed -j, --serial job commands (start, fix, etc) may NOT be run in parallel (parallel is faster but order of jobs and output is inconsistent) --jobs JOBS specify by name the jobs to (re)start, separated by whitespace --cmd ACTIONS run a shell command in the directories of each job that has a dir ($NAME/$BATCH/$STATUS if --s) actions are executed (largely) in the order they are supplied; some actions may call others where necessary
欢迎拉取请求、额外文档和错误报告!它是经过修订的bsd许可证,所以你可以做很多事情。