Beispiel #1
0
        public async Task <ExecuteJobResponse> ExecuteJob(
            ExecuteJobRequestBody request
            )
        {
            int jobIndex = GenerateNextJobIndex();

            string tag = $"antling-job-{jobIndex}";

            string buildLog = await imageBuilder.Build(request.Image, tag);

            // TODO: run a container with the image
            string containerLog = await docker.Run(new DockerRunOptions {
                Image = tag,
                Rm    = true,
                Name  = $"antling_job_container_{jobIndex}"
            });

            // TODO: enforce time constraints

            // TODO: extract results from the container

            // TODO: destroy the container

            await docker.Rmi(tag);

            return(new ExecuteJobResponse {
                ImageBuildLog = buildLog,
                ContainerLog = containerLog,
                Results = null
            });
        }
        public Image FindImage(int imageId)
        {
            var image = imagesRepository
                        .Query()
                        .FirstOrDefault(i => i.ImageId == imageId);

            if (image == null)
            {
                return(null);
            }
            return(imageBuilder.Build(image));
        }
Beispiel #3
0
        private void Run(Options options)
        {
            var boringWords = FormBoringWords(options.FileWithBoringWords);

            filter.UserExcludedWords = boringWords;
            var words = FormWordsFromFile(options.InputFile)
                        .MostCommon(30)
                        .Select(kvp => kvp.Item1)
                        .ToArray();

            var tags   = FormTags(words, options.FontName);
            var bitmap = tagCloudImageCreator.Build(options.FontName, tags, layoutAlgorithm.GetLayoutSize());

            imageSaver.Save(options.OutputFile, bitmap, options.ImageFormat);
        }
Beispiel #4
0
        public void Run(Options options)
        {
            FormBoringWords(options.FileWithBoringWords, readerFinder, filter)
            .Then(words => filter.UserExcludedWords = words)
            .OnFail(HandleError);
            var rightWords = FormWords(options.InputFile, readerFinder, filter)
                             .Then(words => words.MostCommon(30)
                                   .Select(kvp => kvp.Element)
                                   .ToArray())
                             .OnFail(HandleError);

            GetBaseFont(options.FontName)
            .Then(font => FormTags(rightWords.Value, font))
            .Then(tags => tagCloudImageBuilder.Build(tags, layoutAlgorithm.GetLayoutSize()))
            .Then(bitmap => imageSaver.Save(options.OutputFile, bitmap, options.ImageFormat))
            .OnFail(HandleError);
        }