none
Schedule R or Python scripts to run RRS feed

  • Question

  • how can we schedule a Python or R script in Azure Machine Learning notebook to run on a schedule basis? e.g every 1 hour to run that script.

    Thanks.

    Wednesday, October 30, 2019 7:50 AM

All replies

  • Hi TAN,

    I don't think there is a way can do it within Azure notebook directly. But, I suggest you use Web Jobs in Web Apps Service. It has two types of Azure Web Jobs for you to choose: Continuous and Trigger. For your  needs, Trigger should be adopted.

    You could refer to the document here for more details.In addition, here shows how to run tasks in WebJobs.

    Here is an example:

    Step 1: I write a Sample.py as below:

    enter image description here

    I used the python third-party module virtualenv create a isolated python environment and used the pip install requests command line to download the libs packages that the requests depend on.

    enter image description here

    ​then keep the Sample.py uniformly compressed into a folder with the libs packages dependent on the requests that you rely on.

    enter image description here

    Step 2: Create webjob in Web app service. Here, I choose Triggered Type and set cron expression 0/5 * * * * * which means this job will be excuted per 5 seconds.

    enter image description here

    you'll see the Web Job list after your successful creation.

    Step 3: You could check your running web job's status and logs via the Logs button as below:

    enter image description here

    enter image description here

    enter image description here

    Regards,

    Yutong

    For your needs, I suggest you use Web Jobs in Web Apps Service.
    Monday, November 4, 2019 4:46 AM
    Moderator