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
93327f22
Commit
93327f22
authored
1 year ago
by
Maël Madon
Browse files
Options
Downloads
Patches
Plain Diff
test with old versions pybatsim
parent
4513e55a
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
sched/fillerSched.py
+63
-0
63 additions, 0 deletions
sched/fillerSched.py
test.nix
+34
-0
34 additions, 0 deletions
test.nix
with
97 additions
and
0 deletions
sched/fillerSched.py
0 → 100644
+
63
−
0
View file @
93327f22
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.
test.nix
0 → 100644
+
34
−
0
View file @
93327f22
{
kapack
?
import
(
fetchTarball
"https://github.com/oar-team/nur-kapack/archive/901a5b656f695f2c82d17c091a55db2318ed3f39.tar.gz"
)
{}
,
pkgs
?
kapack
.
pkgs
,
python3
?
pkgs
.
python3
,
python3Packages
?
pkgs
.
python3Packages
}:
let
jobs
=
rec
{
evalys
=
kapack
.
evalys
.
overrideAttrs
(
attr
:
rec
{
name
=
"evalys"
;
version
=
"d4d47bd2f4d076730b05f1345b1bf9032cd28753"
;
src
=
pkgs
.
fetchgit
rec
{
url
=
"https://github.com/Mema5/evalys.git"
;
rev
=
version
;
sha256
=
"sha256-eHGRNj2xWBoEgG2wvAZUoH1Us5d1yu9emu1Zyyms1JU="
;
};
});
expe
=
pkgs
.
mkShell
rec
{
buildInputs
=
[
kapack
.
batsim-410
kapack
.
pybatsim-320
python3Packages
.
matplotlib
evalys
];
QT_QPA_PLATFORM_PLUGIN_PATH
=
with
pkgs
.
libsForQt5
.
qt5
;
"
${
qtbase
.
bin
}
/lib/qt-
${
qtbase
.
version
}
/plugins/platforms"
;
};
};
in
jobs
\ No newline at end of file
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