Skip to content

Conversation

@radusuciu
Copy link

@radusuciu radusuciu commented Nov 11, 2025

This PR adds a resource configuration item aws_batch_container_image that can be used to customize the container any given rule uses when running on AWS Batch. As discussed in #30 and #31, currently it's possible to specify a container image that every rule in a workflow uses, and if you want to run an individual rule in a different container you have use apptainer, with some extra hoops if you need to authenticate with a private registry (eg. ECR).

There is a bit of a catch however - you need to base your image on the snakemake docker image. I don't think this is something that would be easy to work around and probably not a good fit with snakemake's design. I can update the documentation if this is going to be merged.

Summary by CodeRabbit

Release Notes

  • New Features

    • Rules can now specify custom container images on a per-rule basis to override the global default configuration, enabling use of specialized containers for different workloads.
  • Documentation

    • Added documentation explaining how to configure rule-specific container images with examples.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Nov 11, 2025

📝 Walkthrough

Walkthrough

Implements per-rule container image overrides for AWS Batch jobs via an aws_batch_container_image resource parameter. When specified per-rule, this parameter takes precedence over the global container image configuration. Includes documentation describing the feature and usage example.

Changes

Cohort / File(s) Summary
Documentation
docs/further.md
Adds "Rule-Specific Container Images" section documenting the new aws_batch_container_image resource parameter, including usage example and explanation of per-rule container customization.
Implementation
snakemake_executor_plugin_aws_batch/__init__.py
Implements per-rule container image override by computing container_image from job.resources["aws_batch_container_image"] if present, otherwise falling back to self.container_image, and passing the computed value to BatchJobBuilder.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

  • Specific areas to review:
    • Verify the fallback logic correctly prioritizes rule-specific aws_batch_container_image over the global self.container_image
    • Confirm job.resources access is safe and handles missing keys appropriately
    • Validate that BatchJobBuilder correctly receives and uses the computed container_image parameter

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the main change: adding a rule-specific container configuration option. This directly aligns with the primary purpose of the PR, which introduces per-rule container image customization via the aws_batch_container_image resource parameter.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

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.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (1)
docs/further.md (1)

31-48: Consider documenting the container image constraint.

The documentation clearly explains the feature and provides a helpful example. However, per the PR description, custom container images must be based on the Snakemake Docker image. Consider adding a note about this constraint to help users avoid runtime errors.

Example addition:

 This allows you to use different containers with specialized tools for different rules within the same workflow, rather than requiring all tools to be present in a single container.
+
+**Note:** Custom container images must be based on the Snakemake Docker image to ensure compatibility with the executor plugin's job execution requirements.
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 2525ca0 and 2334d44.

📒 Files selected for processing (2)
  • docs/further.md (1 hunks)
  • snakemake_executor_plugin_aws_batch/__init__.py (1 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
**/*.py

⚙️ CodeRabbit configuration file

**/*.py: Do not try to improve formatting.
Do not suggest type annotations for functions that are defined inside of functions or methods.
Do not suggest type annotation of the self argument of methods.
Do not suggest type annotation of the cls argument of classmethods.
Do not suggest return type annotation if a function or method does not contain a return statement.

Files:

  • snakemake_executor_plugin_aws_batch/__init__.py
🧬 Code graph analysis (1)
snakemake_executor_plugin_aws_batch/__init__.py (1)
snakemake_executor_plugin_aws_batch/batch_job_builder.py (1)
  • BatchJobBuilder (14-136)
🔇 Additional comments (1)
snakemake_executor_plugin_aws_batch/__init__.py (1)

135-145: LGTM! Clean implementation of per-rule container image override.

The implementation correctly retrieves the rule-specific container image from job resources with a proper fallback to the global container image. The use of dict.get() with a default value is the appropriate pattern, and the integration with BatchJobBuilder is correct.

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.

1 participant