Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

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

オープン
#104 コメント 1 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
4/5
見積もり時間
3〜5日
初心者へのやさしさ
50/100
issue の種類
機能追加
明瞭さ
おおむね明確
活発さ
静か
技術スタック
bash, r

調査の方向性

デフォルトの SGE テンプレートから始めて、rscript_call、uri、batchtools::doJobCollection がどのようにジョブを起動するかを追跡します。提案されている Bash の SIGUSR2 trap とプロセス待機のフローを確認し、そのうえで、迫っている時間制限が SIGINT として R に届き、終了前に適切なクリーンアップを行えることを検証します。

索引モデルが issue の本文から書いたものです。

説明

feature/resources scheduler/sge

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 はありません

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

futureverse/future.batchtools のほかの issue

futureverse/future.batchtools の issue をすべて見る

似ている issue

R の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。