Commit 3b26b40
authored
feat: support pre-existing job definitions via containerOverrides (#44)
## Summary
The plugin always registered (and later deregistered) a fresh job
definition per job — flexible, but it requires
`batch:RegisterJobDefinition`/`DeregisterJobDefinition` IAM that
security-conscious accounts refuse, churns thousands of single-use
revisions, and keeps resource config out of infra review. A new optional
`--aws-batch-job-definition <name|name:rev|ARN>` setting (with a
per-rule `aws_batch_job_definition` resource override, mirroring
`batch_queue`) switches to static mode:
- No `RegisterJobDefinition` call; per-job specifics travel via
`containerOverrides` (`command`, `environment`, vcpu/mem
`resourceRequirements`, GPU only when >0 — same resource extraction as
the dynamic path)
- Submitted jobs are marked `_preexisting_job_definition` (carried
through `run_job`'s `aux=dict(job_info)`), and every deregister/cleanup
path skips them — we never deregister a definition we didn't register
- Fail-fast `WorkflowError` when combined with `job_role` or
`shared_memory_size_mb` (build-only knobs); `container_image` is
documented-ignored since its default is indistinguishable from explicit
- Tags flow through the same `_build_job_tags()` as the dynamic path
- The optional submit kwargs the dynamic path applies are mirrored via
shared resolvers: task timeout travels as `SubmitJob`'s top-level
`timeout` field (the dynamic path bakes it into the definition), and
scheduling priority forwards `schedulingPriorityOverride` identically
- Platform (EC2/FARGATE) discovery is resolved lazily, so pre-existing
mode never queries the queue — keeping its IAM surface free of
`DescribeJobQueues`/`DescribeComputeEnvironments`
- The default (dynamic) path is byte-identical to before
## Test Plan
- [x] New tests (`TestPreExistingJobDefinition`,
`TestDeregisterSkipsPreexisting`), including an end-to-end
marker-survival test through the real `submit → SubmittedJobInfo(aux=…)
→ _interpret_job_status aux write → _deregister_job` chain, plus
timeout/scheduling-priority mirroring and lazy-platform coverage
- [x] Full builder suite green (98 tests); black clean; flake8 clean1 parent 05d87f6 commit 3b26b40
4 files changed
Lines changed: 783 additions & 66 deletions
File tree
- docs
- snakemake_executor_plugin_aws_batch
- tests
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
199 | 199 | | |
200 | 200 | | |
201 | 201 | | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
89 | 89 | | |
90 | 90 | | |
91 | 91 | | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
92 | 109 | | |
93 | 110 | | |
94 | 111 | | |
| |||
277 | 294 | | |
278 | 295 | | |
279 | 296 | | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
280 | 306 | | |
281 | 307 | | |
282 | 308 | | |
| |||
0 commit comments