-
Notifications
You must be signed in to change notification settings - Fork 3
Silence error when terminating jobs #738
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
WalkthroughThe change updates the Changes
Poem
📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (10)
✨ Finishing Touches
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. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #738 +/- ##
=======================================
Coverage 96.96% 96.96%
=======================================
Files 31 31
Lines 1383 1385 +2
=======================================
+ Hits 1341 1343 +2
Misses 42 42 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (1)
executorlib/task_scheduler/file/queue_spawner.py (1)
113-116: Consider usingcontextlib.suppressfor cleaner error suppression.The error handling logic is appropriate for silencing job termination failures. However, the code can be made more idiomatic by using
contextlib.suppress.Apply this diff to use the more idiomatic approach:
+import contextlib + def terminate_with_pysqa( queue_id: int, config_directory: Optional[str] = None, backend: Optional[str] = None, ): """ Delete job from queuing system Args: queue_id (int): Queuing system ID of the job to delete. config_directory (str, optional): path to the config directory. backend (str, optional): name of the backend used to spawn tasks. """ qa = QueueAdapter( directory=config_directory, queue_type=backend, execute_command=_pysqa_execute_command, ) status = qa.get_status_of_job(process_id=queue_id) if status is not None and status not in ["finished", "error"]: - try: - qa.delete_job(process_id=queue_id) - except subprocess.CalledProcessError: - pass + with contextlib.suppress(subprocess.CalledProcessError): + qa.delete_job(process_id=queue_id)
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
executorlib/task_scheduler/file/queue_spawner.py(1 hunks)
🧰 Additional context used
🪛 Ruff (0.12.2)
executorlib/task_scheduler/file/queue_spawner.py
113-116: Use contextlib.suppress(subprocess.CalledProcessError) instead of try-except-pass
Replace with contextlib.suppress(subprocess.CalledProcessError)
(SIM105)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (6)
- GitHub Check: unittest_openmpi (macos-latest, 3.13)
- GitHub Check: unittest_slurm_mpich
- GitHub Check: notebooks_integration
- GitHub Check: unittest_win
- GitHub Check: benchmark (ubuntu-latest, 3.13, .ci_support/environment-openmpi.yml)
- GitHub Check: benchmark (ubuntu-latest, 3.13, .ci_support/environment-mpich.yml)
for more information, see https://pre-commit.ci
Summary by CodeRabbit