1

I currently have a free Azure Notebook account on https://notebooks.azure.com/ and would like to execute a Python script (or Jupyter Notebook) hosted on Azure automatically once every 10 minutes.

Is there a way to do this within the free Azure notebook account?

I am aware of several approaches which are described on the web, such as using Azure WebJobs, Azure Functions, Azure IoT and so on. However, all these approaches require me to upgrade to the the "Free" account which actually is only free for the first 12 months, so I would like to avoid that if possible.

Michael
  • 407
  • 2
  • 6
  • 11

2 Answers2

0

There are a number of 'always free' services that come with the free Azure account which includes Azure Functions.

As long as you stay within the free functions limit, which is currently 1,000,000 requests per month, you wouldn't have to pay anything.

https://azure.microsoft.com/en-us/free/free-account-faq/

Paul
  • 597
  • 2
  • 5
  • Thank you Paul, appreciate your answer. I will probably upgrade to the free Azure account, considering the severe constraints on scheduling within Azure Notebooks. – Michael Jan 03 '20 at 21:24
0

As I known, there is not any feature about job like WebJobs for Azure WebApp or Jobs for Azure Databricks in Microsoft Azure Notebooks. So I tried to trigger a Python script via crontab on Ubuntu of Azure Notebooks, but failed because the cron service default not started and Azure does not offer the nbuser password for using sudo to start cron service.

However, I also tried to write a Python script hello.py as below.

from datetime import datetime
import time
while(True):
    print(f"{datetime.now()} => Hello, world! ")
    time.sleep(10) // 10 seconds

And I ran it in Terminal of Azure Notebooks, as the figures below, then I closed the terminal page and ran !tail -f ~/hello.log, it seems not to be terminated by the closed event of terminal page.

enter image description here

enter image description here

You can try to this way. If it's not what you want, I think it's impossible on Azure Notebooks.

Peter Pan
  • 23,476
  • 4
  • 25
  • 43
  • Thanks for your answer Peter Pan. This partially solved the problem and is probably as good as it gets within Azure Notebooks. When closing the terminal page the script continues in the background. When opening the terminal page again the terminal page is blocked with the previous command until interrupted. Also the Jupyter Notebook kernel seems blocked as long as the script in the terminal runs in the background. – Michael Jan 03 '20 at 21:21