Commit 46380e14 authored by MOMMESSIN Clement's avatar MOMMESSIN Clement

[code] Batsim sends NOTIFY event of type "no_more_static_submitters"

parent 117ce271
......@@ -550,6 +550,30 @@ void JsonProtocolWriter::append_answer_energy(double consumed_energy,
_events.PushBack(event, _alloc);
}
void JsonProtocolWriter::append_notify(const std::string & notify_type,
double date)
{
/* {
"timestamp": 23.57,
"type": "NOTIFY",
"data": { "type": "no_more_static_submitters" }
} */
xbt_assert(date >= _last_date, "Date inconsistency");
_last_date = date;
_is_empty = false;
Value data(rapidjson::kObjectType);
data.AddMember("type", Value().SetString(notify_type.c_str(), _alloc), _alloc);
Value event(rapidjson::kObjectType);
event.AddMember("timestamp", Value().SetDouble(date), _alloc);
event.AddMember("type", Value().SetString("NOTIFY"), _alloc);
event.AddMember("data", data, _alloc);
_events.PushBack(event, _alloc);
}
void JsonProtocolWriter::clear()
{
_is_empty = true;
......
......@@ -166,6 +166,13 @@ public:
virtual void append_answer_energy(double consumed_energy,
double date) = 0;
/**
* @brief Appends a NOTIFY event.
* @param notify_type The type of the NOTIFY event
* @param date The event date. Must be greater than or equal to the previous event date.
*/
virtual void append_notify(const std::string & notify_type,
double date) = 0;
/**
* @brief Appends a REQUESTED_CALL message.
* @param[in] date The event date. Must be greater than or equal to the previous event.
......@@ -312,6 +319,14 @@ public:
void append_answer_energy(double consumed_energy,
double date);
/**
* @brief Appends a NOTIFY event
* @param notify_type The type of the notify event
* @param date The event date. Must be greater than or equal to the previous event.
*/
void append_notify(const std::string & notify_type,
double date);
/**
* @brief Appends a REQUESTED_CALL message.
* @param[in] date The event date. Must be greater than or equal to the previous event.
......
......@@ -185,9 +185,14 @@ void server_on_submitter_bye(ServerData * data,
{
data->nb_workflow_submitters_finished++;
}
XBT_DEBUG("A submitted said goodbye. Number of finished submitters: %d",
XBT_DEBUG("A submitter said goodbye. Number of finished submitters: %d",
data->nb_submitters_finished);
if(data->nb_submitters_finished == data->expected_nb_submitters)
{
data->context->proto_writer->append_notify("no_more_static_submitters", MSG_get_clock());
}
check_simulation_finished(data);
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment