Browse Source

Print more debug logs in judger.js

pull/6/head
Menci 6 years ago
parent
commit
7fed7b9d72
  1. 12
      libs/judger.js

12
libs/judger.js

@ -66,7 +66,7 @@ async function connect() {
waitingForTask = true; waitingForTask = true;
winston.verbose(`Judge client ${socket.id} emitted waitForTask.`); winston.warn(`Judge client ${socket.id} emitted waitForTask.`);
// Poll the judge queue, timeout = 10s. // Poll the judge queue, timeout = 10s.
let obj; let obj;
@ -80,9 +80,11 @@ async function connect() {
return; return;
} }
winston.warn(`Judge task ${obj.data.content.taskId} poped from queue.`);
// Re-push to queue if got task but judge client already disconnected. // Re-push to queue if got task but judge client already disconnected.
if (socket.disconnected) { if (socket.disconnected) {
winston.warn(`Judge client ${socket.id} got task but disconnected re-pushing task to queue.`); winston.warn(`Judge client ${socket.id} got task but disconnected re-pushing task ${obj.data.content.taskId} to queue.`);
judgeQueue.push(obj.data, obj.priority); judgeQueue.push(obj.data, obj.priority);
return; return;
} }
@ -90,10 +92,10 @@ async function connect() {
// Send task to judge client, and wait for ack. // Send task to judge client, and wait for ack.
const task = obj.data; const task = obj.data;
pendingAckTaskObj = obj; pendingAckTaskObj = obj;
winston.verbose(`Sending task ${task.content.taskId} to judge client ${socket.id}.`); winston.warn(`Sending task ${task.content.taskId} to judge client ${socket.id}.`);
socket.emit('onTask', msgPack.encode(task), () => { socket.emit('onTask', msgPack.encode(task), () => {
// Acked. // Acked.
winston.verbose(`Judge client ${socket.id} acked task ${task.content.taskId}.`); winston.warn(`Judge client ${socket.id} acked task ${task.content.taskId}.`);
pendingAckTaskObj = null; pendingAckTaskObj = null;
waitingForTask = false; waitingForTask = false;
}); });
@ -232,6 +234,8 @@ module.exports.judge = async function (judge_state, problem, priority) {
content: content, content: content,
extraData: extraData extraData: extraData
}, priority); }, priority);
winston.warn(`Judge task ${content.taskId} enqueued.`);
} }
module.exports.getCachedJudgeState = taskId => judgeStateCache.get(taskId); module.exports.getCachedJudgeState = taskId => judgeStateCache.get(taskId);

Loading…
Cancel
Save