public async Task ExecuteAsync(RestartPool command, CancellationToken cancellationToken) { if (await _pools.IsActive(command.PoolId)) { _terminal.Write($"{command.PoolId}, pool started, stopping and deleting pool..."); await _pools.StopPoolAsync(command.PoolId); await _pools.DeletePoolAsync(command.PoolId); _terminal.Write("pool removed"); } _terminal.Write($"{command.PoolId}, starting pool"); var request = new StartPoolRequest( isServiceStateful: command.IsServiceStateful, hasPersistedState: command.HasPersistedState, minReplicas: command.MinReplicas, targetReplicas: command.TargetReplicas, partitionScheme: command.PartitionScheme, maxPoolSize: command.MaxPoolSize, idleServicesPoolSize: command.IdleServicesPoolSize, servicesAllocationBlockSize: command.ServicesAllocationBlockSize, expirationQuanta: TimeSpan.FromMinutes(command.ExpirationQuanta) ); await _pools.StartPoolAsync(command.PoolId, request); _terminal.Write($"{command.PoolId}, pool started. pausing for service creation"); _terminal.Write($"{command.PoolId}, pool ready."); }
static async Task ResetPool(IPoolProxy pools) { WriteConsole("Removing old pool"); await pools.StopPoolAsync(NoOpServiceTypeUri); await pools.DeletePoolAsync(NoOpServiceTypeUri); WriteConsole("Registering Service with Pool Manager..."); var request = new StartPoolRequest( isServiceStateful: true, hasPersistedState: true, minReplicas: 1, targetReplicas: 3, partitionScheme: SDK.PartitionSchemeDescription.Singleton, maxPoolSize: 20, idleServicesPoolSize: 5, servicesAllocationBlockSize: 2, expirationQuanta: TimeSpan.FromMinutes(1) ); await pools.StartPoolAsync(NoOpServiceTypeUri, request); WriteConsole("Registration Completed"); }