Run the sample app

Make sure you finished the Download and config the sample step, run the app from Bash as follow:

cd src
python batch_python_experiment.py

output

Sample start: 2020-12-05 12:35:50

Container [input-1607168150] created.
Container [output-1607168150] created.
Uploading file /Users/sczho/code/batch-python-experiment/src/inputFiles/job4.txt to container [input-1607168150]...
Uploading file /Users/sczho/code/batch-python-experiment/src/inputFiles/job1.txt to container [input-1607168150]...
Uploading file /Users/sczho/code/batch-python-experiment/src/inputFiles/job2.txt to container [input-1607168150]...
Uploading file /Users/sczho/code/batch-python-experiment/src/inputFiles/job3.txt to container [input-1607168150]...
Uploading file /Users/sczho/code/batch-python-experiment/src/sourceFiles/requirements.txt to container [input-1607168150]...
Uploading file /Users/sczho/code/batch-python-experiment/src/sourceFiles/mlp.py to container [input-1607168150]...
Uploading file /Users/sczho/code/batch-python-experiment/src/sourceFiles/linear_regression.py to container [input-1607168150]...
Uploading file /Users/sczho/code/batch-python-experiment/src/sourceFiles/svm.py to container [input-1607168150]...
Uploading file /Users/sczho/code/batch-python-experiment/src/sourceFiles/random_forest.py to container [input-1607168150]...
Uploading file /Users/sczho/code/batch-python-experiment/src/sourceFiles/boston_house_price.py to container [input-1607168150]...
Creating pool [BatchExperimentPool_1607168150]...
Creating job [BatchExperimentJob_1607168150]...
Adding 4 tasks to job [BatchExperimentJob_1607168150]...
Monitoring all tasks for 'Completed' state, timeout in 0:30:00...........

The job normally will finish in about 8 minutes, most of the time is spent on VM initialization and install dependencies (environment). Create your own custom VM image can accelerate this step. While waiting for the tasks to be completed, we can go to Azure Portal and check all the resources created by the program:

  • Storage account

    • input-timestamp - the container for upload inputs and app

    • output-timestamp - the container for store task output

  • Batch account

    • BatchExperimentPool_timestamp - the VM instance pool

    • BatchExperimentJob_timestamp

      • 4 tasks - to execute our Python program

After tasks complete, you see output similar to the following:

And clean up resources:

If you choose to keep the storage container and pool to observe the config and data, don't forget to delete them later, Azure will charge you for the pool and storages.

When no longer needed, delete the resource group, Batch account, and storage account. To do so in the Azure portal, select the resource group for the Batch account and select Delete resource group.

Last updated

Was this helpful?