Skip to content
Snippets Groups Projects
Commit d9f2e2d9 authored by Millian Poquet's avatar Millian Poquet
Browse files

[code] tell algos no_more_static_jobs_to_submit

parent b305794a
Branches
Tags
No related merge requests found
...@@ -93,6 +93,12 @@ void ISchedulingAlgorithm::on_requested_call(double date) ...@@ -93,6 +93,12 @@ void ISchedulingAlgorithm::on_requested_call(double date)
_nopped_recently = true; _nopped_recently = true;
} }
void ISchedulingAlgorithm::on_no_more_static_job_to_submit_received(double date)
{
(void) date;
_no_more_static_job_to_submit_received = true;
}
void ISchedulingAlgorithm::on_answer_energy_consumption(double date, double consumed_joules) void ISchedulingAlgorithm::on_answer_energy_consumption(double date, double consumed_joules)
{ {
(void) date; (void) date;
......
...@@ -91,6 +91,12 @@ public: ...@@ -91,6 +91,12 @@ public:
*/ */
virtual void on_requested_call(double date); virtual void on_requested_call(double date);
/**
* @brief This function is called when the no_more_static_job_to_submit
* notification is received
*/
virtual void on_no_more_static_job_to_submit_received(double date);
/** /**
* @brief This function is called when an ANSWER message about energy consumption is received * @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 * @param[in] date The date at which the ANSWER message has been received
...@@ -143,6 +149,7 @@ protected: ...@@ -143,6 +149,7 @@ protected:
rapidjson::Document * _variant_options; rapidjson::Document * _variant_options;
int _nb_machines = -1; int _nb_machines = -1;
RedisStorage * _redis = nullptr; RedisStorage * _redis = nullptr;
bool _no_more_static_job_to_submit_received = false;
struct Failure struct Failure
{ {
......
...@@ -466,7 +466,17 @@ void run(Network & n, ISchedulingAlgorithm * algo, SchedulingDecision & d, ...@@ -466,7 +466,17 @@ void run(Network & n, ISchedulingAlgorithm * algo, SchedulingDecision & d,
} }
else if (event_type == "NOTIFY") else if (event_type == "NOTIFY")
{ {
printf("NOTIFY received. TODO: handle correctly."); string notify_type = event_data["type"].GetString();
if (notify_type == "no_more_static_job_to_submit")
{
algo->on_no_more_static_job_to_submit_received(current_date);
}
else
{
throw runtime_error("Unknown NOTIFY type received. Type = " + notify_type);
}
} }
else else
{ {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment