繁体   English   中英

从 azure 应用服务中的 juypter notebook kernel 获取日志

[英]Get logs from juypter notebook kernel in azure app service

我是 juypter 笔记本的新手,但我相信这更多的是 web 应用程序部署的问题。

主要问题 - 如何查看 kernel 连接到 juypter 笔记本的日志?

主要问题 - 我遇到了 juyper 笔记本连接问题,我想获取日志以了解原因。 它不是龙卷风问题,因为我使用的是 4.5.3。

详细信息 - 我得知一所大学正在使用旧的 juypter 笔记本,该笔记本具有用 python 2.7 (UGH) 编写的 ML 模型。 No one who created the code is around to change it to python 3. Everything was fine until there computer upgraded from windows 7 to windows 10. WHen that happened, the python upgraded from 2 to 3 and that caused the juypter notebook to not work. 我决定尝试使用我的 windows 10 笔记本电脑和 python 2.7 测试让数据模型应用程序再次工作。 我让它工作了,所以我决定尝试将应用程序容器化并将应用程序推送到 azure。 我让容器工作,并且能够将应用程序部署到 azure,但是当我在 azure 中运行笔记本时,尝试连接到 kernel 时出现问题。 这就是为什么我想找到日志以便我可以看到它无法连接的原因。

这是我用来将我的应用程序部署到 azure 的 ​​dockerfile:

FROM python:2.7.18
LABEL name="model"


COPY ./requirements.txt /app/requirements.txt

WORKDIR /app

RUN apt-get update \
  && pip install --upgrade pip  \
  && pip install -r requirements.txt \
  && rm -rf /var/cache/apk/*

COPY "/" /app



CMD ["python", "-m", "notebook", "--port=80", "--ip=0.0.0.0", "--allow-root", "--no-browser", "--NotebookApp.token=''"]

这是我在部署到 azure 时使用的需求文件。

attrs==21.4.0
backports-abc==0.5
backports.functools-lru-cache==1.6.4
backports.shutil-get-terminal-size==1.0.0
bleach==3.3.1
certifi==2021.10.8
colorama==0.4.5
configparser==4.0.2
contextlib2==0.6.0.post1
cycler==0.10.0
decorator==4.4.2
defusedxml==0.7.1
entrypoints==0.3
enum34==1.1.10
functools32==3.2.3.post2
futures==3.3.0
importlib-metadata==2.1.3
ipykernel==4.10.1
ipython==5.10.0
ipython-genutils==0.2.0
Jinja2==2.11.3
jsonschema==3.2.0
jupyter-client==5.3.5
jupyter-core==4.6.3
kiwisolver==1.1.0
MarkupSafe==1.1.1
matplotlib==2.2.5
mistune==0.8.4
nbconvert==5.6.1
nbformat==4.4.0
notebook==5.2.0
numpy==1.16.6
packaging==20.9
pandas==0.24.2
pandocfilters==1.5.0
pathlib2==2.3.7.post1
pickleshare==0.7.5
prompt-toolkit==1.0.18
Pygments==2.5.2
pyparsing==2.4.7
pyrsistent==0.16.1
python-dateutil==2.8.2
pytz==2022.1
pyzmq==19.0.2
scandir==1.10.0
scikit-learn==0.20.4
scipy==1.2.3
seaborn==0.9.1
simplegeneric==0.8.1
singledispatch==3.7.0
six==1.16.0
testpath==0.4.4
tornado==4.5.3
traitlets==4.3.3
treeinterpreter==0.2.3
typing==3.10.0.0
wcwidth==0.2.5
webencodings==0.5.1
win-unicode-console==0.5
zipp==1.2.0

这同样适用于 docker 容器,但不适用于网站

在此处输入图像描述

我找到了我的主要问题的答案。 您想在运行笔记本时添加此标志:“--log-level=DEBUG”

I put that into my dockerfile and then redeployed my app to azure and I was able to see way more output in the logs streams related to the kernel. 由于一切正常,我认为这是一个端口问题,因为 App 服务只能公开 1 个端口。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM