0

I have a notebook instance with a notebook file. I use the instance's startup script to run this notebook file using papermill. I want the notebook file to be run only when I remotely start the instance, and not from google cloud console.

I'd like to know if one of these is possible, or if there's another solution:

1 - The script will detect that the instance was started from the dashboard.

2 - I will remove the startups script and use another script that can be run by a remote command.

3 - The shutdown script will remove the startup script.

Rony Tesler
  • 1,207
  • 15
  • 25
  • 1
    can you please rewrite this: "I have a notebook instance that I run using papermill in the instance's startup script. The problem is that when I run the instance manually from the dashboard" is not very clear what you mean. Thanks! – gogasca Dec 14 '20 at 22:29
  • 1
    Hope it's better now. – Rony Tesler Dec 14 '20 at 22:39
  • 1
    Thanks, in addtion to my answer, take a look at this script: https://github.com/GoogleCloudPlatform/ml-on-gcp/blob/master/dlvm/tools/scripts/notebook_executor.sh, you can modify it to run your notebook and delete the instance when is done. – gogasca Dec 15 '20 at 17:41

2 Answers2

1

Script definition is kept under /var/run/google.startup.script for the scenarios mentioned:

  1. Seems complicated detect if the instance was started from the dashboard.
  2. Is feasible to delete the startup script mentioned earlier, and run your own script remotely.
  3. Delete the script.

Before to delete the scrip I suggest you to make a backup of it in case of any issue arises for delete it, also keep in mind that AI Platform Notebooks is a managed service, any admin configuration could cause potential issues in your instance, be careful when deleting or modifying the startup script.

Enrique Zetina
  • 825
  • 5
  • 16
  • Thanks. Any idea how to run a script (that is not the startup script) remotely? If possible, without having to connect with ssh. about 3 - Is it possible that the startup script will do it? – Rony Tesler Dec 08 '20 at 01:31
  • Not to be honest, please share more insights about your use case to have a clear idea why is not feasible to use ssh. – Enrique Zetina Dec 09 '20 at 00:57
0

My advise will be actually run a notebook via a Scheduler system, I posted here the multiple options: GCP run a prediction of a model every day

gogasca
  • 9,283
  • 6
  • 80
  • 125
  • I don't want to schedule it, I want it on demand. What would be the best option? maybe Kubeflow Fairing? (has outdated documentation and I have no idea how to use..) – Rony Tesler Dec 15 '20 at 20:41
  • 1
    We will launch the Notebook Executor by early next year for EAP that will allow you to run a notebook on demand or schedule, the options above are also on demand I would suggest you to try some of them – gogasca Dec 16 '20 at 02:48