feat: make --aws-batch-job-role optional for pre-existing job definitions#52
feat: make --aws-batch-job-role optional for pre-existing job definitions#52nh13 wants to merge 2 commits into
Conversation
|
Warning Review limit reached
Next review available in: 50 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (4)
📝 WalkthroughWalkthroughThe executor now performs AWS Batch and optional IAM role preflight validation during startup, failing on confirmed misconfiguration while continuing through uncertain API or permission states. Documentation and tests cover these checks and mocked workflows bypass them. ChangesAWS Batch preflight validation
Estimated code review effort: 3 (Moderate) | ~20 minutes Sequence Diagram(s)sequenceDiagram
participant Executor
participant AWS Batch
participant IAM
Executor->>AWS Batch: Describe job queue and compute environments
AWS Batch-->>Executor: Return resource states
Executor->>IAM: Get configured role
IAM-->>Executor: Return role or error
Executor-->>Executor: Fail on confirmed misconfiguration or continue
Possibly related PRs
Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
12733ce to
d82bf31
Compare
d82bf31 to
65a84ea
Compare
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@snakemake_executor_plugin_aws_batch/__init__.py`:
- Around line 457-467: Update the compute-environment validation loop in the
preflight logic to aggregate usability across all queue-attached compute
environments rather than adding a fatal problem for each individual disabled,
invalid, or zero-capacity environment. Only report failure when every attached
compute environment is unusable, while allowing execution when at least one is
healthy; add a regression test covering a queue with mixed healthy and unhealthy
compute environments.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 01a10571-f671-49fb-9193-a8ed11f5b5ef
📒 Files selected for processing (4)
docs/further.mdsnakemake_executor_plugin_aws_batch/__init__.pytests/test_preflight.pytests/tests_mocked_api.py
🚧 Files skipped from review as they are similar to previous changes (3)
- tests/tests_mocked_api.py
- docs/further.md
- tests/test_preflight.py
…role Run a best-effort validation in __post_init__, before any job is submitted, so a definitively misconfigured setup fails fast with a clear error instead of leaving jobs stuck forever: - _queue_problems(): inspect the configured job queue and its compute environment(s); report a disabled/invalid queue or compute environment, a fatal queue status (INVALID/DELETING/DELETED), or maxvCpus=0. - _preflight_validate(): raise WorkflowError on any confirmed problem, then check the job role. - _validate_job_role(): iam:GetRole existence check; NoSuchEntity fails fast, anything else (most importantly a missing iam:GetRole permission) degrades. The check is conservative about uncertainty: a transient API error, a queue mid-update, or a missing describe/iam permission degrades to a debug message and the workflow proceeds. Only a confirmed-bad configuration blocks. Documented in docs/further.md; the workflow-level mocked test short-circuits preflight the same way it short-circuits platform detection.
…ions A pre-existing job definition (`--aws-batch-job-definition`) carries its own role, so the plugin rejects `--aws-batch-job-role` in that mode. But `job_role` was `required: True`, forcing users to supply the very flag pre-existing mode rejects — making the setting-level pre-existing path unusable. Make `job_role` optional at the settings layer and enforce it conditionally in the preflight check: fail fast when it is combined with `--aws-batch-job-definition`, and when it is omitted in the default register-per-job mode (where it is baked into each registered definition). Update the docs and tests accordingly.
65a84ea to
938a7d1
Compare
A pre-existing job definition (
--aws-batch-job-definition) carries its own role, so the plugin rejects--aws-batch-job-rolein that mode. Butjob_rolewasrequired: Trueat the settings layer, forcing users to supply the very flag pre-existing mode rejects — so the setting-level pre-existing path was effectively unusable (it always tripped the "cannot combine" guard).This makes
job_roleoptional at the settings layer and enforces it conditionally in the startup preflight check:--aws-batch-job-rolecombined with--aws-batch-job-definition(fail fast, before any queue/IAM call).--aws-batch-job-rolein the default register-per-job mode, where it is baked into each registered definition — preserving the previous guarantee, now enforced in preflight rather than byrequired: True.Docs and unit tests updated. Stacked on #49 (preflight validation); the first commit is #49's and will drop out once that merges.
Summary by CodeRabbit
New Features
Documentation