Beispiel #1
0
        public virtual async Task <CommandValues.GenericInfoCommandValue> ExecuteAsync(QPool pool, IConfiguration iconfig, CancellationToken ct = default(CancellationToken))
        {
            PoolSetElasticSettingsConfiguration config = iconfig as PoolSetElasticSettingsConfiguration;

            CLILogs.Debug("Command pool : Pool name " + pool?.Name ?? config?.Name);
            CLILogs.Debug("Command pool : Set Pool Elastic info");

            if (pool == default)
            {
                var message = "Elastic settings update failed. Pool not found";
                throw new System.Exception(message);
            }

            pool.ElasticMinimumTotalSlots  = config.ElasticMinimumTotalSlots == default(int) ? pool.ElasticMinimumTotalSlots : config.ElasticMinimumTotalSlots;
            pool.ElasticMaximumTotalSlots  = config.ElasticMaximumTotalSlots == default(int) ? pool.ElasticMaximumTotalSlots : config.ElasticMaximumTotalSlots;
            pool.ElasticMinimumIdlingSlots = config.ElasticMinimumIdlingSlots == default(int) ? pool.ElasticMinimumIdlingSlots : config.ElasticMinimumIdlingSlots;
            pool.ElasticResizePeriod       = config.ElasticResizePeriod == default(int) ? pool.ElasticResizePeriod : config.ElasticResizePeriod;
            pool.ElasticResizeFactor       = config.ElasticResizeFactor == default(int) ? pool.ElasticResizeFactor : config.ElasticResizeFactor;
            pool.ElasticMinimumIdlingTime  = config.ElasticMinimumIdlingTime == default(int) ? pool.ElasticMinimumIdlingTime : config.ElasticMinimumIdlingTime;
            await pool.CommitAsync(ct);

            return(new CommandValues.GenericInfoCommandValue()
            {
                Uuid = pool.Uuid.ToString(),
                Message = "Pool set ",
            });
        }
Beispiel #2
0
        public PoolSetElasticSettingsConfiguration ConvertElasticPoolSetterOption(ConfigType type, CommandApi command, Options.PoolElasticSettingsOptions option)
        {
            PoolSetElasticSettingsConfiguration config = new PoolSetElasticSettingsConfiguration(type, CommandApi.Set);

            SetDefaultRunConfigurationOption(config, type, command, option);

            config.ElasticMinimumTotalSlots  = option.ElasticMinimumTotalSlots;
            config.ElasticMaximumTotalSlots  = option.ElasticMaximumTotalSlots;
            config.ElasticMinimumIdlingSlots = option.ElasticMinimumIdlingSlots;
            config.ElasticResizePeriod       = option.ElasticResizePeriod;
            config.ElasticResizeFactor       = option.ElasticResizeFactor;
            config.ElasticMinimumIdlingTime  = option.ElasticMinimumIdlingTime;
            return(config);
        }