pyiron / pyiron/executorlib

[Feature] Catch signals for SLURM jobs?

Open
#1,049 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement
Dominant language
Python
Stars
77
Forks
7
Avg merge
10h 32m
Merged PRs (30d)
12

Description

This is just a thought triggered by an observation.

We noticed that when a SLURM job is scanceled that is currently inside a tempfile.TemporaryDirectory context manager, the context is not unwound (leaving behind a temporary directory that could potentially be large and which could potentially accumulate on nodes over time).

Apparently, this is expected behavior as the __exit__ block only runs during normal Python exception unwinding.

Now, I believe as an executorlib user one can work around this by catching the SIGTERM signal directly in the corresponding Python code and raising an exception instead, allowing the code to unwind. Or perhaps executorlib could do this for us, such that cancelling a slurm job is seen by the Python code as an exception being raised rather than a SIGTERM.

I'm not sure whether it is a good idea for executorlib to do this sort of transformation, just wanted to mention the idea

@gitdowski

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Begin with the SLURM job execution path and the Python SIGTERM handling around scancel; the issue does not identify a file or test. Determine whether cancellation should be converted into an exception that permits TemporaryDirectory cleanup, then define and test the expected behavior before implementing it.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
hpc
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Active
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.