Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
R
RM4ES Practicals
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
sepia-pub
mael
RM4ES Practicals
Commits
e51d68cc
Commit
e51d68cc
authored
1 year ago
by
Maël Madon
Browse files
Options
Downloads
Patches
Plain Diff
commit for test salle info
parent
654ea957
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
default.nix
+19
-16
19 additions, 16 deletions
default.nix
sched/fcfs.py
+85
-0
85 additions, 0 deletions
sched/fcfs.py
sched/new_sched.py
+32
-0
32 additions, 0 deletions
sched/new_sched.py
sched/pyproject.toml
+6
-2
6 additions, 2 deletions
sched/pyproject.toml
with
142 additions
and
18 deletions
default.nix
+
19
−
16
View file @
e51d68cc
{
pkgs
?
import
(
fetchTarball
"https://github.com/NixOS/nixpkgs/archive/refs/tags/23.11.tar.gz"
)
{}
,
kapack
?
import
#
pkgs ? import (
#
fetchTarball "https://github.com/NixOS/nixpkgs/archive/refs/tags/23.11.tar.gz")
#
{}
kapack
?
import
(
fetchTarball
"https://github.com/oar-team/nur-kapack/archive/901a5b656f695f2c82d17c091a55db2318ed3f39.tar.gz"
)
{}
,
pkgs
?
kapack
.
pkgs
# {inherit pkgs;}
,
python3
?
pkgs
.
python3
11
,
python3Packages
?
pkgs
.
python3
11
Packages
,
python3
?
pkgs
.
python3
,
python3Packages
?
pkgs
.
python3Packages
# , pybatsim-core ? kapack.pybatsim-core
}:
...
...
@@ -58,14 +59,15 @@ let
# batexpe
# nixpkgs.qt6.qtbase
# nixpkgs.qt5.qtbase
(
python3
.
withPackages
(
ps
:
with
ps
;
with
python3Packages
;
[
# jupyter ipython
numpy
matplotlib
# plotly pip tabulate pytz isodate ordered-set yattag
])
)
# (python3.withPackages
# (ps: with ps; with python3Packages; [
# # jupyter ipython
# numpy
# matplotlib
# # plotly pip tabulate pytz isodate ordered-set yattag
# ])
# )
python3Packages
.
matplotlib
evalys
];
...
...
@@ -79,11 +81,12 @@ let
test
=
pkgs
.
mkShell
rec
{
buildInputs
=
[
pkgs
.
stdenv
.
cc
.
cc
.
lib
#
pkgs.stdenv.cc.cc.lib
python3Packages
.
poetry-core
pkgs
.
poetry
];
LD_LIBRARY_PATH
=
"
${
pkgs
.
stdenv
.
cc
.
cc
.
lib
}
/lib"
;
#
LD_LIBRARY_PATH="${pkgs.stdenv.cc.cc.lib}/lib";
};
# lib = pkgs.lib;
# pybatsim-example = python3Packages.buildPythonPackage rec {
...
...
This diff is collapsed.
Click to expand it.
sched/fcfs.py
0 → 100644
+
85
−
0
View file @
e51d68cc
"""
This scheduler is a simple FCFS:
- Released jobs are pushed in the back of one single queue
- Two jobs cannot be executed on the same machine at the same time
- Only the job at the head of the queue can be allocated
- If the job is too big (will never fit the machine), it is rejected
- If the job can fit the machine now, it is allocated (and run) instantly
- If the job cannot fit the machine now, the scheduler will waits for enough available machines
"""
from
procset
import
ProcSet
from
itertools
import
islice
from
pybatsim.batsim.batsim
import
BatsimScheduler
class
Fcfs2
(
BatsimScheduler
):
def
__init__
(
self
,
options
):
super
().
__init__
(
options
)
self
.
logger
.
info
(
"
FCFS init
"
)
def
onSimulationBegins
(
self
):
self
.
nb_completed_jobs
=
0
self
.
sched_delay
=
0.5
# Simulates the time spent by the scheduler to take decisions
self
.
open_jobs
=
[]
self
.
computing_machines
=
ProcSet
()
self
.
idle_machines
=
ProcSet
((
0
,
self
.
bs
.
nb_compute_resources
-
1
))
def
scheduleJobs
(
self
):
print
(
'
\n\n
open_jobs =
'
,
self
.
open_jobs
)
print
(
'
computingM =
'
,
self
.
computing_machines
)
print
(
'
idleM =
'
,
self
.
idle_machines
)
scheduled_jobs
=
[]
loop
=
True
# If there is a job to schedule
if
len
(
self
.
open_jobs
)
>
0
:
while
loop
and
self
.
open_jobs
:
job
=
self
.
open_jobs
[
0
]
nb_res_req
=
job
.
requested_resources
# Job fits now -> allocation
if
nb_res_req
<=
len
(
self
.
idle_machines
):
res
=
ProcSet
(
*
islice
(
self
.
idle_machines
,
nb_res_req
))
job
.
allocation
=
res
scheduled_jobs
.
append
(
job
)
self
.
computing_machines
|=
res
self
.
idle_machines
-=
res
self
.
open_jobs
.
remove
(
job
)
else
:
# Job can fit on the machine, but not now
loop
=
False
# update time
self
.
bs
.
consume_time
(
self
.
sched_delay
)
# send decision to batsim
self
.
bs
.
execute_jobs
(
scheduled_jobs
)
else
:
# No job to schedule
self
.
logger
.
info
(
"
There is no job to schedule right now
"
)
def
onJobSubmission
(
self
,
job
):
if
job
.
requested_resources
>
self
.
bs
.
nb_compute_resources
:
self
.
bs
.
reject_jobs
([
job
])
# This job requests more resources than the machine has
else
:
self
.
open_jobs
.
append
(
job
)
def
onJobCompletion
(
self
,
job
):
self
.
idle_machines
|=
job
.
allocation
self
.
computing_machines
-=
job
.
allocation
def
onNoMoreEvents
(
self
):
self
.
scheduleJobs
()
This diff is collapsed.
Click to expand it.
sched/new_sched.py
0 → 100644
+
32
−
0
View file @
e51d68cc
"""
Trivial example scheduler that rejects any job.
No hard feelings!
"""
from
pybatsim.batsim.batsim
import
BatsimScheduler
class
Newsched
(
BatsimScheduler
):
def
__init__
(
self
,
options
):
"""
Anything you need to initialize at class creation
"""
pass
def
onSimulationBegins
(
self
):
"""
Initialize your necessary variables and data structures...
"""
pass
def
onJobSubmission
(
self
,
job
):
"""
Batsim signals that a job arrived. Update the data structs..
"""
pass
def
onJobCompletion
(
self
,
job
):
"""
Batsim signals that a job completed. Update the data structs..
"""
pass
def
onNoMoreEvents
(
self
):
"""
Nothing else happens at this time stamp: make the scheduling decisions
"""
self
.
scheduleJobs
()
def
scheduleJobs
(
self
):
"""
Make the scheduling decisions
"""
pass
\ No newline at end of file
This diff is collapsed.
Click to expand it.
sched/pyproject.toml
+
6
−
2
View file @
e51d68cc
...
...
@@ -3,9 +3,9 @@ requires = ["poetry-core>=1.0.0"]
build-backend
=
"poetry.core.masonry.api"
[tool.poetry]
name
=
"
pybatsim-example
"
name
=
"
RM4ES
"
version
=
"0.0.0"
description
=
"
Example
scheduler
plugin for PyBatsim
"
description
=
"
Small
scheduler
s for RM4ES course
"
authors
=
[]
packages
=
[
{include
=
"*.py"
}
,
...
...
@@ -17,3 +17,7 @@ pybatsim = "^4.0.0a0"
[tool.poetry.plugins."pybatsim.schedulers"]
rejector
=
"universal_rejection:UniversalRejectionScheduler"
fcfs2
=
"fcfs:Fcfs2"
newSched
=
"new_sched:Newsched"
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment