Skip to content
Snippets Groups Projects
Commit 1c30f15d authored by Maël Madon's avatar Maël Madon
Browse files

update README and add template sched

parent d5376de5
Branches
No related tags found
No related merge requests found
out
out/*
!out/example_jobs.csv
*__pycache__*
\ No newline at end of file
......@@ -80,18 +80,68 @@ In this tutorial, we will develop our schedulers in Python thanks to [pybatsim]
The scheduler implementations will be located in the folder [sched/](./sched/).
### Exercise 1
### Exercise 1: workload
Represent the workload used previously in this course (exercise 1 from the [exercise document](https://docs.google.com/document/d/15nfFvYgTwStwS0JGt5DMaQs6JDya8dKzFj69wMLTuTw/edit)) in Batsim JSON format.
You will put it in a new file named `expe/ex1.json`.
We will use the field "walltime" to store the "deadline".
### Exercise 2
TODO run a simulation with pre-defined scheduler `rejector`.
Look at the outputs...
### Exercise 2: run your first simulation
We will see if the installation from step Install worked, by running a first simulation.
For this, you will need two processes, launched in two separate terminal: one for the infrastructure simulator (batsim), managing the workload and the platform, and one for the scheduler.
On one Nix shell, launch batsim with platform input `expe/1machine.xml`, workload input `expe/2jobs.json` and export prefix `out/`:
```bash
batsim -p expe/1machine.xml -w expe/2jobs.json -e out/
```
The simulation should start, and wait for the scheduler to be started as well.
Try to understand the output from batsim in the terminal.
On another Nix shell, run a scheduler.
You are given a very simple scheduler, `sched/rejector.py`, that rejects all the jobs:
```bash
pybatsim sched/rejector.py
```
Try to understand the output of the scheduler in the terminal as well.
That's it, you run your first simulation!
Simulation outputs are stored in the `out` directory.
You have [schedule-centric outputs](https://batsim.readthedocs.io/en/latest/output-schedule.html) (`schedule.csv`) and [job-centric outputs](https://batsim.readthedocs.io/en/latest/output-jobs.html).
Open them, read the doc, and make sure you understand most of the fields.
Have a look also at the file `out/example_jobs.csv` to see how the job output looks like when the jobs are not rejected.
Finally, to get a visual representation of the outputs, we will use the visualization software `evalys`.
We provide a wrapper of `evalys` with the main functions that you need in the file `util/plot.py`.
The `jobs.csv` output that was produced before is not suitable for visualization since it has no jobs that executed.
Produce the visualization:
```bash
python util/plot.py out/example_jobs.csv
```
You have an option to store the output in a PDF file.
Check available options with `python util/plot.py -h`.
### Exercise 3: FCFS monomachine
Now, it's time to develop your own scheduler!
We will start with a FCFS monomachine: it schedules the jobs by order of arrival (and lexicographical order on the job ID in case of a tie).
Create a file `fcfsMono.py` in `sched` directory.
Draw inspiration from the template in `sched/template.py` to create your scheduler.
Warning: the file name and class name must match (for example, `fcfsMono.py` for the file name and `FcfsMono` for the class name).
Test it on `2jobs.json` and `ex1.json` inputs, and other inputs that you will create.
Visualize the outputs with evalys to see if it worked correcty.
### Exercise 3
TODO develop a monomachine FCFS scheduler and run it on the inputs from ex1.
Visualize the output thanks to evalys.
## Session 2: monomachine schedulers
- séance 2 : monomachine + d'autres algos : RMS, EDF (3 cas: infra sous-dimensionnée / normalement dim / sur-dim, remarquer que sur du surdimensioné, l'algo change rien)
......@@ -112,20 +162,6 @@ Visualize the output thanks to evalys.
- no working poetry in nix-shell
- will that work in the lab's machines?
## Status rn
We can start a small expe!
On one shell:
```
ns -A dev
pybatsim newSched
```
On the other shell:
```
ns -A expe
batsim -p expe/1machine.xml -w expe/2jobs.json -e out/
```
[Batsim]: https://batsim.org/
[Nix]: https://nixos.org/nix/
......
"""
Trivial example scheduler that rejects any job.
No hard feelings!
Template for scheduler development.
"""
from pybatsim.batsim.batsim import BatsimScheduler
from batsim.batsim import BatsimScheduler, Batsim
class Newsched(BatsimScheduler):
class Template(BatsimScheduler):
def __init__(self, options):
"""Anything you need to initialize at class creation"""
pass
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment