public async Task PushSolutionJudge(int solutionId) { SolutionPushModel pushModel = await _db.Solutions .ProjectTo <SolutionPushModel>() .FirstOrDefaultAsync(x => x.Id == solutionId); JudgeHub.Judge(pushModel); }
internal static void Judge(SolutionPushModel model) { var signalr = GlobalHost.ConnectionManager.GetHubContext <JudgeHub>(); signalr.Clients //.Group(model.QuestionCreateUserId.ToStringInvariant()) .All .Judge(model); }
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)); } }
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()); } }
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); }
public NothingJudgeDriver(SolutionPushModel spush) { _spush = spush; }
public DataDriveJudger(SolutionPushModel spush) { _log = LogManager.GetLogger(typeof(JudgeProcess)); _client = App.Starter.GetClient(); _spush = spush; }
// Details private void OnClientJudge(SolutionPushModel model) { _judger.AddOne(model); }
public Process2DriveJudger(SolutionPushModel spush) : base() { _log = LogManager.GetLogger(GetType()); _client = App.Starter.GetClient(); _spush = spush; }