Skip to content

feat: pass tags to submit_job and support dynamic env var tags#1

Closed
nh13 wants to merge 4 commits into
mainfrom
feat/submit-job-tags
Closed

feat: pass tags to submit_job and support dynamic env var tags#1
nh13 wants to merge 4 commits into
mainfrom
feat/submit-job-tags

Conversation

@nh13

@nh13 nh13 commented Apr 12, 2026

Copy link
Copy Markdown
Owner

Summary

  • Pass settings.tags to the submit_job AWS API call, not just register_job_definition. This enables per-job tagging for cost tracking and resource attribution.
  • Support dynamic tags from a SNAKEMAKE_AWS_BATCH_JOB_TAGS environment variable (comma-separated KEY=VALUE pairs), merged with settings.tags (env var overrides on key conflict). This allows coordinator jobs to pass per-run metadata (e.g., commit hashes) to child jobs.

Motivation

When using Snakemake with AWS Batch for benchmarking, we need to associate child jobs back to the coordinator run for cost tracking. Currently tags are only applied to job definitions, not individual job submissions, making it impossible to query Batch for jobs belonging to a specific run.

Dependencies

This PR is stacked on snakemake#38 (fix-vcpu-threads-and-validation) which must be merged first.

Test plan

  • 15 new unit tests in tests/test_batch_job_builder.py covering: settings-only tags, env-var-only tags, merged tags, override behavior, empty/None cases, values containing =, and submit_job call verification
  • All existing tests still pass

radusuciu and others added 4 commits January 31, 2026 12:08
As described in issue snakemake#34, validation assumed a Fargate compute environment. We can detect the compute environment by looking up the queue, and only run the Fargate specific validation when necessary.
Use self.job.threads for vCPU instead of the undocumented _cores resource.
Falls back to _cores for backward compatibility if threads is not set.
Avoid ValueError from min() on empty list when vCPU is not valid
for any Fargate memory configuration.
Add tags to the submit_job AWS API call (previously only applied to
register_job_definition). Also support reading dynamic tags from the
SNAKEMAKE_AWS_BATCH_JOB_TAGS environment variable as comma-separated
KEY=VALUE pairs, merged with settings.tags (env var overrides on
conflict). This enables per-run cost tracking when a coordinator job
sets the env var for child jobs to inherit.
@nh13 nh13 closed this Apr 12, 2026
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