SGE template: Signal SIGINT by default to allow R to catch it gracefully
まだ誰も着手していません。
評価
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 初心者へのやさしさ
- 50/100
- issue の種類
- 機能追加
- 明瞭さ
- おおむね明確
- 活発さ
- 静か
- 技術スタック
- bash, r
調査の方向性
デフォルトの SGE テンプレートから始めて、rscript_call、uri、batchtools::doJobCollection がどのようにジョブを起動するかを追跡します。提案されている Bash の SIGUSR2 trap とプロセス待機のフローを確認し、そのうえで、迫っている時間制限が SIGINT として R に届き、終了前に適切なクリーンアップを行えることを検証します。
索引モデルが issue の本文から書いたものです。
説明
When a job is approaching it's maximum run-time limit, and --notify has been specified, SGE sends a SIGUSR2 60 seconds before sending a SIGKILL (abrupt; not capturable).
R code cannot handle SIGUSR2 signals, only SIGINT. If SGE 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.
Idea
Update the default SGE template to signal SIGINT. Unlike Slurm, there is no user-facing option to change the type of signal in SGE. But we could use Bash traps to capture the SIGUSR2 and re-signal it as SIGINT. Something like:
#! /bin/bash
...
## Request SGE to send warning signals (SIGUSR2) before run-time limit termination
#$ -notify
...
# Function to catch SGE run-time signals and re-signal as SIGINT
forward_sigint() {
echo "Caught SGE run-time signal. Re-signal as SIGINT to R..."
kill -2 "${R_PID}" 2>/dev/null || true
wait "${R_PID}"
res=$?
echo " - exit code (from signal handler): ${res}"
exit "${res}"
}
# Trap SGE run-time limit signals
trap forward_sigint SIGUSR2
<%= rscript_call %> -e 'batchtools::doJobCollection("<%= uri %>")' &
R_PID=$!
wait "${R_PID}"
res=$?
# Clear the trap on normal exit
trap - SIGUSR2
- 主要言語
- R
- スター
- 87
- フォーク
- 10
- PR マージ指標
- 30日以内にマージされた PR はありません
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
futureverse/future.batchtools のほかの issue
-
feature/resources scheduler/lsf
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
futureverse/future.batchtools#105 ·
-
feature/resources scheduler/slurm
難易度 3/5 1〜2日 初心者へのやさしさ 66/100
futureverse/future.batchtools#103 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 55/100
futureverse/future.batchtools#102 ·
-
難易度 4/5 3〜5日 初心者へのやさしさ 15/100
-
難易度 3/5 1〜2日 初心者へのやさしさ 35/100
futureverse/future.batchtools の issue をすべて見る
似ている issue
-
Affects Web App documentation PRIORITY LOW
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
-
難易度 1/5 1時間未満 初心者へのやさしさ 80/100
hubverse-org/hubCI#36 ·
-
難易度 1/5 1時間未満 初心者へのやさしさ 85/100
-
Release 1.4.0 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
pharmaverse/pharmaverseadam#170 ·