Desired behaviour
We have an existing workflow in vanilla Jupyter Notebook/Lab where we use relative paths to store outputs of some notebooks. Example:
/home/user/notebooks/notebook1.ipynb
/home/user/notebooks/notebook1_output.log
/home/user/notebooks/project1/project.ipynb
/home/user/notebooks/project1/project_output.log
In both notebooks, we produce the output by simply writing to ./output.log
or so.
Problem
However, we are now trying Google Dataproc with Jupyter optional component, and the current directory is always /
regardless of which notebook it's run from. This applies for both the notebook and Lab interfaces.
What I've tried
Disabling c.FileContentsManager.root_dir='/'
in /etc/jupyter/jupyter_notebook_config.py
causes the current directory to be set to wherever I started jupyter notebook
from, but it is always that initial starting folder instead of following the .ipynb notebook files.
Any idea on how to restore the "dynamic" current directory behaviour?
Even if it's not possible, I'd like to understand how Dataproc even makes Jupyter behave differently.
Details
- Dataproc Image
2.0-debian10
- Notebook Server
6.2.0
- Jupyterlab
3.0.18