Shradha
Shradha

Reputation: 11

How to schedule a script to run daily on jupyter notebook?

I am using Jupyter notebook on internal cloud. And there is a script which needs to be run daily. Is there a way to automate it so that it runs itself on a daily basis?

I read somewhere that this can be done using Cron, so I tried installing the following and every time it gives the following error:

!pip install jupyterlab-scheduler

ERROR: Could not find a version that satisfies the requirement jupyterlab-scheduler (from versions: none)
ERROR: No matching distribution found for jupyterlab-scheduler

!pip install jupyter-cron

ERROR: Could not find a version that satisfies the requirement jupyter-cron (from versions: none)
ERROR: No matching distribution found for jupyter-cron

Any help would be much appreciated. Thanks!

Upvotes: 1

Views: 3998

Answers (1)

pplonski
pplonski

Reputation: 5839

There are several approaches for scheduling Jupyter Notebooks. To execute the notebook with cron, you need to define a line in the crontab with the:

  • crontab string that defines execution frequency,
  • a command that will be executed.

For the crontab string, I recommend https://crontab.guru/ - it helps you define schedule expressions.

For command, please check nbconvert and papermill - they allow you to execute .ipynb file in the command line.

If you would like to schedule notebooks and share them with others, please check Mercury or Notebooker frameworks. They offer a web-based service for scheduling and sharing final notebooks as HTML.

Upvotes: 0

Related Questions