How to run python script on Azure Batch?

Ayoub 20 Reputation points
2023-06-13T09:34:07.7666667+00:00

Hi everyone,

I'd like to run a python script using Azure batch but don't know whoch configuration to use neither for the batch nor for the pools. The script doesn't require much memory to run and is completed in a couple seconds. Any help would be very appreciated.

Azure Batch
Azure Batch
An Azure service that provides cloud-scale job scheduling and compute management.
339 questions
{count} votes

Accepted answer
  1. vipullag-MSFT 26,391 Reputation points
    2023-06-19T05:14:14.65+00:00

    Hello Ayoub

    Welcome to Microsoft Q&A Platform, thanks for posting your query here.

    To run a Python script on Azure Batch, you can use the Batch Service API (https://learn.microsoft.com/en-us/rest/api/batchservice/) or the Azure Batch Python SDK (https://learn.microsoft.com/en-us/python/api/overview/azure/batch?view=azure-python). Here are the steps:

    1. Create a Batch account and a Batch pool.
    2. Create a Batch job and add tasks to the job. Each task represents a command to run on a compute node.
    3. Specify the command to run the Python script in the task. You can use the cmd /c command to run the script with the Python interpreter.
    4. Upload the Python script and any required input files to Azure Storage.
    5. Configure the task to download the input files from Azure Storage to the compute node before running the script**.**
    6. Monitor the job and retrieve the output files from Azure Storage.

    You can find more detailed information and code samples in the Azure Batch documentation that was shared by Samy Abdul in the previous response. Thanks Samy Abdul for adding your response to the query.

    Hope this helps.

    1 person found this answer helpful.
    0 comments No comments

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.