当前位置: 首页>>代码示例>>C#>>正文


C# BatchClient.ListPools方法代码示例

本文整理汇总了C#中Microsoft.Azure.Commands.Batch.Models.BatchClient.ListPools方法的典型用法代码示例。如果您正苦于以下问题:C# BatchClient.ListPools方法的具体用法?C# BatchClient.ListPools怎么用?C# BatchClient.ListPools使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Microsoft.Azure.Commands.Batch.Models.BatchClient的用法示例。


在下文中一共展示了BatchClient.ListPools方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: GetPoolCurrentDedicated

        /// <summary>
        /// Gets the CurrentDedicated count from a pool
        /// </summary>
        public static int GetPoolCurrentDedicated(BatchController controller, BatchAccountContext context, string poolId)
        {
            RequestInterceptor interceptor = CreateHttpRecordingInterceptor();
            BatchClientBehavior[] behaviors = new BatchClientBehavior[] { interceptor };
            BatchClient client = new BatchClient(controller.BatchManagementClient, controller.ResourceManagementClient);

            ListPoolOptions options = new ListPoolOptions(context, behaviors)
            {
                PoolId = poolId
            };

            PSCloudPool pool = client.ListPools(options).First();
            return pool.CurrentDedicated.Value;
        }
开发者ID:OliverMichalski,项目名称:azure-powershell,代码行数:17,代码来源:ScenarioTestHelpers.cs

示例2: GetPoolCount

        /// <summary>
        /// Gets the number of pools under the specified account
        /// </summary>
        public static int GetPoolCount(BatchController controller, BatchAccountContext context)
        {
            RequestInterceptor interceptor = CreateHttpRecordingInterceptor();
            BatchClientBehavior[] behaviors = new BatchClientBehavior[] { interceptor };
            BatchClient client = new BatchClient(controller.BatchManagementClient, controller.ResourceManagementClient);

            ListPoolOptions options = new ListPoolOptions(context, behaviors);

            return client.ListPools(options).Count();
        }
开发者ID:OliverMichalski,项目名称:azure-powershell,代码行数:13,代码来源:ScenarioTestHelpers.cs

示例3: WaitForOSVersionChange

        public static string WaitForOSVersionChange(BatchController controller, BatchAccountContext context, string poolId)
        {
            RequestInterceptor interceptor = CreateHttpRecordingInterceptor();
            BatchClientBehavior[] behaviors = new BatchClientBehavior[] { interceptor };
            BatchClient client = new BatchClient(controller.BatchManagementClient, controller.ResourceManagementClient);

            ListPoolOptions options = new ListPoolOptions(context, behaviors)
            {
                PoolId = poolId
            };

            DateTime timeout = DateTime.Now.AddMinutes(2);
            PSCloudPool pool = client.ListPools(options).First();
            while (pool.CurrentOSVersion != pool.TargetOSVersion)
            {
                if (DateTime.Now > timeout)
                {
                    throw new TimeoutException("Timed out waiting for active state pool");
                }
                Sleep(5000);
                pool = client.ListPools(options).First();
            }

            return pool.TargetOSVersion;
        }
开发者ID:OliverMichalski,项目名称:azure-powershell,代码行数:25,代码来源:ScenarioTestHelpers.cs

示例4: WaitForSteadyPoolAllocation

        public static void WaitForSteadyPoolAllocation(BatchController controller, BatchAccountContext context, string poolId)
        {
            RequestInterceptor interceptor = CreateHttpRecordingInterceptor();
            BatchClientBehavior[] behaviors = new BatchClientBehavior[] { interceptor };
            BatchClient client = new BatchClient(controller.BatchManagementClient, controller.ResourceManagementClient);

            ListPoolOptions options = new ListPoolOptions(context, behaviors)
            {
                PoolId = poolId
            };

            DateTime timeout = DateTime.Now.AddMinutes(2);
            PSCloudPool pool = client.ListPools(options).First();
            while (pool.AllocationState != AllocationState.Steady)
            {
                if (DateTime.Now > timeout)
                {
                    throw new TimeoutException("Timed out waiting for steady allocation state");
                }
                Sleep(5000);
                pool = client.ListPools(options).First();
            }
        }
开发者ID:OliverMichalski,项目名称:azure-powershell,代码行数:23,代码来源:ScenarioTestHelpers.cs

示例5: GetPoolCount

        /// <summary>
        /// Gets the number of pools under the specified account
        /// </summary>
        public static int GetPoolCount(BatchController controller, BatchAccountContext context)
        {
            BatchClient client = new BatchClient(controller.BatchManagementClient, controller.ResourceManagementClient);

            ListPoolOptions options = new ListPoolOptions(context);

            return client.ListPools(options).Count();
        }
开发者ID:kjohn-msft,项目名称:azure-powershell,代码行数:11,代码来源:ScenarioTestHelpers.cs

示例6: GetPoolCurrentDedicated

        /// <summary>
        /// Gets the CurrentDedicated count from a pool
        /// </summary>
        public static int GetPoolCurrentDedicated(BatchController controller, BatchAccountContext context, string poolId)
        {
            BatchClient client = new BatchClient(controller.BatchManagementClient, controller.ResourceManagementClient);

            ListPoolOptions options = new ListPoolOptions(context)
            {
                PoolId = poolId
            };

            PSCloudPool pool = client.ListPools(options).First();
            return pool.CurrentDedicated.Value;
        }
开发者ID:kjohn-msft,项目名称:azure-powershell,代码行数:15,代码来源:ScenarioTestHelpers.cs

示例7: CreateMpiPoolIfNotExists

        /// <summary>
        /// Creates an MPI pool.
        /// </summary>
        public static void CreateMpiPoolIfNotExists(BatchController controller, BatchAccountContext context, int targetDedicated = 3)
        {
            BatchClient client = new BatchClient(controller.BatchManagementClient, controller.ResourceManagementClient);
            ListPoolOptions listOptions = new ListPoolOptions(context)
            {
                PoolId = MpiPoolId
            };

            try
            {
                client.ListPools(listOptions);
                return; // The call returned without throwing an exception, so the pool exists
            }
            catch (AggregateException aex)
            {
                BatchException innerException = aex.InnerException as BatchException;
                if (innerException == null || innerException.RequestInformation == null || innerException.RequestInformation.AzureError == null ||
                    innerException.RequestInformation.AzureError.Code != BatchErrorCodeStrings.PoolNotFound)
                {
                    throw;
                }
                // We got the pool not found error, so continue and create the pool
            }

            string blobUrl = UploadBlobAndGetUrl(MpiSetupFileContainer, MpiSetupFileName, MpiSetupFileLocalPath);

            StartTask startTask = new StartTask();
            startTask.CommandLine = string.Format("cmd /c set & {0} -unattend -force", MpiSetupFileName);
            startTask.ResourceFiles = new List<ResourceFile>();
            startTask.ResourceFiles.Add(new ResourceFile(blobUrl, MpiSetupFileName));
            startTask.RunElevated = true;
            startTask.WaitForSuccess = true;

            CreateTestPool(controller, context, MpiPoolId, targetDedicated, startTask: startTask);
        }
开发者ID:injyzarif,项目名称:azure-powershell,代码行数:38,代码来源:ScenarioTestHelpers.cs

示例8: WaitForOSVersionChange

        public static string WaitForOSVersionChange(BatchController controller, BatchAccountContext context, string poolId)
        {
            BatchClient client = new BatchClient(controller.BatchManagementClient, controller.ResourceManagementClient);

            ListPoolOptions options = new ListPoolOptions(context)
            {
                PoolId = poolId
            };

            DateTime timeout = DateTime.Now.AddMinutes(5);
            PSCloudPool pool = client.ListPools(options).First();
            while (pool.CloudServiceConfiguration.CurrentOSVersion != pool.CloudServiceConfiguration.TargetOSVersion)
            {
                if (DateTime.Now > timeout)
                {
                    throw new TimeoutException("Timed out waiting for active state pool");
                }
                Sleep(5000);
                pool = client.ListPools(options).First();
            }

            return pool.CloudServiceConfiguration.TargetOSVersion;
        }
开发者ID:brnleehng,项目名称:azure-powershell,代码行数:23,代码来源:ScenarioTestHelpers.cs

示例9: CreateMpiPoolIfNotExists

        /// <summary>
        /// Creates an MPI pool.
        /// </summary>
        public static void CreateMpiPoolIfNotExists(BatchController controller, BatchAccountContext context, int targetDedicated = 3)
        {
            BatchClient client = new BatchClient(controller.BatchManagementClient, controller.ResourceManagementClient);
            ListPoolOptions listOptions = new ListPoolOptions(context)
            {
                PoolId = MpiPoolId
            };

            try
            {
                client.ListPools(listOptions);
                return; // The call returned without throwing an exception, so the pool exists
            }
            catch (BatchException ex)
            {
                if (ex.RequestInformation == null || ex.RequestInformation.BatchError == null ||
                    ex.RequestInformation.BatchError.Code != BatchErrorCodeStrings.PoolNotFound)
                {
                    throw;
                }
                // We got the pool not found error, so continue and create the pool
            }

            CreateTestPool(controller, context, MpiPoolId, targetDedicated);
        }
开发者ID:brnleehng,项目名称:azure-powershell,代码行数:28,代码来源:ScenarioTestHelpers.cs


注:本文中的Microsoft.Azure.Commands.Batch.Models.BatchClient.ListPools方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。