0
votes

In my implementation of Azure batch, I am trying to install Python3.7.3 as part of the pool starttask event. However, I am not succeeding with this. Start task fails almost in all the times, returning 'invalid arguments'. What am I missing? Please help.

pool.ApplicationPackageReferences = new List { new ApplicationPackageReference { ApplicationId = "PythonInstall", Version = "1.0" } };

string appPath = String.Format("%AZ_BATCH_APP_PACKAGE_{0}#{1}%", appPackage_pyInstall_ID, appPackage_pyInstall_Version);

pool.StartTask = new StartTask()
{
    CommandLine = $@" CMD.exe / copy --% {appPath}\python-3.7.3-amd64.exe  %AZ_BATCH_NODE_STARTUP_DIR% && %AZ_BATCH_NODE_STARTUP_DIR%\python-3.7.3-amd64.exe /quiet InstallAllUsers=0 PrependPath=1 Include_test=0 TargetDir = %AZ_BATCH_NODE_STARTUP_DIR%",
    UserIdentity = new UserIdentity(new AutoUserSpecification(elevationLevel: ElevationLevel.Admin, scope: AutoUserScope.Task)),
    WaitForSuccess = true,
};

Ideally, I expect the installation to complete quietly but it is not happening :(

1

1 Answers

1
votes

Please see https://github.com/Azure-Samples/azure-batch-samples/blob/328be5fe51e99297c69686cf30d1d2a06439af75/Python/Batch/sample4_job_scheduler.py#L49 for a working sample of an install python command.

I believe the core problem in your command is you did not include /c in your cmd.exe execution.

CMD.exe /

Should actually be:

CMD.exe /c