Should kernel restart interrupt running code?
まだ誰も着手していません。
評価
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 初心者へのやさしさ
- 35/100
調査の方向性
issue にある notebook-cell reproducer から始め、実行中に kernel を再起動する場合と、先に割り込みを行う場合を比較します。kernel の再起動とシャットダウンの動作を追跡し、実行中のインタープリターが SIGINT を受け取るべきかどうかを判断してから、想定されるクリーンアップパスが完了したときに atexit ハンドラーが一時ファイルを削除するかどうかを確認します。
索引モデルが issue の本文から書いたものです。
説明
I'm not sure if this is a bug or intended behavior. AFAICT, if a user restarts a kernel while the interpreter is actively processing, no SIGINT is sent to the interpreter process, and eventually the process is SIGKILL'd. This can lead to atexit handlers never running.
This is causing issues in dask, where we use atexit handlers to ensure remote resources are reclaimed.
Here's a reproducer. Paste this into a notebook cell, run, then restart the kernel before the cell finishes executing.
import atexit
import os
import time
with open("temp-file", "w") as f:
f.write("This file should be deleted by the exit handler")
@atexit.register
def exit_handler():
os.unlink("temp-file")
time.sleep(1000)
# Restart the kernel, `temp-file` should be deleted but isn't.
# If you interrupt, then restart, then `temp-file` is deleted
If you instead interrupt the kernel then restart it, everything is cleaned up properly. Is this intended behavior (and the issue is user workflow, rather than a possible bug)?
- 主要言語
- Python
- スター
- 734
- フォーク
- 411
- 平均マージ
- 1日 2時間
- マージ済み PR(30日)
- 9
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
ipython/ipykernel のほかの issue
-
難易度 1/5 1時間未満 初心者へのやさしさ 72/100
-
難易度 4/5 3〜5日 初心者へのやさしさ 48/100
-
難易度 4/5 3〜5日 初心者へのやさしさ 68/100
-
難易度 3/5 1〜2日 初心者へのやさしさ 66/100
ipython/ipykernel の issue をすべて見る
似ている issue
-
Add: hunch オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 74/100
AbdelStark/awesome-typesafe#104 ·
-
enhancement
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
DiamondLightSource/dodal#2211 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 88/100
openml/openml-python#1749 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 88/100
sipyourdrink-ltd/bernstein#6191 ·