Пример #1
0
        private async Task <IEnumerable <RunActorParam> > PrepareMultiAnswerValidatorRunParamsAsync()
        {
            var meta = await InitialBlobs.FindSingleBlob("limit.json").ReadAsJsonAsync <Limitations>(this);

            var ret    = new List <RunActorParam>();
            var actors = StartedActors.Where(x => x.Name == "HackRunActor" && x.Stage == "GenerateHackeeAnswer");

            foreach (var x in actors)
            {
                var runner = await x.Outputs
                             .FindSingleBlob("runner.json")
                             .ReadAsJsonAsync <RunnerReturn>(this);

                var validator = InitialBlobs.Single(y => y.Name.StartsWith("Validator"));

                if (runner.ExitCode == 0 && !runner.IsTimeout && runner.PeakMemory <= meta.Memory)
                {
                    var output = x.Outputs.FindSingleBlob("stdout.txt");
                    ret.Add(new RunActorParam("CompareActor", new BlobInfo[]
                    {
                        new BlobInfo(output.Id, "out.txt"),
                        InitialBlobs.FindSingleBlob("std.txt"),
                        validator,
                        InitialBlobs.FindSingleBlob("limit.json")
                    }, x.Tag));
                }
            }

            return(ret);
        }
Пример #2
0
        private async Task <bool> IsAllStandardSucceededAsync()
        {
            var meta = await InitialBlobs.FindSingleBlob("limit.json").ReadAsJsonAsync <Limitations>(this);

            var runners = StartedActors
                          .Where(x => x.Tag == "Standard")
                          .SelectMany(x => x.Outputs)
                          .Where(x => x.Name == "runner.json")
                          .ToList();

            foreach (var x in runners)
            {
                var runner = await x.ReadAsJsonAsync <RunnerReturn>(this);

                if (runner.ExitCode == 0 && !runner.IsTimeout && !runner.IsOOM && runner.PeakMemory <= meta.Memory)
                {
                    continue;
                }
                return(false);
            }

            return(true);
        }