Exemple #1
0
            private async Task <QJob> CreateJobAsync(CreateConfiguration config, QarnotSDK.Connection connect, CancellationToken ct)
            {
                CLILogs.Info("create job");
                QPool pool = null;

                if (!string.IsNullOrEmpty(config.PoolUuidOrShortname))
                {
                    pool = await connect.RetrievePoolByUuidAsync(config.PoolUuidOrShortname, ct);
                }

                QJob job = new QJob(connect, config.Name, pool, config.Shortname, config.IsDependents);

                if (config.MaximumWallTime.HasValue && config.MaximumWallTime.Value != default(TimeSpan))
                {
                    job.MaximumWallTime = config.MaximumWallTime.Value;
                }

                return(job);
            }
Exemple #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
            });
        }