Skip to content
Snippets Groups Projects
Commit 5c4aab16 authored by jgatt's avatar jgatt
Browse files

split mono_core and multi_core red_behavior in two functions

parent 4f75b36e
No related branches found
No related tags found
1 merge request!20merge requested multibehavor_mono_multi_core
......@@ -139,16 +139,45 @@ bool DMUserMultiBehavior::rigid_job(shared_ptr<Job> job, Profile *profile)
return true;
}
bool DMUserMultiBehavior::red_window_behavior(double date,shared_ptr<Job> job,Profile *profile)
bool DMUserMultiBehavior::red_window_behavior_mono_core(double date, shared_ptr<Job> job, Profile *profile)
{
/*
* We decide at random the behavior
* (renounce, C_you_later, degrad, reconfig,rigid)
* that will be done on this job
*/
double behavior = distribution(random_gen)*red_prob_total;
double total_probability = 0.0;
/* Renonce*/
total_probability += red_prob[R_RENONCE];
if (behavior < total_probability){
log_behavior(job,"renonce",0);
return renonce_job(job);
}
/* See you later */
total_probability += red_prob[R_C_YOU_LATER];
if (behavior < total_probability){
return C_you_later_job(date,3600,job);
}
/* Degrad */
total_probability += red_prob[R_DEGRAD];
if (behavior < total_probability){
log_behavior(job,"consider_degrad",0);
log_behavior(job,"rigid",0);
return degrad_job(job,profile);
}
/* Reconfig */
total_probability += red_prob[R_RECONFIG];
if (behavior < total_probability){
log_behavior(job,"consider_reconfig",0);
log_behavior(job,"rigid",0);
return reconfig_job(job,profile);
}
/* if none of the above we launch the job without changing anything
Rigid strategy*/
return rigid_job(job,profile);
}
bool DMUserMultiBehavior::red_window_behavior_multi_core(double date, shared_ptr<Job> job, Profile *profile)
{
double behavior = distribution(random_gen)*red_prob_total;
double total_probability = 0.0;
/* Renonce*/
total_probability += red_prob[R_RENONCE];
if (behavior < total_probability){
......@@ -166,29 +195,35 @@ bool DMUserMultiBehavior::red_window_behavior(double date,shared_ptr<Job> job,Pr
total_probability += red_prob[R_DEGRAD];
if (behavior < total_probability){
log_behavior(job,"consider_degrad",0);
if (job->nb_requested_resources== 1){
log_behavior(job,"rigid",0);
}
else{
log_behavior(job, "degrad", 0);
}
log_behavior(job, "degrad", 0);
return degrad_job(job,profile);
}
/* Reconfig */
total_probability += red_prob[R_RECONFIG];
if (behavior < total_probability){
log_behavior(job,"consider_reconfig",0);
if (job->nb_requested_resources == 1){
log_behavior(job,"rigid",0);
}
else{
log_behavior(job, "reconfig", 0);
}
log_behavior(job, "reconfig", 0);
return reconfig_job(job,profile);
}
/* if none of the above we launch the job without changing anything
Rigid strategy*/
return rigid_job(job,profile);
}
bool DMUserMultiBehavior::red_window_behavior(double date,shared_ptr<Job> job,Profile *profile)
{
/*
* We decide at random the behavior
* (renounce, C_you_later, degrad, reconfig,rigid)
* that will be done on this job
*/
if (job->nb_requested_resources== 1){
return red_window_behavior_mono_core(date,job,profile);
}
else
{
return red_window_behavior_multi_core(date,job,profile);
}
}
bool DMUserMultiBehavior::yellow_window_behavior(shared_ptr<Job> job,Profile *profile){
......@@ -259,4 +294,5 @@ bool DMUserMultiBehavior::handle_job(double date, shared_ptr<Job> job, Profile *
{
return rigid_job(job,profile);
}
}
\ No newline at end of file
}
......@@ -84,7 +84,8 @@ protected:
* following the provided probabilities given at the creation of the class
*/
bool red_window_behavior(double date,shared_ptr<Job> job, Profile *profile);
bool red_window_behavior_mono_core(double date,shared_ptr<Job> job,Profile *profile);
bool red_window_behavior_multi_core(double date,shared_ptr<Job> job, Profile *profile);
/**
* @brief function called when the user submit a job in yellow state
* @details This function do the 3 behaviors for yellow windows (degrad,reconfig, rigid)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment