sagemathinc / cocalc

CoCalc: Collaborative Calculation in the Cloud
https://CoCalc.com
Other
1.17k stars 216 forks source link

jupyterlab and jupyter classic servers: make it easy to customize command line parameters #6585

Open williamstein opened 1 year ago

williamstein commented 1 year ago

There are some non-obvious flags you need to also pass to jupyter notebook to run it from cocalc. The easiest way to figure these out is just to run Jupyter classic server in a newly started project, and use ps -ax |grep jupyter-notebook in a terminal to see how it was run.

 ~$ ps -ax |grep jupyter-notebook
    710 ?        S      0:03 /usr/bin/python3 /usr/local/bin/jupyter-notebook --port-retries=0 --no-browser --NotebookApp.iopub_data_rate_limit=2000000 --NotebookApp.iopub_msg_rate_limit=50 --NotebookApp.token= --NotebookApp.password= --NotebookApp.allow_remote_access=True --NotebookApp.mathjax_url=/cdn/mathjax/MathJax.js --NotebookApp.base_url=/10f0e544-313c-4efe-8718-2142ac97ad11/port/jupyter --ip=192.168.138.223 --port=6003

Kill that process, then run it yourself with a different rate limit. Note that you have to do the above in your project -- what I showed above was in mine, and the base_url and ip will be different for you.

Havin to do all of the above just to run the jupyter notebook server with a different parameter for iopub_msg_rate_limit (say) is annoying. Instead those options should all be customizable right on the "Servers" page from where the notebook server gets launched.

williamstein commented 1 year ago

A better workaround is to just run this in a terminal:

PORT=7000

echo "https://cocalc.com/$COCALC_PROJECT_ID/port/$PORT"

jupyter-notebook --port-retries=0 --no-browser --NotebookApp.iopub_data_rate_limit=1.0e10 --NotebookApp.iopub_msg_rate_limit=50 --NotebookApp.token= --NotebookApp.password= --NotebookApp.allow_remote_access=True --NotebookApp.mathjax_url=/cdn/mathjax/MathJax.js --NotebookApp.base_url=/$COCALC_PROJECT_ID/port/$PORT --ip=0.0.0.0 --port=$PORT

Visit the URL that echo outputs, e.g.,

https://cocalc.com/[your project_id]/port/7000

instead of anything that jupyter outputs in its log.