コード例 #1
0
        public async Task <List <QarnotSDK.QJob> > RetrieveAsync(IConfiguration configuration, QarnotSDK.Connection connection, CancellationToken ct)
        {
            DefaultRunConfiguration config = configuration as DefaultRunConfiguration;

            QarnotSDK.QJob job     = null;
            List <QJob>    listJob = null;

            if (!string.IsNullOrEmpty(config.Name))
            {
                CLILogs.Debug("Retrieve QJobs by name : " + config.Name);
                QDataDetail <QJob> level = new QDataDetail <QJob>()
                {
                    Filter = QFilter <QJob> .Eq(t => t.Name, config.Name),
                };
                listJob = await connection.RetrieveJobsAsync(level, cancellationToken : ct);
            }
            else if (!string.IsNullOrEmpty(config.Id))
            {
                CLILogs.Debug("Retrieve QJob by Uuid : " + config.Id);
                job = await connection.RetrieveJobByUuidAsync(config.Id, cancellationToken : ct);
            }
            else
            {
                CLILogs.Debug("Retrieve all the QJobs");
                listJob = await connection.RetrieveJobsAsync(cancellationToken : ct);
            }

            return(listJob ?? new List <QJob>()
            {
                job
            });
        }
コード例 #2
0
ファイル: OptionConverter.cs プロジェクト: qarnot/qarnot-cli
        public DefaultRunConfiguration ConvertGenericGetterOption(ConfigType type, CommandApi command, Options.IGetOptions option)
        {
            DefaultRunConfiguration config = new DefaultRunConfiguration(type, command);

            config = SetDefaultRunConfigurationOption(config, type, command, option);
            return(config);
        }
コード例 #3
0
ファイル: OptionConverter.cs プロジェクト: qarnot/qarnot-cli
        public DefaultRunConfiguration ConvertAllGetterOption(ConfigType type, Options.AllObjectsOptions option)
        {
            ConfigGetGlobalOptions(option);
            CommandApi command = CommandApi.List;

            if (option.Delete)
            {
                command = CommandApi.Delete;
            }
            else if (option.Abort)
            {
                command = CommandApi.Abort;
            }
            else if (option.List)
            {
                command = CommandApi.List;
            }

            DefaultRunConfiguration config = new DefaultRunConfiguration(type, command);

            GetDefaultOptions(config, option);

            ConfigPrintInformation(option, type, Enum.GetName(typeof(CommandApi), command));
            return(config);
        }
コード例 #4
0
        public async Task <List <QarnotSDK.QTask> > RetrieveAsync(IConfiguration configuration, QarnotSDK.Connection connection, CancellationToken ct)
        {
            DefaultRunConfiguration config = configuration as DefaultRunConfiguration;

            QarnotSDK.QTask task     = null;
            List <QTask>    listTask = null;

            if (!string.IsNullOrEmpty(config.Name))
            {
                CLILogs.Debug("Retrieve QTasks by Name : " + config.Name);
                task = await connection.RetrieveTaskByNameAsync(config.Name, cancellationToken : ct);
            }
            else if (!string.IsNullOrEmpty(config.Id))
            {
                CLILogs.Debug("Retrieve QTask by Uuid : " + config.Id);
                task = await connection.RetrieveTaskByUuidAsync(config.Id, cancellationToken : ct);
            }
            else if (config.Tags != null && config.Tags.Count > 0)
            {
                if (config.TagsIntersect)
                {
                    var taskTagFilter = new QDataDetail <QTask>();
                    var filterList    = config.Tags.Select(tag => QFilter <QTask> .Contains(t => t.Tags, tag));
                    taskTagFilter.Filter = QFilter <QTask> .And(filterList.ToArray());

                    listTask = await connection.RetrieveTasksAsync(taskTagFilter, cancellationToken : ct);
                }
                else
                {
                    CLILogs.Debug("Retrieve QTasks by Tags : " + config.Tags.ToString());
                    listTask = await connection.RetrieveTasksByTagsAsync(config.Tags, cancellationToken : ct);
                }
            }
            else
            {
                CLILogs.Debug("Retrieve all the QTasks");
                listTask = await connection.RetrieveTasksAsync(cancellationToken : ct);
            }

            return(listTask ?? new List <QTask>()
            {
                task
            });
        }
コード例 #5
0
        public async Task <List <QarnotSDK.QPool> > RetrieveAsync(IConfiguration configuration, QarnotSDK.Connection connection, CancellationToken ct)
        {
            DefaultRunConfiguration config = configuration as DefaultRunConfiguration;

            QarnotSDK.QPool pool     = null;
            List <QPool>    listPool = null;

            if (!string.IsNullOrEmpty(config.Name))
            {
                CLILogs.Debug("Retrieve QPools by name : " + config.Name);
                pool = await connection.RetrievePoolByNameAsync(config.Name, cancellationToken : ct);
            }
            else if (!string.IsNullOrEmpty(config.Id))
            {
                CLILogs.Debug("Retrieve QPool by Uuid : " + config.Id);
                pool = await connection.RetrievePoolByUuidAsync(config.Id, cancellationToken : ct);
            }
            else if (config.Tags != null && config.Tags.Count > 0)
            {
                if (config.TagsIntersect)
                {
                    CLILogs.Debug("Retrieve QPools by Tags Intersect : " + config.Tags.ToString());
                    var poolTagFilter = new QDataDetail <QPool>();
                    var filterList    = config.Tags.Select(tag => QFilter <QPool> .Contains(t => t.Tags, tag));
                    listPool = await connection.RetrievePoolsAsync(poolTagFilter, cancellationToken : ct);
                }
                else
                {
                    CLILogs.Debug("Retrieve QPools by Tags : " + config.Tags.ToString());
                    listPool = await connection.RetrievePoolsByTagsAsync(config.Tags, cancellationToken : ct);
                }
            }
            else
            {
                CLILogs.Debug("Retrieve all the QPools");
                listPool = await connection.RetrievePoolsAsync(cancellationToken : ct);
            }

            return(listPool ?? new List <QPool>()
            {
                pool
            });
        }
コード例 #6
0
ファイル: OptionConverter.cs プロジェクト: qarnot/qarnot-cli
        private DefaultRunConfiguration SetDefaultRunConfigurationOption(DefaultRunConfiguration config, ConfigType type, CommandApi command, Options.IGetOptions option)
        {
            GetDefaultOptions(config, option);

            ConfigGetGlobalOptions(option);
            ConfigPrintInformation(option, type, Enum.GetName(typeof(CommandApi), command));
            config.Name      = option.Name;
            config.Id        = option.Id;
            config.Summaries = false;

            if (option.TagsIntersect != null && option.TagsIntersect.Count() > 0)
            {
                config.Tags          = option.TagsIntersect?.ToList();
                config.TagsIntersect = true;
            }
            else
            {
                config.Tags = option.Tags?.ToList();
            }

            return(config);
        }