Commit 866f2338 authored by Millian Poquet's avatar Millian Poquet
Browse files

[doc] protocol

parent 9cbf589b
...@@ -131,15 +131,32 @@ Any custom information can be added into the ...@@ -131,15 +131,32 @@ Any custom information can be added into the
[Batsim configuration](./configuration.md), which gives a generic way to give [Batsim configuration](./configuration.md), which gives a generic way to give
metainformation from Batsim to any scheduler at runtime. metainformation from Batsim to any scheduler at runtime.
- **data**: the number of resources - **data**:
- **nb_resources**: the number of resources
- **allow_time_sharing**: whether time sharing is enabled or not
- **config**: the Batsim configuration
- **resources_data**: information about the resources
- **id**: unique resource number
- **name**: resource name
- **state**: resource state in {sleeping, idle, computing, switching_on, switching_off}
- **properties**: the properties specified in the SimGrid platform for the corresponding host
- **example**: - **example**:
```json ```json
{ {
"timestamp": 0.0, "timestamp": 0.0,
"type": "SIMULATION_BEGINS", "type": "SIMULATION_BEGINS",
"data": { "data": {
"nb_resources": 60, "allow_time_sharing": false,
"config":{} "nb_resources": 1,
"config": {},
"resources_data": [
{
"id": 0,
"name": "host0",
"state": "idle",
"properties": {}
}
]
} }
} }
``` ```
...@@ -235,13 +252,22 @@ A job has completed its execution. It acknowledges that the actions coming ...@@ -235,13 +252,22 @@ A job has completed its execution. It acknowledges that the actions coming
from a previous [EXECUTE_JOB](#execute_job) message have been done (successfully from a previous [EXECUTE_JOB](#execute_job) message have been done (successfully
or not, depending on whether the job completed without reaching timeout). or not, depending on whether the job completed without reaching timeout).
- **data**: a job id string with a status string (TIMEOUT, SUCCESS) - **data**:
- **job_id**: the job unique identifier
- **status**: whether SUCCESS or TIMEOUT
- **job_state**: the job state
- **kill_reason**: the kill reason (if any)
- **example**: - **example**:
```json ```json
{ {
"timestamp": 10.0, "timestamp": 10.0,
"type": "JOB_COMPLETED", "type": "JOB_COMPLETED",
"data": {"job_id": "w0!1", "status": "SUCCESS"} "data": {
"job_id": "w0!1",
"status": "SUCCESS",
"job_state": "COMPLETED_KILLED",
"kill_reason": "Walltime reached"
}
} }
``` ```
...@@ -479,11 +505,17 @@ Sets some resources into a state. ...@@ -479,11 +505,17 @@ Sets some resources into a state.
``` ```
### NOTIFY ### NOTIFY
The scheduler notify Batsim of something. For example, that job submission The scheduler notifies Batsim of something.
from the scheduler is over, so Batsim is able to stop the simulation. This
message **must** be sent if ``"scheduler_submission": {"enabled": false}`` For example, the ``submission_finished`` notifies that job submissions
from the scheduler are over, which allows Batsim to stop the simulation.
This message **must** be sent if ``"scheduler_submission": {"enabled": false}``
is configured. See [Configuration documentation](./configuration.md) for more is configured. See [Configuration documentation](./configuration.md) for more
details. details.
If the scheduler realizes that it commited the mistake of notifying
``submission_finished`` prematurely, the ``continue_submission`` notification
can be sent to make the scheduler able to submit dynamic jobs again.
- **data**: empty - **data**: empty
- **example**: - **example**:
...@@ -495,6 +527,23 @@ details. ...@@ -495,6 +527,23 @@ details.
} }
``` ```
### CHANGE_JOB_STATE
Changes the state of a job, which may be helpful to implement schedulers with
dynamic complex jobs.
``` json
{
"timestamp": 42.0,
"type": "CHANGE_JOB_STATE",
"data": {
"job_id": "w12!45",
"job_state": "COMPLETED_KILLED",
"kill_reason": "Sub-jobs were killed."
}
}
```
# Use cases # Use cases
The way to do some operations with the protocol is shown in this section. The way to do some operations with the protocol is shown in this section.
......
...@@ -51,10 +51,22 @@ void JsonProtocolWriter::append_simulation_begins(Machines & machines, ...@@ -51,10 +51,22 @@ void JsonProtocolWriter::append_simulation_begins(Machines & machines,
bool allow_time_sharing, bool allow_time_sharing,
double date) double date)
{ {
/* { /*{
"timestamp": 0.0, "timestamp": 0.0,
"type": "SIMULATION_BEGINS", "type": "SIMULATION_BEGINS",
"data": {} "data": {
"allow_time_sharing": false,
"nb_resources": 1,
"config": {},
"resources_data": [
{
"id": 0,
"name": "host0",
"state": "idle",
"properties": {}
}
]
}
} */ } */
xbt_assert(date >= _last_date, "Date inconsistency"); xbt_assert(date >= _last_date, "Date inconsistency");
...@@ -205,7 +217,12 @@ void JsonProtocolWriter::append_job_completed(const string & job_id, ...@@ -205,7 +217,12 @@ void JsonProtocolWriter::append_job_completed(const string & job_id,
/* { /* {
"timestamp": 10.0, "timestamp": 10.0,
"type": "JOB_COMPLETED", "type": "JOB_COMPLETED",
"data": {"job_id": "w0!1", "status": "SUCCESS"} "data": {
"job_id": "w0!1",
"status": "SUCCESS",
"job_state": "COMPLETED_KILLED",
"kill_reason": "Walltime reached"
}
} */ } */
xbt_assert(date >= _last_date, "Date inconsistency"); xbt_assert(date >= _last_date, "Date inconsistency");
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment