Running with the following settings:
-------------------------------------
PoolId = PoolsAndResourceFilesPool
PoolTargetNodeCount = 1
PoolOSFamily = 5
PoolNodeVirtualMachineSize = standard_d1_v2
ShouldDeletePool = False
ShouldDeleteJob = True
BlobContainer = PoolAndResourceFilesContainer
BatchAccountName = xxxxxxxxxxxxxxxxxx
BatchAccountKey = xxxxxxxxxxxxxxxxxxx==
BatchServiceUrl = xxxxxxxxxxxxxxxxxxx
StorageAccountName = xxxxxxxxxxxxxxxx
StorageAccountKey = xxxxxxxxxxxxxxxxx==
StorageServiceUrl = core.windows.net
Uploading resources to storage container: poolandresourcefilescontainer
Uploading C:\Users\xxxx\AppData\Local\Temp\StartTask.txt to https://xxxxxxxx.blob.core.windows.net/poolandresourcefilescontainer/StartTask.txt
Done uploading C:\Users\xxxx\AppData\Local\Temp\StartTask.txt
Attempting to create pool: PoolsAndResourceFilesPool
The pool already existed when we tried to create it
Listing Jobs
============
State of job SimpleJob-xxxx-20200510-145405 is Active
============
Listing Pools
=============
State of pool PoolsAndResourceFilesPool is Active and it has 1 dedicated nodes and 0 low-priority nodes of size standard_d1_v2
=============
Task task_with_file1
Deleting container: mab-2020-05-10-12-54-06c1cf5a24-c2ca-4e0e-ad65-041314fdfd22
Deleting job: SimpleJob-xxxx-20200510-145405
Microsoft.Azure.Batch.Common.BatchException: Operation returned an invalid status code 'NotFound' ---> Microsoft.Azure.Batch.Protocol.Models.BatchErrorException: Operation returned an invalid status code 'NotFound'
at Microsoft.Azure.Batch.Protocol.FileOperations.<GetPropertiesFromTaskWithHttpMessagesAsync>d__7.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.Azure.Batch.Protocol.BatchRequestBase`2.<ExecuteRequestWithCancellationAsync>d__42.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at Microsoft.Azure.Batch.Protocol.BatchRequestBase`2.<ExecuteRequestAsync>d__40.MoveNext()
--- End of inner exception stack trace ---
at Microsoft.Azure.Batch.Samples.Common.GettingStartedCommon.<WaitForTasksAndPrintOutputAsync>d__4.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.GetResult()
at Microsoft.Azure.Batch.Samples.PoolsAndResourceFiles.JobSubmitter.<RunAsync>d__5.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at Microsoft.Azure.Batch.Samples.PoolsAndResourceFiles.JobSubmitter.<RunAsync>d__5.MoveNext()
Request Information
ClientRequestId:
RequestId:1ffe597d-792d-4085-8c6b-16b54535a9c4
HttpStatusCode:NotFound
StatusMessage:The specified file does not exist.
Unhandled Exception: System.AggregateException: One or more errors occurred. ---> Microsoft.Azure.Batch.Common.BatchException: Operation returned an invalid status code 'NotFound' ---> Microsoft.Azure.Batch.Protocol.Models.BatchErrorException: Operation returned an invalid status code 'NotFound'
at Microsoft.Azure.Batch.Protocol.FileOperations.<GetPropertiesFromTaskWithHttpMessagesAsync>d__7.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.Azure.Batch.Protocol.BatchRequestBase`2.<ExecuteRequestWithCancellationAsync>d__42.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at Microsoft.Azure.Batch.Protocol.BatchRequestBase`2.<ExecuteRequestAsync>d__40.MoveNext()
--- End of inner exception stack trace ---
at Microsoft.Azure.Batch.Samples.Common.GettingStartedCommon.<WaitForTasksAndPrintOutputAsync>d__4.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.GetResult()
at Microsoft.Azure.Batch.Samples.PoolsAndResourceFiles.JobSubmitter.<RunAsync>d__5.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at Microsoft.Azure.Batch.Samples.PoolsAndResourceFiles.JobSubmitter.<RunAsync>d__5.MoveNext()
--- End of inner exception stack trace ---
at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions)
at System.Threading.Tasks.Task.Wait(Int32 millisecondsTimeout, CancellationToken cancellationToken)
at System.Threading.Tasks.Task.Wait()
at Microsoft.Azure.Batch.Samples.PoolsAndResourceFiles.Program.Main(String[] args)
D:\Repos\Azure\AZ203\azure-batch-samples\CSharp\GettingStarted\02_PoolsAndResourceFiles\JobSubmitter\bin\Debug\net462\JobSubmitter.exe (process 49684) exited with code 0.
To automatically close the console when debugging stops, enable Tools->Options->Debugging->Automatically close the console when debugging stops.
Press any key to close this window . . .
Expected behavior
Project can be run multiple times without needing to manually modify batch pools.
Actual behavior
Project run only works once. All subsequent runs throw an exception.
I've tried with various pool sizes, but even with 1 node it throws the exception.
Reproduction steps
https://github.com/Azure-Samples/azure-batch-samples/blob/ff3dcdcf0c75909ecb20c87a3a6802e6d13ba239/CSharp/Common/GettingStartedCommon.cs#L126
Work around
Example failed output