【问题标题】:How to use Snakemake for memory management?如何使用 Snakemake 进行内存管理?
【发布时间】:2021-07-08 01:01:00
【问题描述】:

我尝试强制 Snakemake 按顺序运行规则(包含许多作业)以避免内存冲突。


rule run_eval_all:
    input:
        expand("config["out_model"] + "{iLogit}.rds", iLogit = MODELS)

rule eval_model:
    input:
        script = config["src_est"] + "evals/script.R",
        model = config["out_model"] + "{iLogit}.rds",
    output:
        "out/{iLogit}.rds"

    threads: 5
    resources:
        mem_mb = 100000
    shell:
        "{runR} {input.script} "
        "--out {output}"

我通过snakemake --cores all --resources mem_mb=100000 run_eval_all 运行规则。但我不断收到如下错误:

x86_64-conda-linux-gnu % snakemake --resources mem_mb=100000 run_eval_all
Traceback (most recent call last):
  File "/local/home/zhakaida/mambaforge/envs/r_snake/bin/snakemake", line 10, in <module>
    sys.exit(main())
  File "/local/home/zhakaida/mambaforge/envs/r_snake/lib/python3.9/site-packages/snakemake/__init__.py", line 2401, in main
    resources = parse_resources(args.resources)
  File "/local/home/zhakaida/mambaforge/envs/r_snake/lib/python3.9/site-packages/snakemake/resources.py", line 85, in parse_resources
    for res, val in resources_args.items():
AttributeError: 'list' object has no attribute 'items'

如果我运行snakemake --cores all run_eval_all,它可以工作,但作业并行运行(如预期的那样),有时会导致内存过度使用和崩溃。我该如何正确地为 Snakemake 申请内存?

【问题讨论】:

    标签: snakemake


    【解决方案1】:

    该错误是由于在 Snakemake 6.5.1 https://github.com/snakemake/snakemake/issues/1069 中解析 --resources 参数的一个已知问题。

    更新到snakemake 6.5.3 或更高版本,看看您的问题是否仍然存在。

    【讨论】:

    • 我猜还是降级到 6.4.1 :)
    猜你喜欢
    • 2011-08-22
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-10-30
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多