Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

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

Đang mở
#104 1 bình luận 0 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

Đánh giá

Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức phù hợp với người mới
50/100
Loại issue
Tính năng
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Ít trao đổi
Công nghệ
bash, r
Lĩnh vực
distributed-systems

Hướng nghiên cứu

Bắt đầu với template SGE mặc định và theo dõi cách rscript_call, uri và batchtools::doJobCollection khởi chạy job. Xem xét trap Bash SIGUSR2 được đề xuất và luồng chờ tiến trình, sau đó xác minh rằng giới hạn thời gian sắp đến được truyền tới R dưới dạng SIGINT và cho phép dọn dẹp đúng cách trước khi tiến trình kết thúc.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

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
Ngôn ngữ chính
R
Star
87
Fork
10
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của futureverse/future.batchtools

Tất cả issue của futureverse/future.batchtools

Issue tương tự

Thêm issue về R

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.