python - 如何让jupyter中的子进程保持活动状态
问题描述
我有一个 jupyter 笔记本,它正在使用 Google Earth Engine 进行地理空间分析,然后使用%run命令调用脚本。在该脚本中,从 GEE 发送要下载的任务后,我有一个子进程,每 60 秒检查一次任务是否完成(开始与 GDrive 的连接,然后下载图像)。我想知道的是为什么 - 在我关闭 jupyter notebook 之后 - 并且导出进程的 PID 仍在运行,似乎进程已经结束,没有完成可能需要几个小时的“while 循环”。
def export_images(tasks_file_name, out_path):
process = subprocess.Popen(['python3', '/home/download.py',
tasks_file_name,
out_path
],
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
universal_newlines=True)
return process
解决方案
推荐阅读
- c - %d%d 和 %d %d 之间的差异
- ubuntu - Ubuntu Pam_mount (mount.c:76): /bin/sh: 1: <.....> 未找到
- r - 如何提取参数模型不可用?
- excel - 运行代码 3 次后,我的 excel 崩溃了
- php - Laravel PUT 关系
- visual-studio-code - 更改文件名大小写后的VSCode emmet问题
- next.js - 使用 Next.js SSR 放大 CDK
- javascript - 当值相同时,Javascript按值和键对对象进行排序
- c++ - 使用 std::function 保证没有动态内存的最小语法
- javascript - Javascript计算器如何允许多个点