Trait batsim::batsim::Scheduler
[−]
[src]
pub trait Scheduler {
fn simulation_begins(&mut self,
timestamp: &f64,
nb_resources: i32,
config: Value)
-> Option<Vec<BatsimEvent>>;
fn on_job_submission(&mut self,
timestamp: &f64,
job: Job,
profile: Option<Profile>)
-> Option<Vec<BatsimEvent>>;
fn on_job_completed(&mut self,
timestamp: &f64,
job_id: String,
status: String)
-> Option<Vec<BatsimEvent>>;
fn on_job_killed(&mut self,
timestamp: &f64,
job_ids: Vec<String>)
-> Option<Vec<BatsimEvent>>;
fn on_message_received_end(&mut self,
timestamp: &mut f64)
-> Option<Vec<BatsimEvent>>;
fn on_message_received_begin(&mut self,
timestamp: &f64)
-> Option<Vec<BatsimEvent>>;
fn on_simulation_ends(&mut self, timestamp: &f64);
}Base trait to implement scheduler for batsim.
Required Methods
fn simulation_begins(&mut self,
timestamp: &f64,
nb_resources: i32,
config: Value)
-> Option<Vec<BatsimEvent>>
timestamp: &f64,
nb_resources: i32,
config: Value)
-> Option<Vec<BatsimEvent>>
When the simulation in started, batsim will call simulation_begins to give to the
scheduler information on the simulations such as the number of resourcs available a
configuration (optional) and the original timestamp.
fn on_job_submission(&mut self,
timestamp: &f64,
job: Job,
profile: Option<Profile>)
-> Option<Vec<BatsimEvent>>
timestamp: &f64,
job: Job,
profile: Option<Profile>)
-> Option<Vec<BatsimEvent>>
When batsim receive a job from the submiter it will inform the scheduler. This function can return an array of Batsim event to send back to batsim.
fn on_job_completed(&mut self,
timestamp: &f64,
job_id: String,
status: String)
-> Option<Vec<BatsimEvent>>
timestamp: &f64,
job_id: String,
status: String)
-> Option<Vec<BatsimEvent>>
When a job is finished batsim will inform the scheduler with this function.
selfTake a reference mutable on the scheduler so we can update it.timestampThe at which the event occuredjob_idThe string id of the terminated job.statusThe return status of the job.
fn on_job_killed(&mut self,
timestamp: &f64,
job_ids: Vec<String>)
-> Option<Vec<BatsimEvent>>
timestamp: &f64,
job_ids: Vec<String>)
-> Option<Vec<BatsimEvent>>
When the scheduler kill on or several jobs batsim acknoiwledge by sending back the id of the killed job.
fn on_message_received_end(&mut self,
timestamp: &mut f64)
-> Option<Vec<BatsimEvent>>
timestamp: &mut f64)
-> Option<Vec<BatsimEvent>>
The function is called at the reception of a message
Before loop trhough each event and call on_* functions.
fn on_message_received_begin(&mut self,
timestamp: &f64)
-> Option<Vec<BatsimEvent>>
timestamp: &f64)
-> Option<Vec<BatsimEvent>>
The function is called just before sending back events to batsim.
fn on_simulation_ends(&mut self, timestamp: &f64)
This function is called a the end of the simulation. The timestamp is mutable so we can let the scheduler the time it it spend on schedling