Commit a002068e authored by Steffen Lackner's avatar Steffen Lackner
Browse files

[code] Send host properties to scheduler on simulation begin

parent 2ddf263b
......@@ -84,6 +84,14 @@ void Machines::create_machines(xbt_dynar_t hosts,
machine->host = host;
machine->jobs_being_computed = {};
auto properties_dict = MSG_host_get_properties(machine->host);
xbt_dict_cursor_t cursor = nullptr;
char *prop_key = nullptr;
char *prop_value = nullptr;
xbt_dict_foreach(properties_dict, cursor, prop_key, prop_value) {
machine->properties[string(prop_key)] = string(prop_value);
}
if (context->energy_used)
{
int nb_pstates = MSG_host_get_nb_pstates(machine->host);
......
......@@ -62,6 +62,8 @@ struct Machine
Rational last_state_change_date = 0; //!< The time at which the last state change has been done
std::map<MachineState, Rational> time_spent_in_each_state; //!< The cumulated time of the machine in each MachineState
std::map<std::string, std::string> properties; //!< Properties defined in the platform file
/**
* @brief Returns whether the Machine has the given power state
......
......@@ -74,7 +74,7 @@ void JsonProtocolWriter::append_simulation_begins(Machines & machines,
data.AddMember("resources_data", Value().CopyFrom(resources, _alloc), _alloc);
if (machines.has_hpst_machine()) {
data.AddMember("lcst_host", machine_to_json_value(*machines.hpst_machine()), _alloc);
data.AddMember("hpst_host", machine_to_json_value(*machines.hpst_machine()), _alloc);
}
if (machines.has_pfs_machine()) {
......@@ -96,6 +96,14 @@ Value JsonProtocolWriter::machine_to_json_value(const Machine & machine)
machine_doc.AddMember("name", Value().SetString(machine.name.c_str(), _alloc), _alloc);
machine_doc.AddMember("state", Value().SetString(machine_state_to_string(machine.state).c_str(), _alloc), _alloc);
Value properties(rapidjson::kObjectType);
for(auto const &entry : machine.properties) {
rapidjson::Value key(entry.first.c_str(), _alloc);
rapidjson::Value value(entry.second.c_str(), _alloc);
properties.AddMember(key, value, _alloc);
}
machine_doc.AddMember("properties", properties, _alloc);
return machine_doc;
}
......
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