Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
B
batsched
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
poquet
millian
batsched
Commits
e02ce5a3
Commit
e02ce5a3
authored
5 years ago
by
Millian Poquet
Browse files
Options
Downloads
Patches
Plain Diff
[code] handle user-provided (un)available events
parent
db0450a6
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/isalgorithm.cpp
+20
-0
20 additions, 0 deletions
src/isalgorithm.cpp
src/isalgorithm.hpp
+23
-0
23 additions, 0 deletions
src/isalgorithm.hpp
src/main.cpp
+14
-0
14 additions, 0 deletions
src/main.cpp
with
57 additions
and
0 deletions
src/isalgorithm.cpp
+
20
−
0
View file @
e02ce5a3
...
...
@@ -23,6 +23,8 @@ void ISchedulingAlgorithm::clear_recent_data_structures()
_jobs_killed_recently
.
clear
();
_jobs_whose_waiting_time_estimation_has_been_requested_recently
.
clear
();
_machines_whose_pstate_changed_recently
.
clear
();
_machines_that_became_available_recently
.
clear
();
_machines_that_became_unavailable_recently
.
clear
();
_nopped_recently
=
false
;
_consumed_joules_updated_recently
=
false
;
_consumed_joules
=
-
1
;
...
...
@@ -91,6 +93,12 @@ void ISchedulingAlgorithm::on_no_more_static_job_to_submit_received(double date)
_no_more_static_job_to_submit_received
=
true
;
}
void
ISchedulingAlgorithm
::
on_no_more_external_event_to_occur
(
double
date
)
{
(
void
)
date
;
_no_more_external_event_to_occur_received
=
true
;
}
void
ISchedulingAlgorithm
::
on_answer_energy_consumption
(
double
date
,
double
consumed_joules
)
{
(
void
)
date
;
...
...
@@ -98,6 +106,18 @@ void ISchedulingAlgorithm::on_answer_energy_consumption(double date, double cons
_consumed_joules_updated_recently
=
true
;
}
void
ISchedulingAlgorithm
::
on_machine_available_notify_event
(
double
date
,
IntervalSet
machines
)
{
(
void
)
date
;
_machines_that_became_available_recently
+=
machines
;
}
void
ISchedulingAlgorithm
::
on_machine_unavailable_notify_event
(
double
date
,
IntervalSet
machines
)
{
(
void
)
date
;
_machines_that_became_unavailable_recently
+=
machines
;
}
void
ISchedulingAlgorithm
::
on_query_estimate_waiting_time
(
double
date
,
const
string
&
job_id
)
{
(
void
)
date
;
...
...
This diff is collapsed.
Click to expand it.
src/isalgorithm.hpp
+
23
−
0
View file @
e02ce5a3
...
...
@@ -84,6 +84,12 @@ public:
*/
virtual
void
on_no_more_static_job_to_submit_received
(
double
date
);
/**
* @brief This function is called when the on_no_more_external_event_to_occur
* notification is received
*/
virtual
void
on_no_more_external_event_to_occur
(
double
date
);
/**
* @brief This function is called when an ANSWER message about energy consumption is received
* @param[in] date The date at which the ANSWER message has been received
...
...
@@ -91,6 +97,20 @@ public:
*/
virtual
void
on_answer_energy_consumption
(
double
date
,
double
consumed_joules
);
/**
* @brief This function is called when a machine_available NOTIFY event is received.
* @param[in] date The date at which the NOTIFY event has been received.
* @param[in] machines The machines whose availability has changed.
*/
virtual
void
on_machine_available_notify_event
(
double
date
,
IntervalSet
machines
);
/**
* @brief This function is called when a machine_unavailable NOTIFY event is received.
* @param[in] date The date at which the NOTIFY event has been received.
* @param[in] machines The machines whose availability has changed.
*/
virtual
void
on_machine_unavailable_notify_event
(
double
date
,
IntervalSet
machines
);
/**
* @brief This function is called when a QUERY message about estimating waiting time of potential jobs is received.
* @param[in] date The date at which the QUERY message has been received
...
...
@@ -137,6 +157,7 @@ protected:
int
_nb_machines
=
-
1
;
RedisStorage
*
_redis
=
nullptr
;
bool
_no_more_static_job_to_submit_received
=
false
;
bool
_no_more_external_event_to_occur_received
=
false
;
protected:
std
::
vector
<
std
::
string
>
_jobs_released_recently
;
...
...
@@ -144,6 +165,8 @@ protected:
std
::
vector
<
std
::
string
>
_jobs_killed_recently
;
std
::
vector
<
std
::
string
>
_jobs_whose_waiting_time_estimation_has_been_requested_recently
;
std
::
map
<
int
,
IntervalSet
>
_machines_whose_pstate_changed_recently
;
IntervalSet
_machines_that_became_available_recently
;
IntervalSet
_machines_that_became_unavailable_recently
;
bool
_nopped_recently
;
bool
_consumed_joules_updated_recently
;
double
_consumed_joules
;
...
...
This diff is collapsed.
Click to expand it.
src/main.cpp
+
14
−
0
View file @
e02ce5a3
...
...
@@ -502,6 +502,20 @@ void run(Network & n, ISchedulingAlgorithm * algo, SchedulingDecision & d,
{
algo
->
on_no_more_static_job_to_submit_received
(
current_date
);
}
else
if
(
notify_type
==
"no_more_external_event_to_occur"
)
{
algo
->
on_no_more_external_event_to_occur
(
current_date
);
}
else
if
(
notify_type
==
"event_machine_available"
)
{
IntervalSet
resources
=
IntervalSet
::
from_string_hyphen
(
event_data
[
"resources"
].
GetString
(),
" "
);
algo
->
on_machine_available_notify_event
(
current_date
,
resources
);
}
else
if
(
notify_type
==
"event_machine_unavailable"
)
{
IntervalSet
resources
=
IntervalSet
::
from_string_hyphen
(
event_data
[
"resources"
].
GetString
(),
" "
);
algo
->
on_machine_unavailable_notify_event
(
current_date
,
resources
);
}
else
{
throw
runtime_error
(
"Unknown NOTIFY type received. Type = "
+
notify_type
);
...
...
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