0
votes

I'm trying to launch a VBS file as an Azure Batch Task and I'm constantly getting errors that the script file cannot be found.

Here's one command that works:

string appPath = String.Format("%AZ_BATCH_APP_PACKAGE_{0}#{1}%", appPackageId, appPackageVersion);
string taskCommandLine = String.Format("cmd /c {0}\\ffmpeg-3.4-win64-static\\bin\\ffmpeg.exe -i {1} -vcodec libx264 -crf 28 -c:a aac -b:a 128k {2} & del {3} & rename {4} {5}", appPath, inputMediaFile, outputMediaFile, inputMediaFile, outputMediaFile, inputMediaFile);

This one works correctly, but before firing ffmpeg on the input file, I'd like to do some checks with ffprobe first and doing so with a .bat kind of sucks so I tought of doing it in VBScript.

string appPath = String.Format("%AZ_BATCH_APP_PACKAGE_{0}#{1}%", appPackageId, appPackageVersion);
string taskCommandLine = String.Format("cmd /c cscript {0}\\ffmpeg-3.4-win64-static\\bin\\scan_run1.vbs {1} {2}", appPath, inputMediaFile, outputMediaFile);

Which results in:

Microsoft (R) Windows Script Host Version 5.8 Copyright (C) Microsoft Corporation. All rights reserved.

Input Error: Can not find script file "D:\batch\tasks\applications\ffmpeg3.42019-02-01-19-50\ffmpeg-3.4-win64-static\bin\scan_run1.vbs"

I'm pretty sure the vbs is there, because invoking ffmpeg.exe at the exact same location works fine.

Is the Azure Portal stripping out the VBS out of the ZIP file when I upload it as package ? What is going on there ?

Thanks.


Turns out Azure Portal is not updating the application package when I replace it. So it's got "scan_run.vbs" but not "scan_run1.vbs" even though the ZIP file on my end has it.

1
I think there is something else, so your task has a package and you updated used it with *.bat and it worked and then once you updated the package with new files == 1) did you re-uploaded the package? 2) did you re-ran it as another task or same task? docs.microsoft.com/en-us/azure/batch/batch-application-packages There are various nitty gritty of how the Environment variables get set etc, with it. App packages are Pool level or task level and in your case the scenario is task level.Tats_innit
Continue... If you use tools like batch-explorer you will be able to dig under the fold structure in your node and see if the file exist. To me this is the clear case of some user error category, have you tried with version number? did it worked with version number? Please note If a specified package and version is already installed on the node, the package is not downloaded and the existing package is used. please let me know how it goes. Thanks.Tats_innit
Further: This has nothing to do with what you see locally in zip, when you update the package which was existing with new content and try it in the existing node then it all depends on the node level mechanism, i.e. if you have different version of packages, please refer to the link I shared. Firstly, try with version and package, secondly if you are altering the same package too frequently then design wise I would recommend utilizing the app version feature, thirdly in case you want to update the same package you need to make sure task has a backing mechanism in place.Tats_innit

1 Answers

4
votes

This will help in better understanding, essentially the short answer is this:

Reference from document here: https://docs.microsoft.com/en-us/azure/batch/batch-application-packages

Similar to a pool, you specify application package references for a task. When a task is scheduled to run on a node, the package is downloaded and extracted just before the task's command line is executed. If a specified package and version is already installed on the node, the package is not downloaded and the existing package is used.

Detail

Like I mentioned in the comments, if you have different version of application package it is recommended.

This is great that you are exploring these errors because this will help in better design of this concept around your application.

recommendations

How version works is detailed here:

Extras:

Common Gotchas

  • If user app is uplaoding app pkgs on the fly via API, or manually, make sure the package is correctly uploaded, Programmaticvally usually non async behaviour leads to an issue, so always wait for the uplaod to finish before Batch creates a pool and proceeds.