@ -16,21 +16,31 @@ Communication between the two worker threads is split into two separate parts, e
Main communication is on `inproc://jobs` sockets. _Listening thread_ is waiting for any messages (from broker, jobs and progress sockets) and handle incoming requests properly.
Main communication is on `inproc://jobs` sockets. _Listening thread_ is waiting for any messages (from broker, jobs and progress sockets) and handle incoming requests properly.
Commands from _listening thread_ to _job thread_:
Commands from _listening thread_ to _job thread_:
- **eval** - evaluate a job. Requires 3 arguments:
- **eval** - evaluate a job. Requires 3 arguments:
- `job_id` - identifier of this job
- `job_id` - identifier of this job (in ASCII representation -- we avoid endianness issues and also
support alphabetic ids)
- `job_url` - URI location of archive with job configuration and submitted source code
- `job_url` - URI location of archive with job configuration and submitted source code
- `result_url` - remote URI where results will be pushed to
- `result_url` - remote URI where results will be pushed to
Commands from _job thread_ to _listening thread_:
Commands from _job thread_ to _listening thread_:
- **done** - notifying of finished job. Requires 2 arguments:
- **done** - notifying of finished job. Requires 2 arguments:
- `job_id` - identifier of finished job
- `job_id` - identifier of finished job
- `result` - response result, one of "OK" and "ERR"
- `result` - response result, one of "OK" and "ERR"
Note that we will need to store the job ID and the assignment configuration
somewhere close to the submitted files so it's possible to check how a
submission was evaluated. The job ID will likely be a part of the submission's
path. The configuration could be linked there under some well-known name.
### Progress callback
### Progress callback
Progress messages are sent through `inproc://progress` sockets. This is only one way communication from _job thread_ to the _listening thread_.
Progress messages are sent through `inproc://progress` sockets. This is only one way communication from _job thread_ to the _listening thread_.
Commands:
Commands:
- **progress** - notice about evaluation progress. Requires 2 or 4 arguments:
- **progress** - notice about evaluation progress. Requires 2 or 4 arguments:
- `job_id` - identifier of current job
- `job_id` - identifier of current job
- `state` - what is happening now. One of "DOWNLOADED" (submission successfuly fetched), "UPLOADED" (results are uploaded to fileserver), "STARTED" (evaluation started), "ENDED" (evaluation is finnished) and "TASK" (task state changed - see below)
- `state` - what is happening now. One of "DOWNLOADED" (submission successfuly fetched), "UPLOADED" (results are uploaded to fileserver), "STARTED" (evaluation started), "ENDED" (evaluation is finnished) and "TASK" (task state changed - see below)
@ -43,11 +53,13 @@ Commands:
Broker is server when comminicating with worker. IP address and port are configurable, protocol is TCP. Worker socket is DEALER, broker one is ROUTER type.
Broker is server when comminicating with worker. IP address and port are configurable, protocol is TCP. Worker socket is DEALER, broker one is ROUTER type.
Commands from broker to worker:
Commands from broker to worker:
- **eval** - evaluate a job. See **eval** command in [[Communication#main-communication]].
- **eval** - evaluate a job. See **eval** command in [[Communication#main-communication]]
- **intro** - introduce yourself to the broker (with **init** command)
- **intro** - introduce yourself to the broker (with **init** command)
- **pong** - reply to **ping** command, no arguments
- **pong** - reply to **ping** command, no arguments
Commands from worker to broker:
Commands from worker to broker:
- **init** - introduce yourself to the broker. Useful on startup or after reestablishing lost connection. Requires at least two arguments:
- **init** - introduce yourself to the broker. Useful on startup or after reestablishing lost connection. Requires at least two arguments:
- `hwgroup` - hardware group of this worker
- `hwgroup` - hardware group of this worker
- `header` - additional header describing worker capabilities. Format must be `header_name=value`, every header shall be in a separate message frame. There is no maximum limit on number of headers.
- `header` - additional header describing worker capabilities. Format must be `header_name=value`, every header shall be in a separate message frame. There is no maximum limit on number of headers.
@ -77,36 +89,24 @@ Commands from broker to monitor:
## Broker - Frontend communication
## Broker - Frontend communication
**TODO: review**
Broker communicates with frontend through ZeroMQ connection over TCP. Socket type on broker side is ROUTER, on frontend part it's REQ. Broker has server role, his IP address and port is configurable in frontend.
The communication between the frontend and the workers is mediated by a broker
Commands from frontend to broker:
that passes jobs to workers capable of processing them.
### Assignment evaluation request
- **eval** - evaluate a job. Requires 3 arguments:
- `job_id` - identifier of this job (in ASCII representation -- we avoid endianness issues and also
The frontend must send a multipart message that contains the following frames:
- The `eval` command
- The job id (in ASCII representation -- we avoid endianness issues and also
support alphabetic ids)
support alphabetic ids)
- A frame for each header (e.g. `hwgroup=group_1`)
- `header` - additional header describing worker capabilities. Format must be `header_name=value`, every header shall be in a separate message frame. There is no maximum limit on number of headers.
- An URL of the archive that contains the submitted files and isoeval
- empty frame (with empty string)
configuration
- `job_url` - URI location of archive with job configuration and submitted source code
- An URL where the worker should store the result of the evaluation
- `result_url` - remote URI where results will be pushed to
If the broker is capable of routing the request to a worker, it responds with
`accept`. Otherwise (for example when the requirements specified by the headers
cannot be met), it responds with `reject`.
Note that we will need to store the job ID and the assignment configuration
Commands from broker to frontend (all are responses to **eval** command):
somewhere close to the submitted files so it's possible to check how a
submission was evaluated. The job ID will likely be a part of the submission's
path. The configuration could be linked there under some well-known name.
### Notifying the frontend about evaluation progress
- **accept** - broker is capable of routing request to a worker
- **reject** - broker can't handle this job (for example when the requirements specified by the headers
cannot be met)
The script that requested the evaluation will have exited by the time a worker
processes the request. This issue remains to be resolved.