Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
B
batmen
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
batmen
Commits
01739471
Commit
01739471
authored
1 year ago
by
Maël Madon
Browse files
Options
Downloads
Patches
Plain Diff
fix: propagate bug fix easy_bf_fast, see batsched issue
#9
parent
7eaa0c90
No related branches found
No related tags found
No related merge requests found
Pipeline
#6780
passed with warnings
1 year ago
Stage: build-and-test
Changes
2
Pipelines
3
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/scheds/easy_bf_fast.cpp
+28
-23
28 additions, 23 deletions
src/scheds/easy_bf_fast.cpp
src/scheds/easy_bf_fast.hpp
+3
-1
3 additions, 1 deletion
src/scheds/easy_bf_fast.hpp
with
31 additions
and
24 deletions
src/scheds/easy_bf_fast.cpp
+
28
−
23
View file @
01739471
...
...
@@ -52,8 +52,11 @@ void EasyBackfillingFast::make_decisions(double date,
// - only handles one priority job (the first of the queue)
// - only handles time as floating-point (-> precision errors).
// Hacks:
// - uses priority job's completion time to store its expected starting time
// Warning: you might obtain different outputs than with easy_bf. This is
// due to the fact that this version only keeps track of the priority job
// expected start time and the number of machines available then, while
// easy_bf keeps track of a full 2D schedule of the future. easy_bf_fast
// will sometimes be a little more greedy in backfilling.
bool
job_ended
=
false
;
...
...
@@ -134,8 +137,7 @@ void EasyBackfillingFast::make_decisions(double date,
{
// The job becomes priority!
_priority_job
=
pending_job
;
_priority_job
->
completion_time
=
compute_priority_job_expected_earliest_starting_time
();
update_priority_job_expected_earliest_start_time
();
_pending_jobs
.
erase
(
job_it
);
// Stop first queue traversal.
...
...
@@ -150,17 +152,16 @@ void EasyBackfillingFast::make_decisions(double date,
// Update priority job expected starting time (might have changed if a recently ended job
// completed before its walltime)
if
(
_priority_job
!=
nullptr
)
_priority_job
->
completion_time
=
compu
te_priority_job_expected_earliest_start
ing
_time
();
upda
te_priority_job_expected_earliest_start_time
();
for
(
auto
job_it
=
_pending_jobs
.
begin
();
job_it
!=
_pending_jobs
.
end
();)
{
const
Job
*
pending_job
=
*
job_it
;
// Can the job be executed now ?
if
(
pending_job
->
nb_requested_resources
<=
_nb_available_machines
&&
date
+
pending_job
->
walltime
<=
_priority_job
->
completion_time
)
// Can the job be executed now (without hindering priority job)?
if
(
pending_job
->
nb_requested_resources
<=
_nb_available_machines
&&
(
date
+
pending_job
->
walltime
<=
_priority_job_expected_start_time
||
pending_job
->
nb_requested_resources
<=
_remaining_resources_at_priority_job_start
))
{
// Yes, it can be backfilled!
alloc
.
machines
=
_available_machines
.
left
(
...
...
@@ -182,6 +183,8 @@ void EasyBackfillingFast::make_decisions(double date,
-=
pending_job
->
nb_requested_resources
;
_current_allocations
[
pending_job
->
id
]
=
alloc
;
job_it
=
_pending_jobs
.
erase
(
job_it
);
if
(
date
+
pending_job
->
walltime
>
_priority_job_expected_start_time
)
_remaining_resources_at_priority_job_start
-=
pending_job
->
nb_requested_resources
;
// Directly get out of the backfilling loop if all
// machines are busy.
...
...
@@ -222,13 +225,13 @@ void EasyBackfillingFast::make_decisions(double date,
{
// LOG_F(INFO, "There are enough available resources (%d) to execute
// job %s", _nb_available_machines, new_job->id.c_str());
// Can it be executed now (without hindering priority job?)
if
(
_priority_job
==
nullptr
||
date
+
new_job
->
walltime
<=
_priority_job
->
completion_time
)
// Can it be executed now (without hindering priority job)?
if
(
_priority_job
==
nullptr
||
date
+
new_job
->
walltime
<=
_priority_job_expected_start_time
||
new_job
->
nb_requested_resources
<=
_remaining_resources_at_priority_job_start
)
{
// LOG_F(INFO, "Job %s can be started right away!",
// new_job->id.c_str());
// Yes, the job can be executed right away!
//LOG_F(INFO, "Job %s can be started right away!", new_job->id.c_str());
// Yes, the job can be executed right away!
Allocation
alloc
;
alloc
.
machines
...
...
@@ -246,6 +249,8 @@ void EasyBackfillingFast::make_decisions(double date,
_available_machines
-=
alloc
.
machines
;
_nb_available_machines
-=
new_job
->
nb_requested_resources
;
_current_allocations
[
new_job_id
]
=
alloc
;
if
(
_priority_job
!=
nullptr
&&
date
+
new_job
->
walltime
>
_priority_job_expected_start_time
)
_remaining_resources_at_priority_job_start
-=
new_job
->
nb_requested_resources
;
}
else
{
...
...
@@ -253,7 +258,7 @@ void EasyBackfillingFast::make_decisions(double date,
/*LOG_F(INFO, "Not enough time to execute job %s (walltime=%g,
priority job expected starting time=%g)",
new_job->id.c_str(), (double)new_job->walltime,
_priority_job
->completion
_time);*/
_priority_job
_expected_start
_time);*/
_pending_jobs
.
push_back
(
new_job
);
}
}
...
...
@@ -264,8 +269,7 @@ void EasyBackfillingFast::make_decisions(double date,
{
// The job becomes priority.
_priority_job
=
new_job
;
_priority_job
->
completion_time
=
compute_priority_job_expected_earliest_starting_time
();
update_priority_job_expected_earliest_start_time
();
}
else
{
...
...
@@ -280,8 +284,7 @@ void EasyBackfillingFast::make_decisions(double date,
DynScheduler
::
make_decisions
(
date
,
update_info
,
compare_info
);
}
double
EasyBackfillingFast
::
compute_priority_job_expected_earliest_starting_time
()
void
EasyBackfillingFast
::
update_priority_job_expected_earliest_start_time
()
{
int
nb_available
=
_nb_available_machines
;
int
required
=
_priority_job
->
nb_requested_resources
;
...
...
@@ -292,12 +295,14 @@ EasyBackfillingFast::compute_priority_job_expected_earliest_starting_time()
if
(
nb_available
>=
required
)
{
return
it
->
date
;
_priority_job_expected_start_time
=
it
->
date
;
_remaining_resources_at_priority_job_start
=
nb_available
-
required
;
return
;
}
}
PPK_ASSERT_ERROR
(
false
,
"The job will never be executable."
);
return
0
;
return
;
}
std
::
list
<
EasyBackfillingFast
::
FinishedHorizonPoint
>::
iterator
...
...
This diff is collapsed.
Click to expand it.
src/scheds/easy_bf_fast.hpp
+
3
−
1
View file @
01739471
...
...
@@ -38,7 +38,7 @@ private:
};
private
:
double
compu
te_priority_job_expected_earliest_start
ing
_time
();
void
upda
te_priority_job_expected_earliest_start_time
();
std
::
list
<
FinishedHorizonPoint
>::
iterator
insert_horizon_point
(
const
FinishedHorizonPoint
&
point
);
private
:
...
...
@@ -58,4 +58,6 @@ private:
// At any time, null if there is no priority job (no waiting job)
Job
*
_priority_job
=
nullptr
;
double
_priority_job_expected_start_time
=
-
1
;
int
_remaining_resources_at_priority_job_start
=
-
1
;
};
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