Skip to content

feat: implement attempt-based resource scaling (RAM/walltime doubling on retry) #127

Closed
1 of 1 issue completed

Description

@kopardev

Summary

The pipeline currently sets --restart-times 2 in the aspen CLI, so Snakemake retries failed jobs up to twice. However, resources are read from the static cluster.json and do not scale with attempt number — each retry runs with identical RAM and walltime, so jobs that fail due to resource exhaustion will fail again.

Desired behavior

On the first retry (attempt 2), automatically double walltime (and optionally RAM). On the second retry (attempt 3), double again. This is directly supported by Snakemake via attempt-aware resource lambdas:

# in a rule:
resources:
    mem_mb = lambda wildcards, attempt: attempt * 48_000,
    runtime = lambda wildcards, attempt: attempt * 960   # 16 h × attempt

What needs to change

  1. Add resources: blocks to all resource-intensive rules (trim, align, remove_BL, atac_tss, etc.) using attempt-based lambdas.
  2. Update the SLURM cluster-submission command in aspen to read from {resources.mem_mb} and {resources.runtime} instead of cluster.json.
  3. cluster.json can then be retired or kept only for defaults/fallbacks.

Why this matters

Related

⚡ Generated using AI ⚡

Activity

  1. self-assigned this
    on Aug 21, 2026
  2. kopardev commented on Aug 21, 2026

    @kopardev
    ContributorAuthor

    Also: extend to lscratch (addresses #113)

    The same attempt-based scaling should apply to lscratch (SLURM GRES), not just RAM and walltime. Issue #113 reports that remove_BL runs out of scratch space; static cluster.json has no way to escalate on retry.

    Proposed approach — add a disk_gb resource to affected rules:

    # e.g. in remove_BL rule:
    resources:
        mem_mb   = lambda wildcards, attempt: attempt * 120_000,
        runtime  = lambda wildcards, attempt: attempt * 720,   # 12 h × attempt
        disk_gb  = lambda wildcards, attempt: attempt * 256    # 256 GB × attempt

    Then in the cluster submit command, pass --gres=lscratch:{resources.disk_gb} instead of the hardcoded value from cluster.json.

    This means the scope of this issue covers all three resource axes:

    • RAM (mem_mb)
    • Walltime (runtime)
    • Scratch space (disk_gb → lscratch)

    Related: #113 (lscratch for remove_BL)

    ⚡ Generated using AI ⚡

  3. added a commit that references this issue on Sep 26, 2026
    7dc1c67
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions