Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions docs/further.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,24 @@ SNAKEMAKE_AWS_BATCH_REGION
SNAKEMAKE_AWS_BATCH_JOB_QUEUE
SNAKEMAKE_AWS_BATCH_JOB_ROLE

# Rule-Specific Container Images

By default, all jobs use the global container image specified via `--container-image`. However, you can specify a different container image for individual rules using the `aws_batch_container_image` resource parameter:

```python
rule my_rule:
input:
"input.txt"
output:
"output.txt"
resources:
aws_batch_container_image="my-custom-image:tag"
shell:
"process_data.sh {input} {output}"
```

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.

# Example

## Create environment
Expand Down
8 changes: 7 additions & 1 deletion snakemake_executor_plugin_aws_batch/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,11 +132,17 @@ def run_job(self, job: JobExecutorInterface):
# argument 'external_job_id'.

try:
# Use rule-level container image if specified via resources,
# otherwise fall back to global container image
container_image = job.resources.get(
"aws_batch_container_image", self.container_image
)

job_definition = BatchJobBuilder(
logger=self.logger,
job=job,
envvars=self.envvars(),
container_image=self.container_image,
container_image=container_image,
settings=self.settings,
job_command=self.format_job_exec(job),
batch_client=self.batch_client,
Expand Down