Ejemplo n.º 1
0
        public async Task PushSolutionJudge(int solutionId)
        {
            SolutionPushModel pushModel = await _db.Solutions
                                          .ProjectTo <SolutionPushModel>()
                                          .FirstOrDefaultAsync(x => x.Id == solutionId);

            JudgeHub.Judge(pushModel);
        }
Ejemplo n.º 2
0
        internal static void Judge(SolutionPushModel model)
        {
            var signalr = GlobalHost.ConnectionManager.GetHubContext <JudgeHub>();

            signalr.Clients
            //.Group(model.QuestionCreateUserId.ToStringInvariant())
            .All
            .Judge(model);
        }
Ejemplo n.º 3
0
 public static JudgeDriver Create(SolutionPushModel spush)
 {
     if (spush.QuestionType == QuestionTypes.DataDrive)
     {
         return(new DataDriveJudger(spush));
     }
     else if (spush.QuestionType == QuestionTypes.Process2Drive)
     {
         return(new Process2DriveJudger(spush));
     }
     else
     {
         return(new NothingJudgeDriver(spush));
     }
 }
Ejemplo n.º 4
0
        public void AddOne(SolutionPushModel model)
        {
            if (model == null)
            {
                throw new ArgumentNullException();
            }

            if (_queue.Any(x => x.Id == model.Id))
            {
                return;
            }
            _log.InfoExt(() => string.Format("Recieved Id {0}, {1}, Memory {2}MB", model.Id, model.Language, model.FullMemoryLimitMb));
            _queue.Add(model);

            if (_task == null)
            {
                _task = Task.Run(() => Loop());
            }
        }
Ejemplo n.º 5
0
        private bool PrecheckEnvironment(SolutionPushModel _spush)
        {
            if (!CompilerProvider.IsLanguageAvailable(_spush))
            {
                _log.InfoExt(() => string.Format("Skipped compiling {0}, Because {1} compiler is not availabel.",
                                                 _spush.Id, _spush.Language));
                return(false);
            }
            var info = new ComputerInfo();

            if (info.AvailablePhysicalMemory < _spush.FullMemoryLimitMb * 1024 * 1024)
            {
                _log.InfoExt(
                    () =>
                    string.Format("Skipped judging {0}, because system memory running low(Req {1}/ Need {2}).",
                                  _spush.Id, info.AvailablePhysicalMemory, _spush.FullMemoryLimitMb * 1024 * 1024)
                    );
                return(false);
            }
            return(true);
        }
Ejemplo n.º 6
0
 public NothingJudgeDriver(SolutionPushModel spush)
 {
     _spush = spush;
 }
Ejemplo n.º 7
0
 public DataDriveJudger(SolutionPushModel spush)
 {
     _log    = LogManager.GetLogger(typeof(JudgeProcess));
     _client = App.Starter.GetClient();
     _spush  = spush;
 }
Ejemplo n.º 8
0
Archivo: Starter.cs Proyecto: sdcb/sdoj
        // Details

        private void OnClientJudge(SolutionPushModel model)
        {
            _judger.AddOne(model);
        }
Ejemplo n.º 9
0
 public Process2DriveJudger(SolutionPushModel spush) : base()
 {
     _log    = LogManager.GetLogger(GetType());
     _client = App.Starter.GetClient();
     _spush  = spush;
 }