python - 从所述笔记本中关闭一个 jupyter 笔记本
问题描述
我在服务器上运行的 jupyter 笔记本中工作。我经常让我的繁重代码在一夜之间运行。我想在我的代码完成后释放服务器内存,以便其他人可以在早上工作。我正在考虑放置一些代码来释放内存/在最后一块中关闭笔记本。
我将如何实现这一目标?您是否看到另一个更相关的行动方案?
解决方案
在github 讨论中提出了以下解决方案:
%%javascript
require(
["base/js/dialog"],
function(dialog) {
dialog.modal({
title: 'Notebook Halted',
body: 'This notebook is no longer running; the kernel has been halted. Close the browser tab, or, to continue working, restart the kernel.',
buttons: {
'Kernel restart': { click: function(){ Jupyter.notebook.session.restart(); } }
}
});
}
);
Jupyter.notebook.session.delete();
推荐阅读
- php - Woocommerce 5.4.1 - 显示不带小数的价格
- python - 通过将字符串连接到数据框列上的数学运算结果来下标列
- testing - Salesforce 中 Apex 触发器测试的必填字段缺失错误
- mediawiki - 将 Google 字体添加到 MediaWiki 皮肤
- php - woocommerce_add_to_cart_validation Ajax 中的错误
- vue.js - Vue3:当值满足特定条件时如何防止进一步输入
- python - 尝试按其字段对 JSON 进行排序会引发 TypeError
- javascript - 为什么为我的 webpack 输出使用 .cjs 扩展名会抑制源映射的生成?
- javascript - 如何调用从 API 到 HTML 的 JSON 输出?
- javascript - discord.js 如何使从数组发送文本的 forEach 等待用户的回答(awaitmessages)?