@@ -54,14 +54,8 @@ public static class ScenarioTestHelpers
54
54
internal const string SharedPoolStartTaskStdOut = "startup\\ stdout.txt" ;
55
55
internal const string SharedPoolStartTaskStdOutContent = "hello" ;
56
56
57
- // MPI requires a special pool configuration. When recording, the Storage environment variables need to be
58
- // set so we can upload the MPI installer for use as a start task resource file.
57
+ // MPI requires a special pool configuration, so a dedicated pool is used.
59
58
internal const string MpiPoolId = "mpiPool" ;
60
- internal const string MpiSetupFileContainer = "mpi" ;
61
- internal const string MpiSetupFileName = "MSMpiSetup.exe" ;
62
- internal const string MpiSetupFileLocalPath = "Resources\\ MSMpiSetup.exe" ;
63
- internal const string StorageAccountEnvVar = "AZURE_STORAGE_ACCOUNT" ;
64
- internal const string StorageKeyEnvVar = "AZURE_STORAGE_ACCESS_KEY" ;
65
59
66
60
internal const string BatchAccountName = "AZURE_BATCH_ACCOUNT" ;
67
61
internal const string BatchAccountKey = "AZURE_BATCH_ACCESS_KEY" ;
@@ -229,27 +223,17 @@ public static void CreateMpiPoolIfNotExists(BatchController controller, BatchAcc
229
223
client . ListPools ( listOptions ) ;
230
224
return ; // The call returned without throwing an exception, so the pool exists
231
225
}
232
- catch ( AggregateException aex )
226
+ catch ( BatchException ex )
233
227
{
234
- BatchException innerException = aex . InnerException as BatchException ;
235
- if ( innerException == null || innerException . RequestInformation == null || innerException . RequestInformation . BatchError == null ||
236
- innerException . RequestInformation . BatchError . Code != BatchErrorCodeStrings . PoolNotFound )
228
+ if ( ex . RequestInformation == null || ex . RequestInformation . BatchError == null ||
229
+ ex . RequestInformation . BatchError . Code != BatchErrorCodeStrings . PoolNotFound )
237
230
{
238
231
throw ;
239
232
}
240
233
// We got the pool not found error, so continue and create the pool
241
234
}
242
235
243
- string blobUrl = UploadBlobAndGetUrl ( MpiSetupFileContainer , MpiSetupFileName , MpiSetupFileLocalPath ) ;
244
-
245
- StartTask startTask = new StartTask ( ) ;
246
- startTask . CommandLine = string . Format ( "cmd /c set & {0} -unattend -force" , MpiSetupFileName ) ;
247
- startTask . ResourceFiles = new List < ResourceFile > ( ) ;
248
- startTask . ResourceFiles . Add ( new ResourceFile ( blobUrl , MpiSetupFileName ) ) ;
249
- startTask . RunElevated = true ;
250
- startTask . WaitForSuccess = true ;
251
-
252
- CreateTestPool ( controller , context , MpiPoolId , targetDedicated , startTask : startTask ) ;
236
+ CreateTestPool ( controller , context , MpiPoolId , targetDedicated ) ;
253
237
}
254
238
255
239
@@ -602,43 +586,6 @@ public static void DeleteComputeNodeUser(BatchController controller, BatchAccoun
602
586
client . DeleteComputeNodeUser ( parameters ) ;
603
587
}
604
588
605
- /// <summary>
606
- /// Uploads a blob to Storage if it doesn't exist and gets the url
607
- /// </summary>
608
- private static string UploadBlobAndGetUrl ( string containerName , string blobName , string localFilePath )
609
- {
610
- string blobUrl = "https://defaultUrl.blob.core.windows.net/blobName" ;
611
-
612
- if ( HttpMockServer . Mode == HttpRecorderMode . Record )
613
- {
614
- // Create container and upload blob if they don't exist
615
- string storageAccountName = Environment . GetEnvironmentVariable ( StorageAccountEnvVar ) ;
616
- string storageKey = Environment . GetEnvironmentVariable ( StorageKeyEnvVar ) ;
617
- StorageCredentials creds = new StorageCredentials ( storageAccountName , storageKey ) ;
618
- CloudStorageAccount storageAccount = new CloudStorageAccount ( creds , true ) ;
619
-
620
- CloudBlobClient blobClient = storageAccount . CreateCloudBlobClient ( ) ;
621
- CloudBlobContainer container = blobClient . GetContainerReference ( containerName ) ;
622
- container . CreateIfNotExists ( ) ;
623
-
624
- CloudBlockBlob blob = container . GetBlockBlobReference ( blobName ) ;
625
- if ( ! blob . Exists ( ) )
626
- {
627
- blob . UploadFromFile ( localFilePath , System . IO . FileMode . Open ) ;
628
- }
629
-
630
- // Get blob url with SAS string
631
- SharedAccessBlobPolicy sasPolicy = new SharedAccessBlobPolicy ( ) ;
632
- sasPolicy . Permissions = SharedAccessBlobPermissions . Read ;
633
- sasPolicy . SharedAccessExpiryTime = DateTime . UtcNow . AddHours ( 10 ) ;
634
- string sasString = container . GetSharedAccessSignature ( sasPolicy ) ;
635
-
636
- blobUrl = string . Format ( "{0}/{1}{2}" , container . Uri , blobName , sasString ) ;
637
- }
638
-
639
- return blobUrl ;
640
- }
641
-
642
589
/// <summary>
643
590
/// Uploads an application package to Storage
644
591
/// </summary>
0 commit comments