Use the Cloud Console to schedule a managed notebooks run

This page shows you how to use the executor to run a Python notebook file on an hourly schedule by using the Google Cloud Console.

Before you begin

  1. Sign in to your Google Cloud account. If you're new to Google Cloud, create an account to evaluate how our products perform in real-world scenarios. New customers also get $300 in free credits to run, test, and deploy workloads.
  2. In the Google Cloud Console, on the project selector page, select or create a Google Cloud project.

    Go to project selector

  3. Make sure that billing is enabled for your Cloud project. Learn how to confirm that billing is enabled for your project.

  4. Enable the Notebooks and Vertex AI APIs.

    Enable the APIs

  5. In the Google Cloud Console, on the project selector page, select or create a Google Cloud project.

    Go to project selector

  6. Make sure that billing is enabled for your Cloud project. Learn how to confirm that billing is enabled for your project.

  7. Enable the Notebooks and Vertex AI APIs.

    Enable the APIs

Create a managed notebooks instance and example notebook file

  1. Create a managed notebooks instance.

  2. Open JupyterLab.

  3. Open a new notebook file.

  4. In the first cell of the notebook file, type the following:

    # Import datetime
    import datetime
    
    # Get the time and print it
    datetime.datetime.now()
    print(datetime.datetime.now())
    
  5. To make sure your notebook file is saved, select File > Save Notebook.

Schedule a run

  1. In the Cloud Console, go to the Managed notebooks page.

    Go to Managed notebooks

  2. Next to the managed notebooks instance that you want to use, click Open JupyterLab.

    Your managed notebooks instance opens JupyterLab.

  3. In the  File Browser, double-click the example notebook file to open it.

  4. Click the  Executor button.

  5. In the Submit notebooks to Executor dialog, in the Cloud Storage bucket field, type a name for your bucket, and then click Create and select. The executor stores your notebook output in this Cloud Storage bucket.

  6. In the Type field, select Schedule-based recurring executions.

    By default, the executor runs your notebook file every hour at the 00 minute of the hour.

  7. Click Submit.

    Your notebook file runs automatically on the schedule that you set.

When you finish this tutorial, you can avoid continued billing by deleting the resources you created. For more information, see Clean up.

View, share, and import an executed notebook file

By using your managed notebooks instance's JupyterLab interface, you can view your notebook output, share the results with others, and import the executed notebook file into JupyterLab.

View the execution results

  1. In JupyterLab's navigation menu, click the  Notebook Executor button.

  2. Click the Executions tab.

  3. Under the execution that you want to view, click View result.

    Executor opens your result in a new browser tab.

Share the execution results

  1. In your managed notebooks instance's JupyterLab user interface, in the navigation menu, click the  Notebook Executor button.

  2. Click the Executions tab.

  3. Next to the execution that you want to share, click the  options menu, and select Share execution result.

  4. Follow the directions in the dialog to grant users access to the execution result.

Import the executed notebook into JupyterLab

  1. In your managed notebooks instance's JupyterLab user interface, in the navigation menu, click the  Notebook Executor button.

  2. Click the Executions tab.

  3. Next to the execution that you want to import, click the  options menu, and select Import executed notebook.

  4. Select the kernel that you want to open the notebook.

    Executor opens the executed notebook file in JupyterLab and stores this notebook file in the JupyterLab File Browser in a folder named imported_notebook_jobs.

View or delete a schedule

You can view and delete schedules by using either the Cloud Console or your managed notebooks instance's JupyterLab user interface.

View a schedule

View a schedule to see the frequency settings of the schedule or to view the five most recent results of the notebook file execution.

Console

  1. In the Cloud Console, go to the Managed notebooks page and click the Schedules tab.

    Go to Schedules

  2. Click the schedule name you want to open the Schedule details page for.

    On the Schedule details page, you can view the schedule's last five executions.

  3. Next to an execution name, click View result to open the executed notebook file.

    Executor opens your result in a new browser tab.

JupyterLab

  1. In your managed notebooks instance's JupyterLab user interface, in the navigation menu, click the  Notebook Executor button.

  2. Click the Schedules tab.

  3. Under the execution that you want to view, click View latest execution result.

    Executor opens your result in a new browser tab.

Delete a schedule

Deleting a schedule does not delete the executions that were generated from that schedule.

Console

  1. In the Cloud Console, go to the Managed notebooks page and click the Schedules tab.

    Go to Schedules

  2. Select the schedule you want to delete.

  3. Click  Delete.

JupyterLab

  1. In your managed notebooks instance's JupyterLab user interface, in the navigation menu, click the  Notebook Executor button.

  2. Click the Schedules tab.

  3. At the end of the schedule name, click the  Open in new icon. The Schedule details page for that schedule opens in the Cloud Console.

  4. Click  Delete.

Clean up

To avoid incurring charges to your Google Cloud account for the resources used on this page, follow these steps.

Delete the instance

  1. In the Cloud Console, go to the Managed notebooks page.

    Go to Managed notebooks

  2. Select the managed notebooks instance that you want to delete.

  3. Click  Delete.

Delete the project

If you used resources outside of your managed notebooks instance, such as the Cloud Storage bucket required for creating a schedule, you might want to delete your project to avoid incurring further charges.

  1. In the Cloud Console, go to the Manage resources page.

    Go to Manage resources

  2. In the project list, select the project that you want to delete, and then click Delete.
  3. In the dialog, type the project ID, and then click Shut down to delete the project.

What's next