feat: pass tags to submit_job and support dynamic env var tags#1
Closed
nh13 wants to merge 4 commits into
Closed
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
settings.tagsto thesubmit_jobAWS API call, not justregister_job_definition. This enables per-job tagging for cost tracking and resource attribution.SNAKEMAKE_AWS_BATCH_JOB_TAGSenvironment variable (comma-separatedKEY=VALUEpairs), merged withsettings.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
tests/test_batch_job_builder.pycovering: settings-only tags, env-var-only tags, merged tags, override behavior, empty/None cases, values containing=, and submit_job call verification