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
d5ab721b
Commit
d5ab721b
authored
2 years ago
by
Maël Madon
Browse files
Options
Downloads
Patches
Plain Diff
fix: deterministic job oders
parent
15db9aa2
No related branches found
No related tags found
1 merge request
!7
Active test in the CI
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/json_workload.cpp
+12
-1
12 additions, 1 deletion
src/json_workload.cpp
src/queue.cpp
+8
-8
8 additions, 8 deletions
src/queue.cpp
src/queue.hpp
+4
-1
4 additions, 1 deletion
src/queue.hpp
with
24 additions
and
10 deletions
src/json_workload.cpp
+
12
−
1
View file @
d5ab721b
...
@@ -177,7 +177,18 @@ Job *Workload::job_from_json_object(const Value &object)
...
@@ -177,7 +177,18 @@ Job *Workload::job_from_json_object(const Value &object)
bool
JobComparator
::
operator
()(
const
Job
*
j1
,
const
Job
*
j2
)
const
bool
JobComparator
::
operator
()(
const
Job
*
j1
,
const
Job
*
j2
)
const
{
{
return
j1
->
id
<
j2
->
id
;
PPK_ASSERT_ERROR
(
j1
->
id
.
find
(
'!'
)
!=
string
::
npos
,
"I thought jobID had always a form 'wl!id'..."
);
string
id1
=
j1
->
id
.
substr
(
j1
->
id
.
find
(
'!'
)
+
1
,
j1
->
id
.
size
());
string
id2
=
j2
->
id
.
substr
(
j2
->
id
.
find
(
'!'
)
+
1
,
j2
->
id
.
size
());
if
(
id1
==
id2
)
/* different workload, same job number: comp on wl name */
return
j1
->
id
<
j2
->
id
;
if
(
id1
.
length
()
==
id2
.
length
())
/* same length: lexicographic order */
return
id1
<
id2
;
return
id1
.
length
()
<
id2
.
length
();
}
}
bool
SessionComparator
::
operator
()(
const
Session
*
s1
,
const
Session
*
s2
)
const
bool
SessionComparator
::
operator
()(
const
Session
*
s1
,
const
Session
*
s2
)
const
...
...
This diff is collapsed.
Click to expand it.
src/queue.cpp
+
8
−
8
View file @
d5ab721b
...
@@ -45,7 +45,7 @@ bool FCFSOrder::compare(const SortableJob *j1, const SortableJob *j2, const Sort
...
@@ -45,7 +45,7 @@ bool FCFSOrder::compare(const SortableJob *j1, const SortableJob *j2, const Sort
(
void
)
info
;
(
void
)
info
;
if
(
j1
->
release_date
==
j2
->
release_date
)
if
(
j1
->
release_date
==
j2
->
release_date
)
return
j
1
->
job
->
id
<
j2
->
job
->
id
;
return
j
obcmp
(
j1
->
job
,
j2
->
job
)
;
else
else
return
j1
->
release_date
<
j2
->
release_date
;
return
j1
->
release_date
<
j2
->
release_date
;
}
}
...
@@ -67,7 +67,7 @@ bool LCFSOrder::compare(const SortableJob *j1, const SortableJob *j2, const Sort
...
@@ -67,7 +67,7 @@ bool LCFSOrder::compare(const SortableJob *j1, const SortableJob *j2, const Sort
(
void
)
info
;
(
void
)
info
;
if
(
j1
->
release_date
==
j2
->
release_date
)
if
(
j1
->
release_date
==
j2
->
release_date
)
return
j
1
->
job
->
id
<
j2
->
job
->
id
;
return
j
obcmp
(
j1
->
job
,
j2
->
job
)
;
else
else
return
j1
->
release_date
>
j2
->
release_date
;
return
j1
->
release_date
>
j2
->
release_date
;
}
}
...
@@ -95,7 +95,7 @@ bool DescendingBoundedSlowdownOrder::compare(const SortableJob *j1, const Sortab
...
@@ -95,7 +95,7 @@ bool DescendingBoundedSlowdownOrder::compare(const SortableJob *j1, const Sortab
(
void
)
info
;
(
void
)
info
;
if
(
j1
->
bounded_slowdown
==
j2
->
bounded_slowdown
)
if
(
j1
->
bounded_slowdown
==
j2
->
bounded_slowdown
)
return
j
1
->
job
->
id
<
j2
->
job
->
id
;
return
j
obcmp
(
j1
->
job
,
j2
->
job
)
;
else
else
return
j1
->
bounded_slowdown
>
j2
->
bounded_slowdown
;
return
j1
->
bounded_slowdown
>
j2
->
bounded_slowdown
;
}
}
...
@@ -116,7 +116,7 @@ bool DescendingSlowdownOrder::compare(const SortableJob *j1, const SortableJob *
...
@@ -116,7 +116,7 @@ bool DescendingSlowdownOrder::compare(const SortableJob *j1, const SortableJob *
(
void
)
info
;
(
void
)
info
;
if
(
j1
->
slowdown
==
j2
->
slowdown
)
if
(
j1
->
slowdown
==
j2
->
slowdown
)
return
j
1
->
job
->
id
<
j2
->
job
->
id
;
return
j
obcmp
(
j1
->
job
,
j2
->
job
)
;
else
else
return
j1
->
slowdown
>
j2
->
slowdown
;
return
j1
->
slowdown
>
j2
->
slowdown
;
}
}
...
@@ -138,7 +138,7 @@ bool AscendingSizeOrder::compare(const SortableJob *j1, const SortableJob *j2, c
...
@@ -138,7 +138,7 @@ bool AscendingSizeOrder::compare(const SortableJob *j1, const SortableJob *j2, c
if
(
j1
->
job
->
nb_requested_resources
==
j2
->
job
->
nb_requested_resources
)
if
(
j1
->
job
->
nb_requested_resources
==
j2
->
job
->
nb_requested_resources
)
if
(
j1
->
job
->
submission_time
==
j2
->
job
->
submission_time
)
if
(
j1
->
job
->
submission_time
==
j2
->
job
->
submission_time
)
return
j
1
->
job
->
id
<
j2
->
job
->
id
;
return
j
obcmp
(
j1
->
job
,
j2
->
job
)
;
else
else
return
j1
->
job
->
submission_time
<
j2
->
job
->
submission_time
;
return
j1
->
job
->
submission_time
<
j2
->
job
->
submission_time
;
else
else
...
@@ -163,7 +163,7 @@ bool DescendingSizeOrder::compare(const SortableJob *j1, const SortableJob *j2,
...
@@ -163,7 +163,7 @@ bool DescendingSizeOrder::compare(const SortableJob *j1, const SortableJob *j2,
if
(
j1
->
job
->
nb_requested_resources
==
j2
->
job
->
nb_requested_resources
)
if
(
j1
->
job
->
nb_requested_resources
==
j2
->
job
->
nb_requested_resources
)
if
(
j1
->
job
->
submission_time
==
j2
->
job
->
submission_time
)
if
(
j1
->
job
->
submission_time
==
j2
->
job
->
submission_time
)
return
j
1
->
job
->
id
<
j2
->
job
->
id
;
return
j
obcmp
(
j1
->
job
,
j2
->
job
)
;
else
else
return
j1
->
job
->
submission_time
<
j2
->
job
->
submission_time
;
return
j1
->
job
->
submission_time
<
j2
->
job
->
submission_time
;
else
else
...
@@ -187,7 +187,7 @@ bool AscendingWalltimeOrder::compare(const SortableJob *j1, const SortableJob *j
...
@@ -187,7 +187,7 @@ bool AscendingWalltimeOrder::compare(const SortableJob *j1, const SortableJob *j
(
void
)
info
;
(
void
)
info
;
if
(
j1
->
job
->
walltime
==
j2
->
job
->
walltime
)
if
(
j1
->
job
->
walltime
==
j2
->
job
->
walltime
)
return
j
1
->
job
->
id
<
j2
->
job
->
id
;
return
j
obcmp
(
j1
->
job
,
j2
->
job
)
;
else
else
return
j1
->
job
->
walltime
<
j2
->
job
->
walltime
;
return
j1
->
job
->
walltime
<
j2
->
job
->
walltime
;
}
}
...
@@ -209,7 +209,7 @@ bool DescendingWalltimeOrder::compare(const SortableJob *j1, const SortableJob *
...
@@ -209,7 +209,7 @@ bool DescendingWalltimeOrder::compare(const SortableJob *j1, const SortableJob *
(
void
)
info
;
(
void
)
info
;
if
(
j1
->
job
->
walltime
==
j2
->
job
->
walltime
)
if
(
j1
->
job
->
walltime
==
j2
->
job
->
walltime
)
return
j
1
->
job
->
id
<
j2
->
job
->
id
;
return
j
obcmp
(
j1
->
job
,
j2
->
job
)
;
else
else
return
j1
->
job
->
walltime
>
j2
->
job
->
walltime
;
return
j1
->
job
->
walltime
>
j2
->
job
->
walltime
;
}
}
...
...
This diff is collapsed.
Click to expand it.
src/queue.hpp
+
4
−
1
View file @
d5ab721b
...
@@ -2,7 +2,7 @@
...
@@ -2,7 +2,7 @@
#include
<list>
#include
<list>
struct
Job
;
#include
"json_workload.hpp"
#include
"schedule.hpp"
#include
"schedule.hpp"
...
@@ -37,6 +37,9 @@ public:
...
@@ -37,6 +37,9 @@ public:
virtual
~
SortableJobOrder
();
virtual
~
SortableJobOrder
();
virtual
bool
compare
(
const
SortableJob
*
j1
,
const
SortableJob
*
j2
,
const
CompareInformation
*
info
=
nullptr
)
const
=
0
;
virtual
bool
compare
(
const
SortableJob
*
j1
,
const
SortableJob
*
j2
,
const
CompareInformation
*
info
=
nullptr
)
const
=
0
;
virtual
void
updateJob
(
SortableJob
*
job
,
const
UpdateInformation
*
info
=
nullptr
)
const
=
0
;
virtual
void
updateJob
(
SortableJob
*
job
,
const
UpdateInformation
*
info
=
nullptr
)
const
=
0
;
protected
:
JobComparator
jobcmp
;
};
};
class
FCFSOrder
:
public
SortableJobOrder
class
FCFSOrder
:
public
SortableJobOrder
...
...
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