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

Merge branch 'feature/handle-notify-msg'

parents e9ff0ae1 d9f2e2d9
No related branches found
No related tags found
No related merge requests found
......@@ -93,6 +93,12 @@ void ISchedulingAlgorithm::on_requested_call(double date)
_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) date;
......
......@@ -91,6 +91,12 @@ public:
*/
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
* @param[in] date The date at which the ANSWER message has been received
......@@ -143,6 +149,7 @@ protected:
rapidjson::Document * _variant_options;
int _nb_machines = -1;
RedisStorage * _redis = nullptr;
bool _no_more_static_job_to_submit_received = false;
struct Failure
{
......
......@@ -464,6 +464,20 @@ void run(Network & n, ISchedulingAlgorithm * algo, SchedulingDecision & d,
}
}
}
else if (event_type == "NOTIFY")
{
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
{
throw runtime_error("Unknown event received. Type = " + event_type);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment