簡體   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