@ -58,10 +58,27 @@ Commands from worker to broker:
## Worker - File Server communication
## Worker - File Server communication
**TODO:**
## Broker - Monitor communication
## Broker - Monitor communication
Broker communicates with monitor also through ZeroMQ over TCP protocol. Type of socket is same on both sides, ROUTER. Monitor is set as server in this communication, it's IP address and port are configurable in monitor's config file. ZeroMQ socket ID (set on monitor's side) is "recodex-monitor" and must be sent as first frame of every multipart message - see ZeroMQ ROUTER socket documentation for more info.
Monitor is treated somehow as optional part of whole solution, so no special effort on communication realibility was made.
Commands from monitor to broker:
There are none commands yet. Any message from monitor to broker is logged and discarded.
Commands from broker to monitor:
- **progress** - notification about progress with job evaluation. See [[Communication#progress-callback]] for more info.
## Broker - Frontend communication
## Broker - Frontend communication
**TODO: review**
The communication between the frontend and the workers is mediated by a broker
The communication between the frontend and the workers is mediated by a broker
that passes jobs to workers capable of processing them.
that passes jobs to workers capable of processing them.
@ -93,8 +110,24 @@ processes the request. This issue remains to be resolved.
## File Server - Frontend communication
## File Server - Frontend communication
**TODO:**
## Monitor - Browser communication
## Monitor - Browser communication
Monitor interacts with browser through WebSocket connection. Monitor acts as server and browsers are connecting to it. IP address and port are also configurable. When client connects to the monitor, it sends a message with string representation of channel id (which messages are interested in, usually id of evaluating job). There can be at most one listener per channel, latter connection replaces previous one. After establishing the connection, the message "Connection established" is sent from monitor to browser.
When monitor receives "progress" message from broker there are two options:
- there is no WebSocket connection for listed channel (job id) - message is dropped
- there is active WebSocket connection for listed channel - message is parsed into JSON format (see below) and send as string to browser. Messages for active connections are queued, so no messages are discarded even on heavy workload.
Message JSON format is dictionary with keys:
- **command** - type of progress. One of "STARTED" (evaluation started), "DOWNLOADED" (submission source downloaded), "TASK" (progress on one of the tasks), "UPLOADED" (results are uploaded), "ENDED" (evaluation ended)
- **task_id** - id of currently evaluated task. Present only if **command** is "TASK".
- **task_state** - state of task with id **task_id**. Present only if **command** is "TASK".