BIC-MNI / libminc

libminc is the core library and API of the MINC toolkit
Other
19 stars 29 forks source link

Feature Request: handle SIGTERM gracefully in IO routines #101

Open gdevenyi opened 5 years ago

gdevenyi commented 5 years ago

With the introduction of SLURM on Compute Canada we've been running into some issues when the IO routines of libminc being interrupted by the timeout SIGTERM+SIGKILL.

SLURM signals with a SIGTERM, waits 30 seconds, then signals with a SIGKILL to stop overtime jobs (as configured on compute canada)

Unfortunately, due to a combination of the latency of the filesystem and the size of files being written, we're running into some minc-based tools being interrupted by the SIGKILL. This seems to result in malformed MINC or XFM files being left dangling which messes with future runs of the pipeline.

Searching through the code, it doesn't look like there's any signal handlers implemented. I would like to propose that the IO routines implement a SIGTERM handler that will stop and delete the output file if it receives a SIGTERM.

vfonov commented 5 years ago

maybe create all minc and xfm files in $TEMPDIR , and then move to to the target directory?

gdevenyi commented 5 years ago

Certainly a good solution I can implement in the meantime :+1: