Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
B
batmen
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
sepia-pub
mael
batmen
Commits
5c4aab16
Commit
5c4aab16
authored
2 years ago
by
jgatt
Browse files
Options
Downloads
Patches
Plain Diff
split mono_core and multi_core red_behavior in two functions
parent
4f75b36e
No related branches found
No related tags found
1 merge request
!20
merge requested multibehavor_mono_multi_core
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/users/user_windows.cpp
+55
-19
55 additions, 19 deletions
src/users/user_windows.cpp
src/users/user_windows.hpp
+2
-1
2 additions, 1 deletion
src/users/user_windows.hpp
with
57 additions
and
20 deletions
src/users/user_windows.cpp
+
55
−
19
View file @
5c4aab16
...
...
@@ -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
}
This diff is collapsed.
Click to expand it.
src/users/user_windows.hpp
+
2
−
1
View file @
5c4aab16
...
...
@@ -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)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment