0

jupyter ダッシュボード サーバーのどの部分が機能しないのか理解できません。ダッシュボードサーバーが動いているようで、カーネルゲートウェイが動いていてカーネルが立ち上がるのですが、なぜか起動後にカーネルへのwebsocketトラフィックが404を返します。

カーネル ゲートウェイで curl リクエストを実行しようとしましたが、curl は「ws」プロトコルをサポートしていません。

これをさらにデバッグするにはどうすればよいですか? 以下のすべての詳細。

次の Apache 構成の VM (debian jessie) があります。

ProxyPreserveHost on
ProxyPass "/" "http://127.0.0.1:3000/"
ProxyPassReverse "/" "http://127.0.0.1:3000/"

応答しているダッシュボード サーバーがあります。

GET /dashboards/Environment_variables 200 39.408 ms - 2400
GET /css/style.css 200 1.688 ms - 186626
GET /components/require.js 200 3.943 ms - 86262
GET /components/dashboard.js 200 1.351 ms - 788654
GET /components/fonts/fontawesome-webfont.woff2?v=4.6.3 304 0.689 ms - -
GET /components/dashboard.js.map 304 0.621 ms - -
POST /api/kernels?1475506860562 201 923.933 ms - 62
GET /api/kernels/d7681c2f-b8f9-4b19-9893-6bd6022d0e77/channels?session_id=ad17021f13dd752eb2e687b4a78fee64 404 2.936 ms - 1021
GET /api/kernels/d7681c2f-b8f9-4b19-9893-6bd6022d0e77/channels?session_id=ad17021f13dd752eb2e687b4a78fee64 404 3.703 ms - 1021

最後に404とはいえ。

次に、カーネル ゲートウェイを実行します。

[KernelGatewayApp] The Jupyter Kernel Gateway is running at: http://127.0.0.1:8888
[KernelGatewayApp] Native kernel (python3) available from /opt/anaconda3/lib/python3.5/site-packages/ipykernel/resources
[KernelGatewayApp] Starting kernel: ['/opt/anaconda3/bin/python', '-m', 'ipykernel', '-f', '/home/sandman/.local/share/jupyter/runtime/kernel-d7681c2f-b8f9-4b19-9893-6bd6022d0e77.json']
[KernelGatewayApp] Connecting to: tcp://127.0.0.1:52565
[KernelGatewayApp] Kernel started: d7681c2f-b8f9-4b19-9893-6bd6022d0e77
[KernelGatewayApp] Kernel args: {'kernel_name': 'python3'}
[I 161003 16:01:01 web:1971] 201 POST /api/kernels (127.0.0.1) 917.05ms

カーネルのリクエストを見て、私が理解している限り、カーネルを起動します。

しかし、ブラウザはそれを認識しません:

Environment_variables   200 document    Other   1.2 KB  365 ms  
style.css   200 stylesheet  Environment_variables:7 29.2 KB 259 ms  
require.js  200 script  Environment_variables:64    21.0 KB 325 ms  
dashboard.js    200 script  Environment_variables:65    214 KB  989 ms  
fontawesome-webfont.woff2?v=4.6.3   304 font    Environment_variables:64    216 B   82 ms   
kernels?1475506860562   201 xhr index.js:178    395 B   1.01 s  
cursor.png  200 png middlemouse.js:53   (from cache)    2 ms    
channels?session_id=ad17021f13dd752eb2e687b4a78fee64    404 websocket   Other   0 B 82 ms   
channels?session_id=ad17021f13dd752eb2e687b4a78fee64    404 websocket   Other   0 B 82 ms   

ここに画像の説明を入力

また、カーネル ゲートウェイを http モードで起動しようとしましたが、エラーが発生しました。

$ jupyter kernelgateway --KernelGatewayApp.api=kernel_gateway.notebook_http --debug
Traceback (most recent call last):
  File "/opt/anaconda3/bin/jupyter-kernelgateway", line 11, in <module>
    sys.exit(launch_instance())
  File "/opt/anaconda3/lib/python3.5/site-packages/jupyter_core/application.py", line 267, in launch_instance
    return super(JupyterApp, cls).launch_instance(argv=argv, **kwargs)
  File "/opt/anaconda3/lib/python3.5/site-packages/traitlets/config/application.py", line 652, in launch_instance
    app.initialize(argv)
  File "/opt/anaconda3/lib/python3.5/site-packages/kernel_gateway/gatewayapp.py", line 298, in initialize
    self.init_configurables()
  File "/opt/anaconda3/lib/python3.5/site-packages/kernel_gateway/gatewayapp.py", line 352, in init_configurables
    self.personality = func(parent=self, log=self.log)
  File "/opt/anaconda3/lib/python3.5/site-packages/kernel_gateway/notebook_http/__init__.py", line 144, in create_personality
    return NotebookHTTPPersonality(*args, **kwargs)
  File "/opt/anaconda3/lib/python3.5/site-packages/kernel_gateway/notebook_http/__init__.py", line 25, in __init__
    self.api_parser = func(parent=self, log=self.log, kernelspec=self.parent.kernel_manager.seed_kernelspec, notebook_cells=self.parent.seed_notebook.cells)
AttributeError: 'NoneType' object has no attribute 'cells'
4

1 に答える 1

1

理解した。

    ProxyPreserveHost on

    ProxyPassMatch "/api/kernels/(.*)/channels" "ws://127.0.0.1:3000/api/kernels/$1/channels"
    ProxyPassReverse "/api/kernels" "ws://127.0.0.1:3000/api/kernels"

    ProxyPass "/" "http://127.0.0.1:3000/"
    ProxyPassReverse "/" "http://127.0.0.1:3000/"

ポイントは、最後の 2 行で Websocket トラフィックを http トラフィックに変換していたことです。もちろん、それはうまくいきませんでした。

追加された中間行は、websocket リクエストにパターンマッチし、それらを ws: プロトコルに渡します。

また、ProxyPass の "/" はすべてに一致し、Apache は一致するものが見つかるまでリストを調べるため、行の順序も重要です。したがって、「すべて一致」の行は最後にする必要があります。

于 2016-10-05T05:35:21.237 に答える