Skip to content

feat: per-rule task timeout via aws_batch_task_timeout resource#42

Merged
nh13 merged 1 commit into
snakemake:mainfrom
nh13:nh_per-rule-task-timeout
Jun 9, 2026
Merged

feat: per-rule task timeout via aws_batch_task_timeout resource#42
nh13 merged 1 commit into
snakemake:mainfrom
nh13:nh_per-rule-task-timeout

Conversation

@nh13

@nh13 nh13 commented Jun 9, 2026

Copy link
Copy Markdown
Collaborator

Adds a per-rule aws_batch_task_timeout resource that overrides the workflow-level --aws-batch-task-timeout setting, mirroring the existing per-rule batch_queue pattern.

  • Precedence: the per-rule resource wins over the global flag; falls back to the flag when the resource is absent; omits the timeout entirely when neither is set (preserving the no-default-timeout behavior from fix: don't apply a 300s default task timeout to every job #41).
  • Validation: the value is coerced to an integer and must be ≥ 60 s (the AWS minimum). Errors name the source (resource vs flag) so the cause is unambiguous.
rule align:
    resources:
        aws_batch_task_timeout=14400  # 4 h
    ...

Depends on #41 (conditional task-timeout), now merged. Documented under a new "Task Timeout" section in docs/further.md.

Testing

New TestPerRuleTaskTimeout covers precedence, resource-only, fallback, both-absent, < 60, non-numeric, and the exact-60 boundary. Full suite: 61 unit tests pass; black + flake8 clean.

Summary by CodeRabbit

Release Notes

  • New Features

    • Support for per-rule AWS Batch task timeout configuration, which takes precedence over workflow-level settings.
    • Workflow-level timeout control with minimum 60-second validation (AWS requirement); omitted if not configured.
  • Documentation

    • Added "Task Timeout" section with configuration examples and behavior clarification.

Support a per-rule aws_batch_task_timeout resource that overrides the global
--aws-batch-task-timeout setting. Falls back to the setting when the resource is
absent; omits the timeout entirely when neither is set. Coerces the value to an
integer and enforces the AWS minimum of 60 seconds, with errors naming the
source (resource vs flag). Mirrors the existing batch_queue per-rule pattern.
@coderabbitai

coderabbitai Bot commented Jun 9, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 404f3302-dc99-440f-b212-f8097db9e588

📥 Commits

Reviewing files that changed from the base of the PR and between 1d7d6e6 and e08476b.

📒 Files selected for processing (3)
  • docs/further.md
  • snakemake_executor_plugin_aws_batch/batch_job_builder.py
  • tests/test_batch_job_builder.py

📝 Walkthrough

Walkthrough

This PR adds support for per-rule task timeout overrides in AWS Batch job definitions. Rules can now set aws_batch_task_timeout to override the workflow-level setting, with integer coercion and AWS minimum validation, and tests verify all timeout selection and validation paths.

Changes

Per-Rule Task Timeout Override Feature

Layer / File(s) Summary
Per-rule timeout override and validation in job builder
snakemake_executor_plugin_aws_batch/batch_job_builder.py
build_job_definition now checks per-rule aws_batch_task_timeout resource before falling back to workflow-level settings.task_timeout. When a timeout exists, it is coerced to an integer and validated to be ≥60 seconds with source-specific error messages. If both sources are absent, the timeout field is omitted so AWS applies its default.
Test helper and comprehensive test suite
tests/test_batch_job_builder.py
Introduces _make_builder_with_rule_timeout helper to construct a builder with configurable global and per-rule timeouts, and TestPerRuleTaskTimeout test class with seven cases asserting resource override precedence, fallback behavior, omission when absent, and validation of integer type and 60-second minimum.
Task timeout documentation and usage examples
docs/further.md
Adds "Task Timeout" section explaining the --aws-batch-task-timeout workflow-wide flag (60-second minimum) and per-rule aws_batch_task_timeout resource (which takes precedence), with a concrete rule example and clarification of default behavior when neither is set.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Possibly related PRs

  • snakemake/snakemake-executor-plugin-aws-batch#41: Both PRs modify BatchJobBuilder.build_job_definition to control the AWS Batch job-definition timeout (omitting it when unset and validating >=60), and both extend/change tests/test_batch_job_builder.py around timeout behavior—main PR further adds the per-rule aws_batch_task_timeout override.
  • snakemake/snakemake-executor-plugin-aws-batch#40: Both PRs touch BatchJobBuilder.build_job_definition's AWS Batch job-definition timeout/task_timeout handling and its validation (min 60s behavior), so the main PR's timeout precedence/coercion builds directly on the retrieved PR's timeout logic/tests.

Suggested reviewers

  • cademirch
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main feature: adding a per-rule task timeout capability via the aws_batch_task_timeout resource, which is the primary change across the modified files.
Docstring Coverage ✅ Passed Docstring coverage is 90.00% which is sufficient. The required threshold is 80.00%.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@nh13 nh13 requested a review from cademirch June 9, 2026 07:20
@nh13

nh13 commented Jun 9, 2026

Copy link
Copy Markdown
Collaborator Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Jun 9, 2026

Copy link
Copy Markdown
Contributor
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@nh13 nh13 merged commit f708eac into snakemake:main Jun 9, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants