Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Do slides auto-reload when doing mercury runserver 0.0.0.0:5006 --runworker? #464

Open
Kanishk-Kumar opened this issue Sep 3, 2024 · 2 comments

Comments

@Kanishk-Kumar
Copy link

I've created an xyz.ipynb file with just markdown slides. To get any changes in UI, I'm required to run:

mercury delete xyz.ipynb
mercury add xyz.ipynb

Only then the changes are seen in UI. Is this expected behavior? Is there a way for it to auto reload when it sees changes in the added notebook (when running server)?

@pplonski
Copy link
Contributor

pplonski commented Sep 3, 2024

Mercury auto reloads notebooks when running in development server at 127.0.0.1

@Kanishk-Kumar
Copy link
Author

Kanishk-Kumar commented Sep 3, 2024

@pplonski How do I run it in development server (not at 127.0.0.1)? Here's my service file:

[Unit]
Description=Mercury
After=network.target

[Service]
Type=simple
PIDFile=/run/mercury.pid
WorkingDirectory=/media/nvme/ssd8tb/jupyter/notebooks/Slides
ExecStart=/bin/bash -c 'source /media/nvme/ssd8tb/jupyter/venv_mercury/bin/activate && cd /media/nvme/ssd8tb/jupyter/notebooks/Slides && mercury runserver 0.0.0.0:5006 --runworker --verbose'
Restart=on-failure
RestartSec=10
Environment="ALLOWED_HOSTS=mercury.xyz.com"
Environment="NOTEBOOKS_PATH=/media/nvme/ssd8tb/jupyter/notebooks/Slides"
Environment="WELCOME=/media/nvme/ssd8tb/jupyter/notebooks/Slides/welcome.md"
# Environment="MERCURY_DISABLE_AUTO_RELOAD=YES"
User=user_name
Group=user_name

[Install]
WantedBy=multi-user.target

Logs using sudo journalctl -xeu mercury.service -f

Sep 03 10:46:08 system_name bash[486356]: DJ INFO 2024-09-03 05:16:08,870 server HTTP/2 support not enabled (install the http2 and tls Twisted extras)
Sep 03 10:46:08 system_name bash[486356]: WS_TASK 2024-09-03 05:16:08,870 HTTP/2 support not enabled (install the http2 and tls Twisted extras)
Sep 03 10:46:08 system_name bash[486356]: DJ INFO 2024-09-03 05:16:08,870 server Configuring endpoint tcp:port=5006:interface=0.0.0.0
Sep 03 10:46:08 system_name bash[486356]: WS_TASK 2024-09-03 05:16:08,870 Configuring endpoint tcp:port=5006:interface=0.0.0.0
Sep 03 10:46:08 system_name bash[486356]: DJ INFO 2024-09-03 05:16:08,870 server Listening on TCP address 0.0.0.0:5006
Sep 03 10:46:08 system_name bash[486356]: WS_TASK 2024-09-03 05:16:08,870 Listening on TCP address 0.0.0.0:5006
Sep 03 10:46:09 system_name bash[486484]: [2024-09-03 05:16:09,662: DEBUG/MainProcess] | Worker: Preparing bootsteps.
Sep 03 10:46:09 system_name bash[486484]: [2024-09-03 05:16:09,664: DEBUG/MainProcess] | Worker: Building graph...
Sep 03 10:46:09 system_name bash[486484]: [2024-09-03 05:16:09,664: DEBUG/MainProcess] | Worker: New boot order: {Beat, Timer, Hub, Pool, Autoscaler, StateDB, Consumer}
Sep 03 10:46:09 system_name bash[486484]: [2024-09-03 05:16:09,784: DEBUG/MainProcess] | Consumer: Preparing bootsteps.
Sep 03 10:46:09 system_name bash[486484]: [2024-09-03 05:16:09,784: DEBUG/MainProcess] | Consumer: Building graph...
Sep 03 10:46:09 system_name bash[486484]: [2024-09-03 05:16:09,793: DEBUG/MainProcess] | Consumer: New boot order: {Connection, Agent, Events, Mingle, Tasks, Control, Gossip, Heart, event loop}
Sep 03 10:46:09 system_name bash[486484]:
Sep 03 10:46:09 system_name bash[486484]:  -------------- celery@system_name v5.4.0 (opalescent)
Sep 03 10:46:09 system_name bash[486484]: --- ***** -----
Sep 03 10:46:09 system_name bash[486484]: -- ******* ---- Linux-6.8.0-40-generic-x86_64-with-glibc2.35 2024-09-03 05:16:09
Sep 03 10:46:09 system_name bash[486484]: - *** --- * ---
Sep 03 10:46:09 system_name bash[486484]: - ** ---------- [config]
Sep 03 10:46:09 system_name bash[486484]: - ** ---------- .> app:         server:0x765461d00760
Sep 03 10:46:09 system_name bash[486484]: - ** ---------- .> transport:   sqla+sqlite:////media/nvme/ssd8tb/jupyter/venv_mercury/lib/python3.10/site-packages/mercury/celery.sqlite
Sep 03 10:46:09 system_name bash[486484]: - ** ---------- .> results:     sqlite:////media/nvme/ssd8tb/jupyter/venv_mercury/lib/python3.10/site-packages/mercury/celery.sqlite
Sep 03 10:46:09 system_name bash[486484]: - *** --- * --- .> concurrency: 1 (gevent)
Sep 03 10:46:09 system_name bash[486484]: -- ******* ---- .> task events: ON
Sep 03 10:46:09 system_name bash[486484]: --- ***** -----
Sep 03 10:46:09 system_name bash[486484]:  -------------- [queues]
Sep 03 10:46:09 system_name bash[486484]:                 .> celery           exchange=celery(direct) key=celery
Sep 03 10:46:09 system_name bash[486484]:                 .> ws               exchange=ws(direct) key=ws
Sep 03 10:46:09 system_name bash[486484]: [tasks]
Sep 03 10:46:09 system_name bash[486484]:   . apps.accounts.tasks.task_init_site
Sep 03 10:46:09 system_name bash[486484]:   . apps.accounts.tasks.task_send_invitation
Sep 03 10:46:09 system_name bash[486484]:   . apps.accounts.tasks.task_send_new_member
Sep 03 10:46:09 system_name bash[486484]:   . apps.notebooks.tasks.task_watch
Sep 03 10:46:09 system_name bash[486484]:   . apps.tasks.tasks.task_execute
Sep 03 10:46:09 system_name bash[486484]:   . apps.tasks.tasks_export.export_to_pdf
Sep 03 10:46:09 system_name bash[486484]:   . apps.ws.tasks.task_start_websocket_worker
Sep 03 10:46:09 system_name bash[486484]:   . celery.accumulate
Sep 03 10:46:09 system_name bash[486484]:   . celery.backend_cleanup
Sep 03 10:46:09 system_name bash[486484]:   . celery.chain
Sep 03 10:46:09 system_name bash[486484]:   . celery.chord
Sep 03 10:46:09 system_name bash[486484]:   . celery.chord_unlock
Sep 03 10:46:09 system_name bash[486484]:   . celery.chunks
Sep 03 10:46:09 system_name bash[486484]:   . celery.group
Sep 03 10:46:09 system_name bash[486484]:   . celery.map
Sep 03 10:46:09 system_name bash[486484]:   . celery.starmap
Sep 03 10:46:09 system_name bash[486484]:   . mercury.server.celery.execute_notebook
Sep 03 10:46:09 system_name bash[486484]:   . mercury.server.celery.scale_down_task
Sep 03 10:46:09 system_name bash[486484]:   . server.celery.execute_notebook
Sep 03 10:46:09 system_name bash[486484]:   . server.celery.scale_down_task
Sep 03 10:46:09 system_name bash[486484]: [2024-09-03 05:16:09,813: DEBUG/MainProcess] | Worker: Starting Pool
Sep 03 10:46:09 system_name bash[486484]: [2024-09-03 05:16:09,813: DEBUG/MainProcess] ^-- substep ok
Sep 03 10:46:09 system_name bash[486484]: [2024-09-03 05:16:09,813: DEBUG/MainProcess] | Worker: Starting Consumer
Sep 03 10:46:09 system_name bash[486484]: [2024-09-03 05:16:09,813: DEBUG/MainProcess] | Consumer: Starting Connection
Sep 03 10:46:09 system_name bash[486484]: [2024-09-03 05:16:09,815: WARNING/MainProcess] /media/nvme/ssd8tb/jupyter/venv_mercury/lib/python3.10/site-packages/celery/worker/consumer/consumer.py:508: CPendingDeprecationWarning: The broker_connection_retry configuration setting will no longer determine
Sep 03 10:46:09 system_name bash[486484]: whether broker connection retries are made during startup in Celery 6.0 and above.
Sep 03 10:46:09 system_name bash[486484]: If you wish to retain the existing behavior for retrying connections on startup,
Sep 03 10:46:09 system_name bash[486484]: you should set broker_connection_retry_on_startup to True.
Sep 03 10:46:09 system_name bash[486484]:   warnings.warn(
Sep 03 10:46:09 system_name bash[486484]: [2024-09-03 05:16:09,838: INFO/MainProcess] Connected to sqla+sqlite:////media/nvme/ssd8tb/jupyter/venv_mercury/lib/python3.10/site-packages/mercury/celery.sqlite
Sep 03 10:46:09 system_name bash[486484]: [2024-09-03 05:16:09,838: DEBUG/MainProcess] ^-- substep ok
Sep 03 10:46:09 system_name bash[486484]: [2024-09-03 05:16:09,838: DEBUG/MainProcess] | Consumer: Starting Events
Sep 03 10:46:09 system_name bash[486484]: [2024-09-03 05:16:09,839: WARNING/MainProcess] /media/nvme/ssd8tb/jupyter/venv_mercury/lib/python3.10/site-packages/celery/worker/consumer/consumer.py:508: CPendingDeprecationWarning: The broker_connection_retry configuration setting will no longer determine
Sep 03 10:46:09 system_name bash[486484]: whether broker connection retries are made during startup in Celery 6.0 and above.
Sep 03 10:46:09 system_name bash[486484]: If you wish to retain the existing behavior for retrying connections on startup,
Sep 03 10:46:09 system_name bash[486484]: you should set broker_connection_retry_on_startup to True.
Sep 03 10:46:09 system_name bash[486484]:   warnings.warn(
Sep 03 10:46:09 system_name bash[486484]: [2024-09-03 05:16:09,839: DEBUG/MainProcess] ^-- substep ok
Sep 03 10:46:09 system_name bash[486484]: [2024-09-03 05:16:09,839: DEBUG/MainProcess] | Consumer: Starting Tasks
Sep 03 10:46:09 system_name bash[486484]: [2024-09-03 05:16:09,846: DEBUG/MainProcess] ^-- substep ok
Sep 03 10:46:09 system_name bash[486484]: [2024-09-03 05:16:09,846: DEBUG/MainProcess] | Consumer: Starting Heart
Sep 03 10:46:09 system_name bash[486484]: [2024-09-03 05:16:09,846: DEBUG/MainProcess] ^-- substep ok
Sep 03 10:46:09 system_name bash[486484]: [2024-09-03 05:16:09,846: DEBUG/MainProcess] | Consumer: Starting event loop
Sep 03 10:46:09 system_name bash[486484]: [2024-09-03 05:16:09,847: INFO/MainProcess] celery@system_name ready.
Sep 03 10:46:09 system_name bash[486484]: [2024-09-03 05:16:09,847: DEBUG/MainProcess] basic.qos: prefetch_count->4
Sep 03 11:12:14 system_name bash[486356]: DJ INFO 2024-09-03 05:42:14,378 runserver HTTP GET / 200 [0.05, ip_address:xx360]
Sep 03 11:12:14 system_name bash[486356]: DJ INFO 2024-09-03 05:42:14,473 runserver HTTP GET /static/jupyter-syntax.css 200 [0.02, ip_address:xx372]
Sep 03 11:12:14 system_name bash[486356]: DJ INFO 2024-09-03 05:42:14,474 runserver HTTP GET /static/jupyter-additional.css 200 [0.02, ip_address:xx376]
Sep 03 11:12:14 system_name bash[486356]: DJ INFO 2024-09-03 05:42:14,550 runserver HTTP GET /static/jupyter-theme-light.css 200 [0.02, ip_address:xx382]
Sep 03 11:12:14 system_name bash[486356]: DJ INFO 2024-09-03 05:42:14,556 runserver HTTP GET /static/css/main.9848f1b3.chunk.css 200 [0.01, ip_address:xx386]
Sep 03 11:12:14 system_name bash[486356]: DJ INFO 2024-09-03 05:42:14,564 runserver HTTP GET /static/css/2.c6cf5ff9.chunk.css 200 [0.01, ip_address:xx396]
Sep 03 11:12:14 system_name bash[486356]: DJ INFO 2024-09-03 05:42:14,570 runserver HTTP GET /static/js/main.64038dbd.chunk.js 200 [0.01, ip_address:xx408]
Sep 03 11:12:14 system_name bash[486356]: DJ INFO 2024-09-03 05:42:14,576 runserver HTTP GET /static/js/2.d0e5359c.chunk.js 200 [0.01, ip_address:xx418]
Sep 03 11:12:15 system_name bash[486356]: DJ INFO 2024-09-03 05:42:15,123 runserver HTTP GET /static/favicon.ico 200 [0.02, ip_address:xx424]
Sep 03 11:12:15 system_name bash[486356]: DJ INFO 2024-09-03 05:42:15,136 runserver HTTP GET /api/v1/get-site/single-site/ 200 [0.03, ip_address:xx422]
Sep 03 11:12:15 system_name bash[486356]: DJ INFO 2024-09-03 05:42:15,216 runserver HTTP GET /static/mercury_logo.svg 200 [0.01, ip_address:xx460]
Sep 03 11:12:15 system_name bash[486356]: DJ INFO 2024-09-03 05:42:15,219 runserver HTTP GET /static/media/fontawesome-webfont.20fd1704.woff2 200 [0.02, ip_address:xx474]
Sep 03 11:12:15 system_name bash[486356]: DJ INFO 2024-09-03 05:42:15,252 runserver HTTP GET /api/v1/1/notebooks/ 200 [0.06, ip_address:xx426]
Sep 03 11:12:15 system_name bash[486356]: DJ INFO 2024-09-03 05:42:15,253 runserver HTTP GET /api/v1/get-site/single-site/ 200 [0.06, ip_address:xx438]
Sep 03 11:12:15 system_name bash[486356]: DJ INFO 2024-09-03 05:42:15,255 runserver HTTP GET /api/v1/1/welcome/ 200 [0.06, ip_address:xx454]
Sep 03 11:12:15 system_name bash[486356]: DJ INFO 2024-09-03 05:42:15,330 runserver HTTP GET /media/client_1.html 200 [0.02, ip_address:xx490]
Sep 03 11:12:27 system_name bash[486356]: DJ INFO 2024-09-03 05:42:27,854 runserver HTTP GET / 200 [0.01, ip_address:xx876]
Sep 03 11:12:28 system_name bash[486356]: DJ INFO 2024-09-03 05:42:28,038 runserver HTTP GET /api/v1/get-site/single-site/ 200 [0.01, ip_address:xx886]
Sep 03 11:12:28 system_name bash[486356]: DJ INFO 2024-09-03 05:42:28,139 runserver HTTP GET /api/v1/1/notebooks/ 200 [0.04, ip_address:xx908]
Sep 03 11:12:28 system_name bash[486356]: DJ INFO 2024-09-03 05:42:28,141 runserver HTTP GET /api/v1/get-site/single-site/ 200 [0.05, ip_address:xx894]
Sep 03 11:12:28 system_name bash[486356]: DJ INFO 2024-09-03 05:42:28,145 runserver HTTP GET /api/v1/1/welcome/ 200 [0.04, ip_address:xx922]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants