private async Task <QTask> CreateTask(CreateConfiguration config, QarnotSDK.Connection connect, CancellationToken ct) { QarnotSDK.QTask task = null; if (config.InstanceCount > 0) { task = await this.CreateInstanceTaskAsync(config, connect); } else { task = await this.CreateRangeTaskAsync(config, connect); } task.SetTags(config.Tags.ToArray()); task.Resources = this.Tools.CreateResources(config.Resources, connect, ct); task.Results = this.Tools.CreateResult(config.Result, connect, ct); this.Tools.CreateConstants(config.Constants).ToList().ForEach(item => task.SetConstant(item.Key, item.Value)); foreach (var item in this.Tools.CreateConstraints(config.Constraints)) { task.SetConstraint(item.Key, item.Value); } foreach (var item in this.Tools.CreateLabels(config.Labels)) { task.SetLabel(item.Key, item.Value); } task.SetTaskDependencies(config.Dependents.Select(id => new Guid(id)).ToArray()); task.ResultsWhitelist = config.Whitelist; task.ResultsBlacklist = config.Blacklist; if (config.MaxRetriesPerInstance.HasValue) { task.MaxRetriesPerInstance = config.MaxRetriesPerInstance.Value; } if (config.ExportApiAndStorageCredentialsInEnvironment.HasValue) { task.Privileges.ExportApiAndStorageCredentialsInEnvironment = config.ExportApiAndStorageCredentialsInEnvironment.Value; } if (config.DefaultResourcesCacheTTLSec.HasValue) { task.DefaultResourcesCacheTTLSec = config.DefaultResourcesCacheTTLSec.Value; } CLILogs.Info("create task"); return(task); }
private async Task <QTask> CreateTask(CreateConfiguration config, QarnotSDK.Connection connect, CancellationToken ct) { QarnotSDK.QTask task = null; if (config.InstanceCount > 0) { task = await this.CreateInstanceTaskAsync(config, connect); } else { task = await this.CreateRangeTaskAsync(config, connect); } task.SetTags(config.Tags.ToArray()); task.Resources = this.Tools.CreateResources(config.Resources, connect, ct); task.Results = this.Tools.CreateResult(config.Result, connect, ct); this.Tools.CreateConstants(config.Constants).ToList().ForEach(item => task.SetConstant(item.Key, item.Value)); foreach (var item in this.Tools.CreateConstraints(config.Constraints)) { task.SetConstraint(item.Key, item.Value); } foreach (var item in this.Tools.CreateLabels(config.Labels)) { task.SetLabel(item.Key, item.Value); } task.SetTaskDependencies(config.Dependents.Select(id => new Guid(id)).ToArray()); task.ResultsWhitelist = config.Whitelist; task.ResultsBlacklist = config.Blacklist; CLILogs.Info("create task"); return(task); }