Search code examples
jupyter-notebookgoogle-compute-enginejupytergoogle-cloud-datalab

Where do files created from inside Jupyter notebooks (Google Cloud Datalab) reside?


Running this code cell

%%bash
touch /var/tmp/hello_world
ls -l /var/tmp/hello_world

inside a Google Cloud Datalab (i.e. Jupyter) notebook leaves me wondering: where does the file actually reside.

  • It is not stored as /var/tmp/hello_world locally where I run the browser.
  • It is apparently not stored as /var/tmp/hello_world on the VM instance that hosts my instance of Datalab (i.e. Jupyter). I double-checked with ssh.
  • It is apparently not stored inside the notebook's .ipynb file. (That file is apparently stored in /mnt/disks/datalab-pd/content/ on the cited VM instance.)

So where does the file actually reside?


Solution

  • This is a location within the Datalab container running on the Datalab VM. Hope that helps.

    Anything you want to hold on to should probably be written to /content which is mapped to the PD mounted on the host VM (a data disk, separate from the boot disk). For example notebooks.

    For actual data, the PD might not be a great location, esp. if its large. For that, you should look to GCS.