use of top.hcode.hoj.pojo.dto.ToJudgeDTO in project HOJ by HimitZH.
the class Dispatcher method dispatcherJudge.
public CommonResult dispatcherJudge(String type, String path, Object data) {
switch(type) {
case "judge":
ToJudgeDTO judgeData = (ToJudgeDTO) data;
toJudge(path, judgeData, judgeData.getJudge().getSubmitId(), judgeData.getRemoteJudgeProblem() != null);
break;
case "compile":
CompileDTO compileDTO = (CompileDTO) data;
return toCompile(path, compileDTO);
default:
throw new IllegalArgumentException("判题机不支持此调用类型");
}
return null;
}
use of top.hcode.hoj.pojo.dto.ToJudgeDTO in project HOJ by HimitZH.
the class RemoteJudgeReceiver method dispatchRemoteJudge.
private void dispatchRemoteJudge(Judge judge, String token, String remoteJudgeProblem, Boolean isHasSubmitIdRemoteReJudge, String remoteOJName) {
ToJudgeDTO toJudgeDTO = new ToJudgeDTO();
toJudgeDTO.setJudge(judge).setToken(token).setRemoteJudgeProblem(remoteJudgeProblem);
Constants.RemoteOJ remoteOJ = Constants.RemoteOJ.getRemoteOJ(remoteOJName);
if (!checkExistedAccountByOJ(remoteOJ)) {
judge.setStatus(Constants.Judge.STATUS_SYSTEM_ERROR.getStatus());
judge.setErrorMessage("System Error! Cause: The System does not have [" + remoteOJ + "] account configured. " + "Please report the matter to the administrator!");
judgeEntityService.updateById(judge);
} else {
if (remoteOJName.equals(Constants.RemoteOJ.CODEFORCES.getName()) || remoteOJName.equals(Constants.RemoteOJ.GYM.getName())) {
if (ChooseUtils.openCodeforcesFixServer) {
fixServerCFJudge(isHasSubmitIdRemoteReJudge, toJudgeDTO, judge);
} else {
commonJudge(Constants.RemoteOJ.CODEFORCES.getName(), isHasSubmitIdRemoteReJudge, toJudgeDTO, judge);
}
} else if (remoteOJName.equals(Constants.RemoteOJ.POJ.getName())) {
pojJudge(isHasSubmitIdRemoteReJudge, toJudgeDTO, judge);
} else {
commonJudge(remoteOJName, isHasSubmitIdRemoteReJudge, toJudgeDTO, judge);
}
}
// 如果队列中还有任务,则继续处理
processWaitingTask();
}
use of top.hcode.hoj.pojo.dto.ToJudgeDTO in project HOJ by HimitZH.
the class JudgeReceiver method handleJudgeMsg.
@Override
public void handleJudgeMsg(String taskStr, String queueName) {
if (Constants.Queue.TEST_JUDGE_WAITING.getName().equals(queueName)) {
TestJudgeReq testJudgeReq = JSONUtil.toBean(taskStr, TestJudgeReq.class);
dispatcher.dispatcherTestJudge(testJudgeReq, "/test-judge");
} else {
JSONObject task = JSONUtil.parseObj(taskStr);
Judge judge = task.get("judge", Judge.class);
String token = task.getStr("token");
// 调用判题服务
dispatcher.dispatcherJudge("judge", "/judge", new ToJudgeDTO().setJudge(judge).setToken(token).setRemoteJudgeProblem(null));
}
// 接着处理任务
processWaitingTask();
}
Aggregations