Skip to content

[Feature] Catch signals for SLURM jobs? #1049

Description

@ltalirz

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions