Options for running Python scripts in Azure

前端 未结 2 1148
北恋
北恋 2020-11-30 10:45

I have a Python script that gets data from Google Analytics and puts in into a CSV file. I currently run this script on a local machine but I\'d like to run the script in my

相关标签:
2条回答
  • 2020-11-30 11:10

    In addition to the first answer you can also use azure functions with a timer which is basically a script on a cronjob without a full machine and paid by invocation. https://docs.microsoft.com/en-us/azure/azure-functions/functions-overview

    0 讨论(0)
  • 2020-11-30 11:21

    For your needs, 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.

    I created a simple Trigger webjob for your reference.

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

    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.

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

    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.

    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:

    0 讨论(0)
提交回复
热议问题