Пример #1
0
            private QPool CreatePool(CreateConfiguration config, QarnotSDK.Connection connect, CancellationToken ct)
            {
                QarnotSDK.QPool pool = new QarnotSDK.QPool(connect, config.Name, config.Profile, config.InstanceCount, config.Shortname, config.TasksDefaultWaitForPoolResourcesSynchronization);

                pool.SetTags(config.Tags.ToArray());

                pool.Resources = this.Tools.CreateResources(config.Resources, connect, ct);

                foreach (var item in this.Tools.CreateConstants(config.Constants))
                {
                    pool.SetConstant(item.Key, item.Value);
                }

                foreach (var item in this.Tools.CreateConstraints(config.Constraints))
                {
                    pool.SetConstraint(item.Key, item.Value);
                }

                foreach (var item in this.Tools.CreateLabels(config.Labels))
                {
                    pool.SetLabel(item.Key, item.Value);
                }

                pool.IsElastic = config.IsElastic;
                pool.ElasticMinimumTotalNodes  = config.ElasticMinimumTotalNodes == default(int) ? pool.ElasticMinimumTotalNodes : config.ElasticMinimumTotalNodes;
                pool.ElasticMaximumTotalNodes  = config.ElasticMaximumTotalNodes == default(int) ? pool.ElasticMaximumTotalNodes : config.ElasticMaximumTotalNodes;
                pool.ElasticMinimumIdlingNodes = config.ElasticMinimumIdlingNodes == default(int) ? pool.ElasticMinimumIdlingNodes : config.ElasticMinimumIdlingNodes;
                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;

                CLILogs.Info("create pool");
                return(pool);
            }
Пример #2
0
            private QPool CreatePool(CreateConfiguration config, QarnotSDK.Connection connect, CancellationToken ct)
            {
                QarnotSDK.QPool pool = new QarnotSDK.QPool(connect, config.Name, config.Profile, config.InstanceCount, config.Shortname, config.TasksDefaultWaitForPoolResourcesSynchronization);

                pool.SetTags(config.Tags.ToArray());

                pool.Resources = this.Tools.CreateResources(config.Resources, connect, ct);

                foreach (var item in this.Tools.CreateConstants(config.Constants))
                {
                    pool.SetConstant(item.Key, item.Value);
                }

                foreach (var item in this.Tools.CreateConstraints(config.Constraints))
                {
                    pool.SetConstraint(item.Key, item.Value);
                }

                foreach (var item in this.Tools.CreateLabels(config.Labels))
                {
                    pool.SetLabel(item.Key, item.Value);
                }

                pool.IsElastic = config.IsElastic;
                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;

                if (config.ExportApiAndStorageCredentialsInEnvironment.HasValue)
                {
                    pool.Privileges.ExportApiAndStorageCredentialsInEnvironment = config.ExportApiAndStorageCredentialsInEnvironment.Value;
                }

                if (config.DefaultResourcesCacheTTLSec.HasValue)
                {
                    pool.DefaultResourcesCacheTTLSec = config.DefaultResourcesCacheTTLSec.Value;
                }

                CLILogs.Info("create pool");
                return(pool);
            }