Beispiel #1
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
            });
        }
Beispiel #2
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
            });
        }