Skip to content

SageMaker Studio > Code Editor or Jupyter Notebook > running scheduled scripts

0

In SageMaker Studio, you have to 'run' the Code Editor for it to open. I'm wondering if code that is set to run automatically can still execute even if the Code Editor hasn't been manually opened.

Specifically, I’d like to schedule a script (e.g., for web crawling) to run automatically at certain times within the Code Editor. Is this possible?

asked 8 months ago102 views
1 Answer
0

Yes, you can schedule scripts to run automatically in SageMaker without having to manually open the Code Editor or Jupyter Notebook. This is possible through SageMaker notebook jobs.

SageMaker notebook jobs allow you to create non-interactive jobs that run either on demand or on a schedule. When you set up a notebook job, SageMaker takes a snapshot of your entire notebook, packages its dependencies in a container, builds the necessary infrastructure, runs the notebook as an automated job based on your schedule, and then deprovisions the infrastructure when the job completes.

You have several options to schedule your notebook jobs:

  1. Using the Notebook Jobs widget directly from JupyterLab with an intuitive user interface
  2. Using the SageMaker Python SDK

For your web crawling use case, you could create a notebook containing your web crawling code and schedule it to run at specific times. The notebook will execute automatically according to your schedule without requiring you to manually open the Code Editor.

You can schedule a job in different ways:

  • For a one-time future run at a specific date and time
  • For recurring runs using cron expressions (e.g., running at 10:15am UTC on the last Friday of each month)

After setting up your scheduled notebook job, you can monitor its execution through the SageMaker Notebook Jobs dashboard in the Studio UI.
Sources
ML Compute Instance with Jupyter Notebook - Amazon SageMaker Studio Notebooks - AWS
Machine Learning Service – Amazon SageMaker Studio Notebooks – AWS
Create notebook job with SageMaker AI Python SDK example - Amazon SageMaker AI
Schedule your ML workflows - Amazon SageMaker AI

answered 8 months ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.