Skip to content
Snippets Groups Projects
Commit d998c533 authored by Maël Madon's avatar Maël Madon
Browse files

fix: add an epsilon-tolerence when checking which jobs to submit on a CALL_ME_LATER

parent f65c8046
No related branches found
No related tags found
No related merge requests found
Pipeline #5391 passed
...@@ -5,6 +5,8 @@ ...@@ -5,6 +5,8 @@
#include <limits> #include <limits>
#include <string> #include <string>
#define EPS 0.00001
/* FeedbackUser */ /* FeedbackUser */
void FeedbackUser::init_FeedbackUser( void FeedbackUser::init_FeedbackUser(
std::string name, const rapidjson::Value &param) std::string name, const rapidjson::Value &param)
...@@ -86,14 +88,15 @@ void FeedbackUser::jobs_to_submit( ...@@ -86,14 +88,15 @@ void FeedbackUser::jobs_to_submit(
profiles = std::list<Profile *>(); profiles = std::list<Profile *>();
/* Add the free sessions starting now to the list of active sessions */ /* Add the free sessions starting now to the list of active sessions */
while (!free_sessions.empty() && free_sessions.top()->start_time <= date) while (!free_sessions.empty() && free_sessions.top()->start_time < date + EPS)
{ {
active_sessions.push_back(free_sessions.top()); active_sessions.push_back(free_sessions.top());
free_sessions.pop(); free_sessions.pop();
} }
PPK_ASSERT_ERROR(!active_sessions.empty(), PPK_ASSERT_ERROR(!active_sessions.empty(),
"User %s has been called to sumbit but she has no active session", "User %s has been called to sumbit but she has no active session."
user_name.c_str()); "Her next_submission date is %f, her next free session start time is %f",
user_name.c_str(), this->date_of_next_submission, free_sessions.top()->start_time);
/* For each active session, add the jobs to submit now to the list `jobs` */ /* For each active session, add the jobs to submit now to the list `jobs` */
...@@ -107,7 +110,7 @@ void FeedbackUser::jobs_to_submit( ...@@ -107,7 +110,7 @@ void FeedbackUser::jobs_to_submit(
double offset = active_sess->start_time; double offset = active_sess->start_time;
while (!job_list->empty() while (!job_list->empty()
&& job_list->front()->submission_time + offset <= date) && job_list->front()->submission_time + offset < date + EPS)
{ {
Job *job = new Job(*job_list->front()); // Cast const Job * -> Job * Job *job = new Job(*job_list->front()); // Cast const Job * -> Job *
Profile *job_profile = new Profile(); Profile *job_profile = new Profile();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment