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

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.

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.

When a job is finished batsim will inform the scheduler with this function.

  • self Take a reference mutable on the scheduler so we can update it.
  • timestamp The at which the event occured
  • job_id The string id of the terminated job.
  • status The return status of the job.

When the scheduler kill on or several jobs batsim acknoiwledge by sending back the id of the killed job.

The function is called at the reception of a message Before loop trhough each event and call on_* functions.

The function is called just before sending back events to batsim.

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

Implementors