Skip to content
Snippets Groups Projects
Commit 78c6ddae authored by jgatt's avatar jgatt
Browse files

factorize code with rigid_job function + small enum change

parent c13d20f1
No related branches found
No related tags found
1 merge request!16Merge request multibehavior
Pipeline #5524 passed
......@@ -132,6 +132,18 @@ bool DMUserMultiBehavior::C_you_later_job(double date, double next_time,shared_p
return false;
}
bool DMUserMultiBehavior::rigid_job(shared_ptr<Job> job, Profile *profile)
{
log_behavior(job,"rigid",0);
Parser::profile_from_duration(
profile, job->profile, user_name, platform_computing_speed);
dm_stat[2 * RIGID]++;
dm_stat[2 * RIGID + 1]
+= job->nb_requested_resources * std::stol(job->profile);
return true;
}
bool DMUserMultiBehavior::red_window_behavior(double date,shared_ptr<Job> job,Profile *profile)
{
/*
......@@ -181,13 +193,7 @@ bool DMUserMultiBehavior::red_window_behavior(double date,shared_ptr<Job> job,Pr
}
/* if none of the above we launch the job without changing anything
Rigid strategy*/
log_behavior(job,"rigid",0);
Parser::profile_from_duration(
profile, job->profile, user_name, platform_computing_speed);
dm_stat[2 * RIGID]++;
dm_stat[2 * RIGID + 1]
+= job->nb_requested_resources * std::stol(job->profile);
return true;
return rigid_job(job,profile);
}
bool DMUserMultiBehavior::yellow_window_behavior(shared_ptr<Job> job,Profile *profile){
......@@ -220,11 +226,7 @@ bool DMUserMultiBehavior::yellow_window_behavior(shared_ptr<Job> job,Profile *pr
return degrad_job(job,profile);
}
// if none of the above we launch the job without i.e. rigid strategy
log_behavior(job,"rigid",0);
Parser::profile_from_duration(profile, job->profile, user_name, platform_computing_speed);
dm_stat[2 * RIGID]++;
dm_stat[2 * RIGID + 1]+= job->nb_requested_resources * std::stol(job->profile);
return true;
return rigid_job(job,profile);
}
......@@ -283,12 +285,6 @@ bool DMUserMultiBehavior::handle_job(double date, shared_ptr<Job> job, Profile *
}
else
{
log_behavior(job,"rigid",0);
Parser::profile_from_duration(
profile, job->profile, user_name, platform_computing_speed);
dm_stat[2 * RIGID]++;
dm_stat[2 * RIGID + 1]
+= job->nb_requested_resources * std::stol(job->profile);
return true;
return rigid_job(job,profile);
}
}
\ No newline at end of file
......@@ -47,8 +47,8 @@ public:
protected:
enum red_behavior {R_DEGRAD=0,R_RECONFIG=1,R_RENONCE=2,R_RIGID=3,R_C_YOU_LATER=4,R_TOTAL=5};
enum yellow_behavior {Y_DEGRAD=0,Y_RECONFIG=1,Y_RIGID=2,Y_TOTAL=3};
enum red_behavior {R_DEGRAD,R_RECONFIG,R_RENONCE,R_RIGID,R_C_YOU_LATER,R_TOTAL};
enum yellow_behavior {Y_DEGRAD,Y_RECONFIG,Y_RIGID,Y_TOTAL};
DMWindow_list *yellow_windows;
DMWindow_list * red_windows;
DMWindow *red_window_buffer;
......@@ -62,6 +62,7 @@ protected:
bool is_in_yellow_window(double date);
bool is_in_red_window(double date);
void log_behavior(shared_ptr<Job> & job, std::string behavior_name, long delay_time);
bool rigid_job(shared_ptr<Job> job,Profile* profile);
bool C_you_later_job(double date, double next_time,shared_ptr<Job> job);
/**
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment