Commit efa8e190 authored by Millian Poquet's avatar Millian Poquet
Browse files

[code] missing doc + cosmetics

parent f6465ee9
......@@ -357,23 +357,38 @@ string job_state_to_string(JobState state)
return job_state;
}
JobState job_state_from_string(string state)
JobState job_state_from_string(std::string state)
{
JobState new_state;
if (state == "NOT_SUBMITTED") {
if (state == "NOT_SUBMITTED")
{
new_state = JobState::JOB_STATE_NOT_SUBMITTED;
} else if (state == "SUBMITTED") {
}
else if (state == "SUBMITTED")
{
new_state = JobState::JOB_STATE_SUBMITTED;
} else if (state == "RUNNING") {
}
else if (state == "RUNNING")
{
new_state = JobState::JOB_STATE_RUNNING;
} else if (state == "COMPLETED_SUCCESSFULLY") {
}
else if (state == "COMPLETED_SUCCESSFULLY")
{
new_state = JobState::JOB_STATE_COMPLETED_SUCCESSFULLY;
} else if (state == "COMPLETED_KILLED") {
}
else if (state == "COMPLETED_KILLED")
{
new_state = JobState::JOB_STATE_COMPLETED_KILLED;
} else if (state == "REJECTED") {
}
else if (state == "REJECTED")
{
new_state = JobState::JOB_STATE_REJECTED;
} else {
}
else
{
xbt_assert(false, "Invalid job state");
}
return new_state;
}
......@@ -123,14 +123,22 @@ struct SequenceProfileData
*/
struct MsgParallelHomogeneousPFSMultipleTiersProfileData
{
enum class Direction {
TO_STORAGE,
FROM_STORAGE
/**
* @brief The Direction of the PFS transfer
*/
enum class Direction
{
TO_STORAGE //!< From the nodes to the storage
,FROM_STORAGE //!< From the storage to the nodes
};
enum class Host {
HPST,
LCST
/**
* @brief The Host considered for the transfer
*/
enum class Host
{
HPST //!< The HPST...
,LCST //!< The LCST...
};
double size; //!< The size of data per compute node to transfer to pfs_machine (simulate a simple I/O traffic model)
......@@ -143,9 +151,13 @@ struct MsgParallelHomogeneousPFSMultipleTiersProfileData
*/
struct MsgDataStagingProfileData
{
enum class Direction {
LCST_TO_HPST,
HPST_TO_LCST
/**
* @brief The Direction of the data staging
*/
enum class Direction
{
LCST_TO_HPST //!< From the LCST to the HPST
,HPST_TO_LCST //!< From the HPST to the LCST
};
double size; //!< The size of data to transfer between the two PFS machines
......
......@@ -75,11 +75,13 @@ void JsonProtocolWriter::append_simulation_begins(Machines & machines,
}
data.AddMember("resources_data", Value().CopyFrom(resources, _alloc), _alloc);
if (machines.has_hpst_machine()) {
if (machines.has_hpst_machine())
{
data.AddMember("hpst_host", machine_to_json_value(*machines.hpst_machine()), _alloc);
}
if (machines.has_pfs_machine()) {
if (machines.has_pfs_machine())
{
data.AddMember("lcst_host", machine_to_json_value(*machines.pfs_machine()), _alloc);
}
......
......@@ -72,8 +72,9 @@ public:
// Messages from Batsim to the Scheduler
/**
* @brief Appends a SIMULATION_BEGINS event.
* @param[in] nb_resources The number of simulated resources
* @param[in] machines The machines usable to compute jobs
* @param[in] configuration The simulation configuration
* @param[in] allow_time_sharing Whether time sharing is enabled
* @param[in] date The event date. Must be greater than or equal to the previous event.
*/
virtual void append_simulation_begins(Machines & machines,
......@@ -104,6 +105,8 @@ public:
* @brief Appends a JOB_COMPLETED event.
* @param[in] job_id The identifier of the job that has completed.
* @param[in] job_status The job status
* @param[in] job_state The job state
* @param[in] kill_reason The kill reason (if any)
* @param[in] date The event date. Must be greater than or equal to the previous event.
*/
virtual void append_job_completed(const std::string & job_id,
......@@ -191,8 +194,9 @@ public:
// Messages from Batsim to the Scheduler
/**
* @brief Appends a SIMULATION_BEGINS event.
* @param[in] nb_resources The number of simulated resources
* @param[in] machines The machines usable to compute jobs
* @param[in] configuration The simulation configuration
* @param[in] allow_time_sharing Whether time sharing is enabled
* @param[in] date The event date. Must be greater than or equal to the previous event.
*/
void append_simulation_begins(Machines & machines,
......@@ -223,6 +227,8 @@ public:
* @brief Appends a JOB_COMPLETED event.
* @param[in] job_id The identifier of the job that has completed.
* @param[in] job_status The job status
* @param[in] job_state The job state
* @param[in] kill_reason The kill reason (if any)
* @param[in] date The event date. Must be greater than or equal to the previous event.
*/
void append_job_completed(const std::string & job_id,
......@@ -286,8 +292,8 @@ public:
private:
/**
* @brief Converts a machine to a json value.
* @param[in] the machine to be converted
* @return the json value
* @param[in] machine The machine to be converted
* @return The json value
*/
rapidjson::Value machine_to_json_value(const Machine & machine);
......
......@@ -215,7 +215,8 @@ void server_on_job_completed(ServerData * data,
}
data->context->proto_writer->append_job_completed(message->job_id.to_string(),
status, job_state_to_string(job->state),
status,
job_state_to_string(job->state),
job->kill_reason,
MSG_get_clock());
......
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