You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
As vanilla WebSocket is so bad to use in TypeScript, I think we should not actually use it.
To solve this, I now have two solutions. Which I personally prefer the second one.
Use node.js to develop the Judger instead of rust.
We can then use Socket.io, which makes the Judge Leader's development much easier, and the code look way much better because we've already used Socket.io between the Judge Leader and the Judger port, it's odd to have both Socket.io and Vanilla WebSocket together.
The bad thing about this solution is that the Judger might be a little bit harder to write because both the Judger Core and the Sandbox are written in Rust.
Use HTTP. CURRENT ARCH
We can set up an HTTP server on the judger.
Here is the way.
Judger initialization: POST requests the Judge Leader's /api/judger, send its max judging max thread and server port.
{
"max_thread": 4,
"port": 4000
}
The Judge Leader keeps the status of all the Judgers' statuses.
When the Judge Leader receives a task, it'll find randomly find an available Judger and send the task to it using POST the Judger's /api/task, send:
Problem ID
URL to the test data in a Data Server
Code language
Time and memory limit
The code
When done, the Judger sends DELET to the Judge Leader's /api/task to finish the task.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
As vanilla WebSocket is so bad to use in TypeScript, I think we should not actually use it.
To solve this, I now have two solutions. Which I personally prefer the second one.
Use node.js to develop the Judger instead of rust.
Socket.io
, which makes the Judge Leader's development much easier, and the code look way much better because we've already usedSocket.io
between the Judge Leader and the Judger port, it's odd to have bothSocket.io
and Vanilla WebSocket together.Use HTTP. CURRENT ARCH
We can set up an HTTP server on the judger.
Here is the way.
POST
requests the Judge Leader's/api/judger
, send its max judging max thread and server port.POST
the Judger's/api/task
, send:DELET
to the Judge Leader's/api/task
to finish the task.I personally prefer the second solution.
Beta Was this translation helpful? Give feedback.
All reactions