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
47be174a
Commit
47be174a
authored
1 year ago
by
Maël Madon
Browse files
Options
Downloads
Patches
Plain Diff
cleaning old schedulers
parent
d218731f
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
.gitignore
+2
-1
2 additions, 1 deletion
.gitignore
sched/fcfs.py
+0
-85
0 additions, 85 deletions
sched/fcfs.py
sched/fillerSched.py
+0
-63
0 additions, 63 deletions
sched/fillerSched.py
with
2 additions
and
149 deletions
.gitignore
+
2
−
1
View file @
47be174a
out/*
!out/example_jobs.csv
*__pycache__*
\ No newline at end of file
*__pycache__*
*_perso/*
\ No newline at end of file
This diff is collapsed.
Click to expand it.
sched/fcfs.py
deleted
100644 → 0
+
0
−
85
View file @
d218731f
"""
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/fillerSched.py
deleted
100644 → 0
+
0
−
63
View file @
d218731f
from
batsim.batsim
import
BatsimScheduler
,
Batsim
import
sys
import
os
from
procset
import
ProcSet
from
itertools
import
islice
class
FillerSched
(
BatsimScheduler
):
def
onAfterBatsimInit
(
self
):
self
.
nb_completed_jobs
=
0
self
.
jobs_completed
=
[]
self
.
jobs_waiting
=
[]
self
.
sched_delay
=
0.005
self
.
openJobs
=
set
()
self
.
availableResources
=
ProcSet
((
0
,
self
.
bs
.
nb_compute_resources
-
1
))
def
scheduleJobs
(
self
):
scheduledJobs
=
[]
print
(
'
openJobs =
'
,
self
.
openJobs
)
print
(
'
available =
'
,
self
.
availableResources
)
# Iterating over a copy to be able to remove jobs from openJobs at traversal
for
job
in
set
(
self
.
openJobs
):
nb_res_req
=
job
.
requested_resources
if
nb_res_req
<=
len
(
self
.
availableResources
):
# Retrieve the *nb_res_req* first availables resources
job_alloc
=
ProcSet
(
*
islice
(
self
.
availableResources
,
nb_res_req
))
job
.
allocation
=
job_alloc
scheduledJobs
.
append
(
job
)
self
.
availableResources
-=
job_alloc
self
.
openJobs
.
remove
(
job
)
# update time
self
.
bs
.
consume_time
(
self
.
sched_delay
)
# send to uds
if
len
(
scheduledJobs
)
>
0
:
self
.
bs
.
execute_jobs
(
scheduledJobs
)
print
(
'
openJobs =
'
,
self
.
openJobs
)
print
(
'
available =
'
,
self
.
availableResources
)
print
(
''
)
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
.
openJobs
.
add
(
job
)
self
.
scheduleJobs
()
def
onJobCompletion
(
self
,
job
):
self
.
availableResources
|=
job
.
allocation
self
.
scheduleJobs
()
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