Skip to content

Commit cb5d656

Browse files
johanneskoestercmeesterscoderabbitai[bot]
authored
fix: logfile quoting and scancel error handling (#140)
<!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **New Features** - Enhanced handling of output paths in SLURM job commands to better accommodate spaces and special characters. - Improved error reporting for job cancellations, providing clearer feedback on failures. - **Bug Fixes** - Added robust exception handling for job cancellation processes to capture and report errors effectively. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --------- Co-authored-by: Christian Meesters <cmeesters@users.noreply.github.com> Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
1 parent edadd3e commit cb5d656

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

snakemake_executor_plugin_slurm/__init__.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ def run_job(self, job: JobExecutorInterface):
137137
f"sbatch "
138138
f"--parsable "
139139
f"--job-name {self.run_uuid} "
140-
f"--output {slurm_logfile} "
140+
f"--output '{slurm_logfile}' "
141141
f"--export=ALL "
142142
f"--comment {comment_str}"
143143
)
@@ -408,6 +408,14 @@ def cancel_jobs(self, active_jobs: List[SubmittedJobInfo]):
408408
)
409409
except subprocess.TimeoutExpired:
410410
self.logger.warning("Unable to cancel jobs within a minute.")
411+
except subprocess.CalledProcessError as e:
412+
msg = e.stderr.strip()
413+
if msg:
414+
msg = f": {msg}"
415+
raise WorkflowError(
416+
"Unable to cancel jobs with scancel "
417+
f"(exit code {e.returncode}){msg}"
418+
) from e
411419

412420
async def job_stati(self, command):
413421
"""Obtain SLURM job status of all submitted jobs with sacct

0 commit comments

Comments
 (0)