@@ -54,14 +54,8 @@ public static class ScenarioTestHelpers
5454 internal const string SharedPoolStartTaskStdOut = "startup\\ stdout.txt" ;
5555 internal const string SharedPoolStartTaskStdOutContent = "hello" ;
5656
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.
5958 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" ;
6559
6660 internal const string BatchAccountName = "AZURE_BATCH_ACCOUNT" ;
6761 internal const string BatchAccountKey = "AZURE_BATCH_ACCESS_KEY" ;
@@ -229,27 +223,17 @@ public static void CreateMpiPoolIfNotExists(BatchController controller, BatchAcc
229223 client . ListPools ( listOptions ) ;
230224 return ; // The call returned without throwing an exception, so the pool exists
231225 }
232- catch ( AggregateException aex )
226+ catch ( BatchException ex )
233227 {
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 )
237230 {
238231 throw ;
239232 }
240233 // We got the pool not found error, so continue and create the pool
241234 }
242235
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 ) ;
253237 }
254238
255239
@@ -602,43 +586,6 @@ public static void DeleteComputeNodeUser(BatchController controller, BatchAccoun
602586 client . DeleteComputeNodeUser ( parameters ) ;
603587 }
604588
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-
642589 /// <summary>
643590 /// Uploads an application package to Storage
644591 /// </summary>
0 commit comments