Skip to content
Snippets Groups Projects

Better memory management and float rounding issues

Merged Ghost User requested to merge issue12 into master
6 files
+ 37
40
Compare changes
  • Side-by-side
  • Inline
Files
6
+ 23
3
@@ -15,6 +15,16 @@ Broker::Broker(rapidjson::Document *user_description_file)
/* Parse description file and call constructor for each user */
if (!user_description_file->ObjectEmpty())
{
if (user_description_file->HasMember("core_limit_per_user"))
{
PPK_ASSERT_ERROR(
(*user_description_file)["core_limit_per_user"].IsInt(),
"Invalid user_description file: field "
"'core_limit_per_user' should be an int.");
core_limit_per_user
= (*user_description_file)["core_limit_per_user"].GetInt();
// otherwise, initialized at std::numeric_limits<int>::max()
}
if (user_description_file->HasMember("dm_window"))
{
const Value &dm_param = (*user_description_file)["dm_window"];
@@ -171,15 +181,25 @@ void Broker::jobs_to_submit(
while (planned_date_submission == user->next_submission())
{
user_queue.pop_front();
unsigned int nb_core_requested = 0;
list<Job *> user_jobs;
list<const Profile *> user_profiles;
user->jobs_to_submit(date, user_jobs, user_profiles);
for (Job *job : user_jobs)
{
jobs.push_back(job);
dynamic_jobs[job->id] = job;
job->status = WAITING;
nb_core_requested = nb_core_requested + job->nb_requested_resources;
if (nb_core_requested > core_limit_per_user)
{
job->status = KILLED;
}
else
{
jobs.push_back(job);
dynamic_jobs[job->id] = job;
job->status = WAITING;
}
}
profiles.splice(profiles.end(), user_profiles);
Loading