Search code examples
c#azureazure-batch

Azure Batch and Determine the Path of the Downloaded EXE on the Compute Node in c#


I am using Azure Batch. I am writing a c# application that uploads files to an Azure storage account. The code then creates a pool and tasks - this is all working fine except for one thing. The task has a commandline which is executed on each node (VM) in the pool to run the c# application on each node. The app has been successfully downloaded to the node but I think my path to the exe is wrong in the code..

const string appPackageId = "ffmpeg";
const string appPackageVersion = "6.0";

...

string taskCommandLine = String.Format("cmd /c {0}\\ffmpeg\\bin\\{1}.exe -i {2} {3}", appPath, appPackageId, inputMediaFile, outputMediaFile);


// Create a cloud task (with the task ID and command line) and add it to the task list
CloudTask task = new CloudTask(taskId, taskCommandLine);
task.ResourceFiles = new List<ResourceFile> { inputFiles[i] };

...

How to I set the taskCommandLine to the correct path of the exe on the VM ?

I know there are folders created on the VM but I am not sure where the exe and support files are downloaded to...? (there must be some kind of file/folder structure)

Regards Ian


Solution

  • I managed to log on to one node (VM) and see the full file path to my exe.

    The code fix was...

    const string appPackageId = "ffmpeg";
    const string appPackageVersion = "6.0";
    ...
    string taskCommandLine = String.Format("cmd /c {0}\\ffmpeg\\bin\\{1}.exe -i {2} {3}", appPath, appPackageId, inputMediaFile, outputMediaFile);
    

    The above calls the DEFAULT version of the application.

    Thanks Ian