Vous avez reçu un message "Your GitLab account has been locked ..." ? Pas d'inquiétude : lisez cet article https://docs.gricad-pages.univ-grenoble-alpes.fr/help/unlock/

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

[code] server cleanup: check finished redundancy

parent 07001767
Pipeline #676 failed with stages
in 8 seconds
...@@ -166,16 +166,7 @@ void server_on_submitter_bye(ServerData * data, ...@@ -166,16 +166,7 @@ void server_on_submitter_bye(ServerData * data,
XBT_INFO("A submitted said goodbye. Number of finished submitters: %d", XBT_INFO("A submitted said goodbye. Number of finished submitters: %d",
data->nb_submitters_finished); data->nb_submitters_finished);
if (!data->all_jobs_submitted_and_completed && check_submitted_and_completed(data);
data->nb_completed_jobs == data->nb_submitted_jobs &&
data->nb_submitters_finished == data->nb_submitters &&
(!data->context->submission_sched_enabled || data->context->submission_sched_finished))
{
data->all_jobs_submitted_and_completed = true;
XBT_INFO("It seems that all jobs have been submitted and completed!");
data->context->proto_writer->append_simulation_ends(MSG_get_clock());
}
} }
void server_on_job_completed(ServerData * data, void server_on_job_completed(ServerData * data,
...@@ -214,16 +205,7 @@ void server_on_job_completed(ServerData * data, ...@@ -214,16 +205,7 @@ void server_on_job_completed(ServerData * data,
data->context->proto_writer->append_job_completed(message->job_id.to_string(), data->context->proto_writer->append_job_completed(message->job_id.to_string(),
status, MSG_get_clock()); status, MSG_get_clock());
if (!data->all_jobs_submitted_and_completed && check_submitted_and_completed(data);
data->nb_completed_jobs == data->nb_submitted_jobs &&
data->nb_submitters_finished == data->nb_submitters &&
(!data->context->submission_sched_enabled || data->context->submission_sched_finished))
{
data->all_jobs_submitted_and_completed = true;
XBT_INFO("It seems that all jobs have been submitted and completed!");
data->context->proto_writer->append_simulation_ends(MSG_get_clock());
}
} }
void server_on_job_submitted(ServerData * data, void server_on_job_submitted(ServerData * data,
...@@ -505,16 +487,7 @@ void server_on_killing_done(ServerData * data, ...@@ -505,16 +487,7 @@ void server_on_killing_done(ServerData * data,
data->context->proto_writer->append_job_killed(job_ids_str, MSG_get_clock()); data->context->proto_writer->append_job_killed(job_ids_str, MSG_get_clock());
--data->nb_killers; --data->nb_killers;
if (!data->all_jobs_submitted_and_completed && check_submitted_and_completed(data);
data->nb_completed_jobs == data->nb_submitted_jobs &&
data->nb_submitters_finished == data->nb_submitters &&
(!data->context->submission_sched_enabled || data->context->submission_sched_finished))
{
data->all_jobs_submitted_and_completed = true;
XBT_INFO("It seems that all jobs have been submitted and completed!");
data->context->proto_writer->append_simulation_ends(MSG_get_clock());
}
} }
void server_on_end_dynamic_submit(ServerData * data, void server_on_end_dynamic_submit(ServerData * data,
...@@ -745,3 +718,18 @@ void server_on_execute_job(ServerData * data, ...@@ -745,3 +718,18 @@ void server_on_execute_job(ServerData * data,
data->context->machines[allocation->machine_ids.first_element()]->host); data->context->machines[allocation->machine_ids.first_element()]->host);
job->execution_processes.insert(process); job->execution_processes.insert(process);
} }
void check_submitted_and_completed(ServerData * data)
{
if (!data->all_jobs_submitted_and_completed && // guard to prevent multiple SIMULATION_ENDS events
data->nb_submitters_finished == data->nb_submitters && // all submitters must have finished
data->nb_completed_jobs == data->nb_submitted_jobs && // all submitted jobs must have finished
// If dynamic submission is enabled, it must be finished
(!data->context->submission_sched_enabled || data->context->submission_sched_finished))
{
XBT_INFO("It seems that all jobs have been submitted and completed!");
data->all_jobs_submitted_and_completed = true;
data->context->proto_writer->append_simulation_ends(MSG_get_clock());
}
}
...@@ -46,6 +46,12 @@ struct ServerData ...@@ -46,6 +46,12 @@ struct ServerData
//map<std::pair<int,double>, Submitter*> origin_of_wait_queries; //map<std::pair<int,double>, Submitter*> origin_of_wait_queries;
}; };
/**
* @brief Checks whether all jobs are submitted and completed
* @param[in,out] data The data associated with the server_process
*/
void check_submitted_and_completed(ServerData * data);
/** /**
* @brief Process used to orchestrate the simulation * @brief Process used to orchestrate the simulation
* @param[in] argc The number of arguments * @param[in] argc The number of arguments
......
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