futureverse / futureverse/future.batchtools

Slurm template: Signal SIGINT by default to allow R code to catch it gracefully

Offen
#103 0 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
feature/resources scheduler/slurm
Vorherrschende Sprache
R
Sterne
87
Forks
10
PR-Merge-Kennzahlen
Keine gemergten PRs in 30 T.

Beschreibung

When a job is approaching it's maximum run-time limit, Slurm sends a `SIGTERM` 30 seconds before sending a `SIGKILL` (abrupt; not capturable).

R code cannot handle `SIGTERM` signals, only `SIGINT`. If Slurm would signal `SIGINT` instead, we could capture it internally as an `interrupt` condition, and using `tryCatch(..., interrupt = ...)`, `on.exit()`, and likes to gracefully exit, e.g. close connections, checkpoint intermediate results, etc.

Slurm allows us to declare what type of signal, and when, to signal when we approach the run-time limit. This can be done by declaring, e.g. `--signal=B:INT@60`.

# Idea

First, should be able to control the signal explicitly via:

```r
plan(..., resources = list(signal = "INT@60"))
```

already today.

Second, we could update the default to be `signal = "INT@60"` by adding the following to the template:

```bash
## Resources needed
<%
## Default to sending SIGINT 60 seconds before walltime limit
## to allow graceful R-level cleanup/checkpointing
if (is.null(resources[["signal"]])) {
resources[["signal"]] <- "B:INT@60"
}
...
%>
```

Third, alternative to a Slurm-specific resource name, we might harmonize the signal type and signal grace period with what is used by other job schedulers.

Beitragsleitfaden

Beitragsleitfaden öffnen

Rechercherichtung

Finde das Slurm-Template und die Ressourcenverarbeitung hinter plan(..., resources = list(signal = ...)); prüfe zunächst, wie scheduler-spezifische Standardwerte und explizite Signalwerte derzeit weitergereicht werden. Die Aufgabe ist abgeschlossen, wenn der Slurm-Standardwert B:INT@60 verwendet und ein explizit angegebenes Signal weiterhin berücksichtigt wird und wenn relevante bestehende Tests aktualisiert oder hinzugefügt wurden, sofern das Projekt eine Testabdeckung für Templates hat.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
r
Bereich
distributed-systems, infrastructure
Issue-Typ
Feature
Schwierigkeit
3/5
Geschätzter Aufwand
1-2 Tage
Aktivitätsstatus
Ruhig
Klarheit
Größtenteils klar
Anfängerfreundlichkeit
66/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.