The goal is to execute python file stored in blob storage using azure batch job.

-- created azure account -- created pool -- created job -- created task

Batchpool:

windowsserver
Target Dedicated Nodes: 2
VM Size: Standard A1_V2  1vCPU 2Gb Memory
StartTask: installs python by taking .exe files from storage account

Task: using python file stored in blob storage, just simply printing "Hello World".

enter image description here

Output: Gives an error Message: The system cannot find the file specified.

enter image description here

By logging remotely to a batch node I was able to confirm that the python was installed.

enter image description here

What am I doing wrong?

Maybe the syntax in "Command Line" to execute python script is incorrect?

I am not sure how to supply Environment Variables.

1

There are 1 best solutions below

1
On BEST ANSWER

In order to run Python script inside a Azure Batch Pool Windows Node as a Start Task, Refer the steps in this Microsoft Blog.

I downloaded Python 3.12 from this website and uploaded the downloaded exe package in my Storage account container like below:-

Created a batch pool with Windows Server 2019 datacenter image with 3 Nodes and 1 Spot node[ You can create it with 1 Node too].

In the start task selected the exe package from storage account:-

Make sure you check-mark Include SAS while uploading exe package from storage account to batch task:-

enter image description here

enter image description here

My Task:-

enter image description here

Command line script to install Python 3.12:-

cmd /c "python-3.12.0-amd64.exe /quiet InstallAllUsers=1 PrependPath=1 Include_test=0"

Select Pool autouser, Admin in the Elevation level.

Save the Task, And the Task ran successfully on the Node:-

enter image description here

I Rdp'd into the Node and Python 3.12 was installed successfully:-

enter image description here

Now, I added another hello_world.py in my Storage account with Include SAS checkmark and ran it inside the Node:-

Added hello_world.py in the Batch Start task > Resource files:-

enter image description here

My Start Task:-

Command line:-

cmd /c "python-3.12.0-amd64.exe /quiet InstallAllUsers=1 PrependPath=1 Include_test=0"

cmd /c "python hello_world.py"

enter image description here

Start Task Ran successfully, Make sure you Reboot the Node everytime, Before you run the Start task.

enter image description here

I RDP'd into the Node and the files were successfully present:-

enter image description here