Jupyter Lab Cron作业失败KeyError:用户

发布于 2025-02-05 13:58:42 字数 1619 浏览 2 评论 0原文

我正在使用Ancaconda的Jupyter Lab安排一些Jupyter笔记本。

我安装了jupyterlab_scheduler,当我尝试安排一个cronjob时,我会遇到“有错误提交作业”的错误。

我的cron语法是1 14 * * * *,该作业的命令是jupyter nbconvert - to Notebook -ececute c:/users/users/charl/conversion率sdr.ipynb

我的日志看起来像这样:

[E 2022-06-06 14:21:15.410 ServerApp] Uncaught exception POST /jupyterlab_scheduler/add?1654539675407 (::1)
HTTPServerRequest(protocol='http', host='localhost:8888', method='POST', uri='/jupyterlab_scheduler/add?1654539675407', version='HTTP/1.1', remote_ip='::1')
Traceback (most recent call last):
  File "c:\users\charl\anaconda3\lib\site-packages\tornado\web.py", line 1702, in _execute
    result = method(*self.path_args, **self.path_kwargs)
  File "c:\users\charl\anaconda3\lib\site-packages\tornado\web.py", line 3173, in wrapper
    return method(self, *args, **kwargs)
  File "c:\users\charl\anaconda3\lib\site-packages\jupyterlab_scheduler\handlers.py", line 114, in post
    with CronTab(user=os.environ["USER"]) as cron:
  File "c:\users\charl\anaconda3\lib\os.py", line 675, in __getitem__
    raise KeyError(key) from None
KeyError: 'USER'
[W 2022-06-06 14:21:15.412 ServerApp] Unhandled error
[E 2022-06-06 14:21:15.414 ServerApp] {
  "Host": "localhost:8888",
  "Accept": "*/*",
  "Referer": "http://localhost:8888/lab",
  "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/102.0.5005.63 Safari/537.36"
}
[E 2022-06-06 14:21:15.415 ServerApp] 500 POST /jupyterlab_scheduler/add?1654539675407 (::1) 
3.99ms referer=http://localhost:8888/lab

I'm using Jupyter Lab with ancaconda to schedule some Jupyter Notebooks.

I installed jupyterlab_scheduler and when I try to schedule a cronjob I get the error "There was an error submitting job".

My cron syntax is 1 14 * * * and the command for the job is jupyter nbconvert --to notebook --execute C:/Users/charl/conversion rates sdr.ipynb

My log looks like this :

[E 2022-06-06 14:21:15.410 ServerApp] Uncaught exception POST /jupyterlab_scheduler/add?1654539675407 (::1)
HTTPServerRequest(protocol='http', host='localhost:8888', method='POST', uri='/jupyterlab_scheduler/add?1654539675407', version='HTTP/1.1', remote_ip='::1')
Traceback (most recent call last):
  File "c:\users\charl\anaconda3\lib\site-packages\tornado\web.py", line 1702, in _execute
    result = method(*self.path_args, **self.path_kwargs)
  File "c:\users\charl\anaconda3\lib\site-packages\tornado\web.py", line 3173, in wrapper
    return method(self, *args, **kwargs)
  File "c:\users\charl\anaconda3\lib\site-packages\jupyterlab_scheduler\handlers.py", line 114, in post
    with CronTab(user=os.environ["USER"]) as cron:
  File "c:\users\charl\anaconda3\lib\os.py", line 675, in __getitem__
    raise KeyError(key) from None
KeyError: 'USER'
[W 2022-06-06 14:21:15.412 ServerApp] Unhandled error
[E 2022-06-06 14:21:15.414 ServerApp] {
  "Host": "localhost:8888",
  "Accept": "*/*",
  "Referer": "http://localhost:8888/lab",
  "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/102.0.5005.63 Safari/537.36"
}
[E 2022-06-06 14:21:15.415 ServerApp] 500 POST /jupyterlab_scheduler/add?1654539675407 (::1) 
3.99ms referer=http://localhost:8888/lab

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

千柳 2025-02-12 13:58:42

堆栈跟踪说,环境变量用户找不到。 用户如果使用Linux,则默认情况下定义,但如果您使用的是Windows。

看来该软件包是为Linux用户设计的。您可以通过定义用户环境变量手动

The stack trace is saying that the environment variable USER is not found. USER is defined by default if you are using Linux, but not if you are using Windows.

It appears that the package is designed for Linux users. You can get around this particular issue by defining the USER environment variable manually.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文