Exemplo n.º 1
0
        private async Task SubmitPipelineJob(InferenceRequest inferenceRequest, IEnumerable <InstanceStorageInfo> instances, CancellationToken cancellationToken)
        {
            Guard.Against.Null(inferenceRequest, nameof(inferenceRequest));

            if (instances.IsNullOrEmpty())
            {
                throw new ArgumentNullException("no instances found.", nameof(instances));
            }

            _logger.Log(LogLevel.Information, $"Queuing a new job '{inferenceRequest.JobName}' with pipeline '{inferenceRequest.Algorithm.PipelineId}', priority={inferenceRequest.ClaraJobPriority}, instance count={instances.Count()}");
            await _jobStore.Add(
                new Job
            {
                JobId     = inferenceRequest.JobId,
                PayloadId = inferenceRequest.PayloadId
            }, inferenceRequest.JobName, instances.ToList());
        }
Exemplo n.º 2
0
        protected async Task SubmitPipelineJob(string jobName, string pipelineId, JobPriority jobPriority, string basePath, IList <InstanceStorageInfo> instances)
        {
            Guard.Against.NullOrWhiteSpace(pipelineId, nameof(pipelineId));
            if (instances.IsNullOrEmpty())
            {
                throw new ArgumentNullException(nameof(instances));
            }

            jobName = jobName.FixJobName();
            Guard.Against.NullOrWhiteSpace(jobName, nameof(jobName));

            _logger.Log(LogLevel.Information, "Queueing a new job '{0}' with pipeline '{1}', priority={2}, instance count={3}", jobName, pipelineId, jobPriority, instances.Count);

            var job = await _jobsApi.Create(pipelineId, jobName, jobPriority);

            using (_logger.BeginScope(new Dictionary <string, object> {
                { "JobId", job.JobId }, { "PayloadId", job.PayloadId }
            }))
            {
                await _jobStore.Add(job, jobName, instances);
            }
        }