I have a notebook on SageMaker I would like to run every night. What's the best way to schedule this task. Is there a way to run a bash script and schedule Cron job from SageMaker?
Amazon SageMaker is a set of API that can help various machine learning and data science tasks. These API can be invoked from various sources, such as CLI, SDK or specifically from schedule AWS Lambda functions (see here for documentation: https://docs.aws.amazon.com/lambda/latest/dg/with-scheduled-events.html )
The main parts of Amazon SageMaker are notebook instances, training and tuning jobs, and model hosting for real-time predictions. Each one has different types of schedules that you might want to have. The most popular are:
----- UPDATE (thanks to @snat2100 comment) -----
As of mid 2020, AWS provides several options to run a notebook as a cron job. It uses Papermill to inject parameters per run, and you can also use the CLI to run the notebook on demand.
You can:
(1) use the AWS APIs or CLI directly; (2) use a convenience package, or (3) use a Jupyter Lab extension.
See this tutorial and the Quick Start guide for examples.
I dont think there is any way to schedule tasks on sagemaker. Notebook is meant more for interacting with the SageMaker runtime. Which is more for training and hosting ML models.
I am presuming you want retrain your model every night. There are two ways of achieving that, retrain your model somewhere else and then upload to S3 and recreate your docker container every night using an external script. Or Provide your own docker container which has a cron job scheduled within it. Give that to SageMaker to deploy.