Get notifications and stop your instance automatically

Your Nightingale OS instance comes with a built-in module called ngsci that lets you manage the currently running instance.

If you have a series of intensive calculations running in your notebook, or from a script, you want to be able to walk away and know that your instance will stop when it reaches the end. You can reach for the following methods:

  • ngsci.notify()
  • ngsci.stop_instance()
  • ngsci.notify_and_stop_instance()

You can read all about the ngsci module by invoking ngsci? in a notebook.

Notify

Sends you an SMS text message.

import os 
import ngsci

instance = os.getenv("NG_INSTANCE_ID")
ngsci.notify(f"Hello from {instance}!")

Stop instance

Stops the instance that calls it.

import ngsci

ngsci.stop_instance()

The instance that you're running your notebook in will stop in a few moments. Your Jupyter browser tab won't automatically close. Just like when you stop a local Jupyter server from the command line, your Nightingale OS notebook will become unresponsive when your instance stops.

Notify and stop instance

Sends you an SMS text message and stops the instance that calls it.

import ngsci

msg = "This concludes our introduction to notifications"
ngsci.notify_and_stop_instance(msg)

Did this answer your question? Thanks for the feedback There was a problem submitting your feedback. Please try again later.