fix: Circumvent problematic Slurm re-submission#49
Conversation
|
Warning Review limit reached
More reviews will be available in 45 minutes and 3 seconds. Learn how PR review limits work. Your organization has run out of usage credits. Purchase more credits in the billing tab to continue. ⌛ How to resolve this issue?After more reviews become available, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available. Please see our Fair Usage Limits Policy for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughThe SLURM executor reads an inherited attempt value from ChangesAttempt inheritance for retry escalation
Sequence Diagram(s)sequenceDiagram
participant Workflow as Workflow
participant SLURMInit as SLURM Executor __init__
participant SLURMRun as SLURM Executor run_job
participant JobImpl as _run_job_impl
Workflow->>SLURMInit: provide executor_settings._inherited_attempt
SLURMInit->>SLURMInit: set self.inherited_attempt
SLURMInit->>SLURMInit: debug dump os.environ
Workflow->>SLURMRun: call run_job(job)
SLURMRun->>SLURMRun: save original_attempt = job.attempt
SLURMRun->>SLURMRun: job.attempt = self.inherited_attempt
SLURMRun->>SLURMRun: job.reset_params_and_resources()
SLURMRun->>JobImpl: call _run_job_impl(job)
JobImpl-->>SLURMRun: return
SLURMRun->>SLURMRun: job.attempt = original_attempt (finally)
SLURMRun->>SLURMRun: job.reset_params_and_resources()
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ 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 |
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
snakemake_executor_plugin_slurm_jobstep/__init__.py (1)
111-130: Confirmjob.attemptmutation is supported and restored safelySnakemake’s
jobobject exposesattemptwith a setter, so assigningjob.attemptis supported at the Python/API level. This code scopes the mutation to_run_job_impl(job)and restores the original value infinally, reducing side-effect risk.🤖 Prompt for 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. In `@snakemake_executor_plugin_slurm_jobstep/__init__.py` around lines 111 - 130, The current run_job mutates job.attempt to inherited_attempt and restores it in finally; ensure this is safe by verifying the job object supports setting attempt, so keep the pattern but add a guard: in run_job check hasattr(job, "attempt") and whether assignment is allowed before saving original_attempt and assigning self.inherited_attempt, call _run_job_impl(job) in the try block, and always restore original_attempt in the finally only if you previously saved it; reference run_job, self.inherited_attempt, original_attempt, _run_job_impl, and job.attempt when making these checks and the guarded restore.
🤖 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_slurm_jobstep/__init__.py`:
- Around line 93-107: The code parses SNAKEMAKE_ATTEMPT into
self.inherited_attempt but doesn't enforce it being positive; update the parsing
logic in the block handling inherited_attempt (SNAKEMAKE_ATTEMPT) so after
converting to int you verify the value is >= 1, set self.inherited_attempt only
if it is >= 1 and log an info message, otherwise log a warning (similar to the
existing ValueError branch) and set self.inherited_attempt = None; keep the
existing ValueError handling for non-integers.
---
Nitpick comments:
In `@snakemake_executor_plugin_slurm_jobstep/__init__.py`:
- Around line 111-130: The current run_job mutates job.attempt to
inherited_attempt and restores it in finally; ensure this is safe by verifying
the job object supports setting attempt, so keep the pattern but add a guard: in
run_job check hasattr(job, "attempt") and whether assignment is allowed before
saving original_attempt and assigning self.inherited_attempt, call
_run_job_impl(job) in the try block, and always restore original_attempt in the
finally only if you previously saved it; reference run_job,
self.inherited_attempt, original_attempt, _run_job_impl, and job.attempt when
making these checks and the guarded restore.
🪄 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: 02c06f40-8236-4c9d-bac2-ffc7c3164ca0
📒 Files selected for processing (1)
snakemake_executor_plugin_slurm_jobstep/__init__.py
Tested to fix snakemake/snakemake-executor-plugin-slurm#348 combined with snakemake/snakemake-executor-plugin-slurm#470. This code was generated with help from AI.
Summary by CodeRabbit
New Features
Bug Fixes
Chores