Search code examples
google-dl-platform

How to start and stop jupyter notebook on dl VMs


I want to make changes to the VM environment (e.g. install a new conda package, or activate a new conda env) and then restart jupyter notebook - but I can't work out how to do that within the jupyter user of the Google Cloud DL Images. Is it possible?


Solution

  • If you want to run some code on a running DLVM and restart Jupyter, ssh to the machine from the compute section of the gcp web console. Then:

    sudo service jupyter restart
    

    If you want to do some steps automatically before Jupyter is started at the time you create the VM, create the DLVM using gcloud and specify a startup script as follows:

    STARTUP_SCRIPT="conda install something"
    gcloud compute instances create ${INSTANCE_NAME} \
          --machine-type=n1-standard-8 \
          --scopes=https://www.googleapis.com/auth/cloud-platform \
          --min-cpu-platform="Intel Skylake" \
          ${IMAGE} \
          --image-project=deeplearning-platform-release \
          --boot-disk-size=100GB \
          --boot-disk-type=pd-ssd \ 
          --accelerator=type=nvidia-tesla-p100,count=1 \
          --boot-disk-device-name=${INSTANCE_NAME} \
          --maintenance-policy=TERMINATE --restart-on-failure \
          --metadata="install-nvidia-driver=True,startup-script=${STARTUP_SCRIPT}"