3

Does anybody knows how to schedule a jupyter notebook every hour or 30 minutes?

I tried to use seekwell (https://app.seekwell.io/) but it did not work for me.

Does anybody have another solution

thanks,

5 Answers5

2

Save your jupyter notebook as .py file

I would like to give credit to @Vincent Stevenson

Go to Control Panel --> Administrative Tools --> Task Scheduler--> Create Task

  1. Task Scheduler, Create Task

  2. Give the Task a title

  3. Go to Actions

  4. Go to CMD to find the path,

    Python, import sys, sys.executable

    (this tells you what the Program/script field should be populated with: "some path with Appdata mostly")

    like:C:\Users\admin\AppData\Local\Programs\Python\Python38-32\python.exe

  5. Arguments: name of the python script (like run.py)

  6. Start in: dir location of python script (like:C:\Users\admin\Documents\my_python_project)

  7. Go to Triggers, schedule for every 30 minutes

  8. Test the script by running it

TT313
  • 111
  • 9
1

According to the article 5 ways to schedule Jupyter Notebook there are several approaches to scheduling a notebook.

1. Cron

You can use cron scheduler if you are on UNIX machine. You define the frequency of the execution in the crontab. To execute notebook as script you can use nbconvert or papermill.

2. Windows Task Scheduler

Windows user can use Windows Task Scheduler with nbconvert or papermill.

3. Mercury

You can use the Mercury framework for scheduling. You need to add the YAML header in the notebook, below is the example:

title: My notebook
description: My notebook executed automatically
schedule: '0 * * * *'
notify:
    on_success: email1@example.com
    attachment: pdf

What is more, you can set a list of emails that will receive the notebook in PDF format by email after successful execution. Here is a notebook scheduling documentation.

Below is an example of a notebook scheduled in the Mercury. You can see that there is a green box in the sidebar with information about scheduling. The notebook can also be easily accessed as a web app and downloaded as a PDF.

Scheduled notebook web app

You can read more about scheduling notebooks to make automated PDF reports and making dashboards in Python with automatic updates on the MLJAR blog.

4. Notebooker

The next open source framework for notebooks scheduling is Notebooker. It is a Flask based application for scheduling and sharing notebooks.

enter image description here

enter image description here

5. Web-based notebooks

There are several notebook in the cloud services that offer scheduling:

pplonski
  • 5,023
  • 1
  • 30
  • 34
1

A few months ago, an open-source JupyterLab extension called Jupyter Scheduler was released and it does exactly what you need. Very easy to use from within JupyterLab and no need to save the notebook as a Python file

You can find a very good introduction here: https://blog.jupyter.org/introducing-jupyter-scheduler-f9e82676c388

Note that the minimum JupyterLab version currently seems to be 3.5. (It did not work for me with 3.4.)

yogabonito
  • 657
  • 5
  • 14
0

If you are Linux user, then simply create a python script and add it to your crontab to run every few hours.

If you are windows, then also you need to create python script and instead of crontab use scheduled tasks:

Setting up a cron job in Windows

Chandan Malla
  • 481
  • 5
  • 14
0

If you want, you can use [Deepnote] (http://deepnote.com/). You can run your Jupyter notebooks using the free cloud platform Deepnote. You can simply set Deepnote to run at a given interval and close the window. This will ensure that no added actions are needed for you to execute the notebook at the given time.

Furthermore, you can select to be notified by email if your notebook stops working in Deepnote.

Chirag
  • 66
  • 3