Closed alpinemountain closed 8 years ago
Hi, Which solution are you talking about specifically?
We will update the samples to 5.0.0 shortly, but in the meantime they are not targeting 5.0.0 they are targeting 4.0.1 (and thus they should all compile).
Thanks. It's this one:
https://github.com/Azure/azure-batch-samples/tree/master/CSharp/ArticleProjects/DotNetTutorial
https://azure.microsoft.com/en-us/documentation/articles/batch-dotnet-get-started/
In 5.0.0, how should this line be re-written?
bool timedOut = await taskStateMonitor.WhenAllAsync(tasks, TaskState.Completed, timeout);
Generally speaking we don't have the samples track the most up to date release immediately (it usually lags by a few days). During this time period the samples should still work against the version of the Azure.Batch package specified in their packages.config (which right now is 4.0.1).
Azure.Batch 5.0.0 just shipped last week, and we haven't updated the samples yet because there is a 5.0.1 coming (today). Once 5.0.1 drops later today we'll move all of the samples to 5.0.1, but that might not fully merge in for a few days because we have to coordinate an article update as well (otherwise the getting started article would get out of sync with its backing sample)
So in the interim I think your question really is, what should you change the broken line(s) to?
The code was this:
TaskStateMonitor taskStateMonitor = batchClient.Utilities.CreateTaskStateMonitor();
bool timedOut = await taskStateMonitor.WhenAllAsync(tasks, TaskState.Completed, timeout);
if (timedOut)
{
allTasksSuccessful = false;
await batchClient.JobOperations.TerminateJobAsync(jobId, failureMessage);
Console.WriteLine(failureMessage);
}
else
{
...
it should now be this in Azure.Batch 5.0.0:
TaskStateMonitor taskStateMonitor = batchClient.Utilities.CreateTaskStateMonitor();
try
{
await taskStateMonitor.WhenAll(tasks, TaskState.Completed, timeout);
}
catch (TimeoutException)
{
allTasksSuccessful = false;
await batchClient.JobOperations.TerminateJobAsync(jobId, failureMessage);
Console.WriteLine(failureMessage);
}
if (allTasksSuccessful)
{
...
As for your question 2, I believe that between Azure.Storage 6.2.0 and Azure.Storage 7.1.2 there was a breaking change which makes the two incompatible (see their release notes for more details but the key one is here):
So I would suggest rolling back your Storage dll version to 6.2.0 unless there's a major need to use 7.1.2.
If you really do need 7.1.2 let us know and we can give some suggestions.
Thanks very much.
The storage line affected is this:
await blobData.UploadFromFileAsync(filePath, FileMode.Open);
It can be fixed by changing this to:
await blobData.UploadFromFileAsync(filePath);
When using the latest version of Microsoft.WindowsAzure.Storage (7.1.2.0) and Microsoft.Azure.Batch (5.0.0.0), this solution does not compile.
Issue #1 - "WhenAllAsync" does not exist in the new Batch DLL:
bool timedOut = await taskStateMonitor.WhenAllAsync(tasks, TaskState.Completed, timeout);
Issue #2 - CloudBlockBlob does not have a method that matches this signature: await blobData.UploadFromFileAsync(filePath, FileMode.Open);