コード例 #1
0
 public async Task CreatePoolAsync(
     string poolId, 
     string virtualMachineSize, 
     int? targetDedicated, 
     string autoScaleFormula, 
     bool communicationEnabled,
     string osFamily,
     string osVersion,
     int maxTasksPerComputeNode,
     TimeSpan? timeout,
     StartTaskOptions startTask)
 {
     await this.Service.CreatePoolAsync(poolId, virtualMachineSize, targetDedicated, autoScaleFormula, communicationEnabled, osFamily, osVersion, maxTasksPerComputeNode, timeout, startTask);
 }
コード例 #2
0
 public async Task CreatePoolAsync(
     string poolId, 
     string virtualMachineSize, 
     int? targetDedicated, 
     string autoScaleFormula, 
     bool communicationEnabled,
     CloudServiceConfigurationOptions cloudServiceConfigurationOptions,
     VirtualMachineConfigurationOptions virtualMachineConfigurationOptions,
     int maxTasksPerComputeNode,
     TimeSpan? timeout,
     StartTaskOptions startTask)
 {
     await this.Service.CreatePoolAsync(
         poolId, 
         virtualMachineSize, 
         targetDedicated, 
         autoScaleFormula, 
         communicationEnabled, 
         cloudServiceConfigurationOptions, 
         virtualMachineConfigurationOptions, 
         maxTasksPerComputeNode, 
         timeout, 
         startTask);
 }
コード例 #3
0
        /// <summary>
        /// Creates a pool.
        /// </summary>
        /// <returns></returns>
        public async Task CreatePoolAsync(
            string poolId, 
            string virtualMachineSize, 
            int? targetDedicated, 
            string autoScaleFormula, 
            bool communicationEnabled,
            CloudServiceConfigurationOptions cloudServiceConfigurationOptions,
            VirtualMachineConfigurationOptions virtualMachineConfigurationOptions,
            int maxTasksPerComputeNode,
            TimeSpan? timeout,
            StartTaskOptions startTask)
        {
            CloudPool unboundPool;

            if (cloudServiceConfigurationOptions != null)
            {
                unboundPool = this.Client.PoolOperations.CreatePool(
                    poolId,
                    virtualMachineSize: virtualMachineSize,
                    cloudServiceConfiguration: new CloudServiceConfiguration(cloudServiceConfigurationOptions.OSFamily, cloudServiceConfigurationOptions.OSVersion),
                    targetDedicated: targetDedicated);
            }
            else if (virtualMachineConfigurationOptions != null)
            {
                unboundPool = this.Client.PoolOperations.CreatePool(
                    poolId,
                    virtualMachineSize: virtualMachineSize,
                    virtualMachineConfiguration: new VirtualMachineConfiguration(
                        new ImageReference(
                            publisher: virtualMachineConfigurationOptions.Publisher,
                            offer: virtualMachineConfigurationOptions.Offer,
                            sku: virtualMachineConfigurationOptions.SkuId,
                            version: virtualMachineConfigurationOptions.Version),
                        virtualMachineConfigurationOptions.NodeAgentSkuId,
                        virtualMachineConfigurationOptions.EnableWindowsAutomaticUpdates.HasValue ? new WindowsConfiguration(virtualMachineConfigurationOptions.EnableWindowsAutomaticUpdates) : null),
                    targetDedicated: targetDedicated);
            }
            else
            {
                throw new ArgumentException("Must set cloudServiceConfiguration or virtualMachineConfiguration");
            }

            unboundPool.InterComputeNodeCommunicationEnabled = communicationEnabled;
            unboundPool.ResizeTimeout = timeout;
            unboundPool.MaxTasksPerComputeNode = maxTasksPerComputeNode;
                
            if (!string.IsNullOrEmpty(autoScaleFormula))
            {
                unboundPool.AutoScaleEnabled = true;
                unboundPool.AutoScaleFormula = autoScaleFormula;
            }

            if (startTask != null)
            {
                unboundPool.StartTask = new StartTask
                {
                    CommandLine = startTask.CommandLine,
                    RunElevated = startTask.RunElevated,
                    ResourceFiles = startTask.ResourceFiles.ConvertAll(f => new ResourceFile(f.BlobSource, f.FilePath)),
                    WaitForSuccess = true,
                };
            }

            await unboundPool.CommitAsync();
        }
コード例 #4
0
        /// <summary>
        /// Creates a pool.
        /// </summary>
        /// <param name="poolId"></param>
        /// <param name="virtualMachineSize"></param>
        /// <param name="targetDedicated"></param>
        /// <param name="autoScaleFormula"></param>
        /// <param name="communicationEnabled"></param>
        /// <param name="osFamily"></param>
        /// <param name="osVersion"></param>
        /// <param name="maxTasksPerComputeNode"></param>
        /// <param name="timeout"></param>
        /// <returns></returns>
        public async Task CreatePoolAsync(
            string poolId, 
            string virtualMachineSize, 
            int? targetDedicated, 
            string autoScaleFormula, 
            bool communicationEnabled,
            string osFamily,
            string osVersion,
            int maxTasksPerComputeNode,
            TimeSpan? timeout,
            StartTaskOptions startTask)
        {
            CloudPool unboundPool = this.Client.PoolOperations.CreatePool(
                poolId, 
                osFamily: osFamily, 
                virtualMachineSize: virtualMachineSize, 
                targetDedicated: targetDedicated);
                    
            unboundPool.TargetOSVersion = osVersion;
            unboundPool.InterComputeNodeCommunicationEnabled = communicationEnabled;
            unboundPool.ResizeTimeout = timeout;
            unboundPool.MaxTasksPerComputeNode = maxTasksPerComputeNode;
                
            if (!string.IsNullOrEmpty(autoScaleFormula))
            {
                unboundPool.AutoScaleEnabled = true;
                unboundPool.AutoScaleFormula = autoScaleFormula;
            }

            if (startTask != null)
            {
                unboundPool.StartTask = new StartTask
                {
                    CommandLine = startTask.CommandLine,
                    RunElevated = startTask.RunElevated,
                    ResourceFiles = startTask.ResourceFiles.ConvertAll(f => new ResourceFile(f.BlobSource, f.FilePath)),
                    WaitForSuccess = true,
                };
            }

            await unboundPool.CommitAsync();
        }