Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
Sufficient behaviors with renewables
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
Open Science
Sufficient behaviors with renewables
Commits
dce70a5b
Commit
dce70a5b
authored
1 year ago
by
Maël Madon
Browse files
Options
Downloads
Patches
Plain Diff
delete unused files and functions
parent
e2a82808
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
scripts/plot_library.py
+0
-231
0 additions, 231 deletions
scripts/plot_library.py
scripts/util.py
+0
-18
0 additions, 18 deletions
scripts/util.py
with
0 additions
and
249 deletions
scripts/plot_library.py
deleted
100644 → 0
+
0
−
231
View file @
e2a82808
import
evalys.visu.legacy
as
vleg
from
matplotlib
import
figure
,
pyplot
as
plt
import
numpy
as
np
import
pandas
from
scripts.util
import
JobSetMulticore
,
intersect_windows
def
plot_load_and_details
(
expe_file
):
begin
,
end
=
24
*
3600
,
48
*
3600
js
=
JobSetMulticore
.
from_csv
(
expe_file
+
"
/_jobs.csv
"
)
js
.
df
=
js
.
df
[(
js
.
df
.
submission_time
>=
begin
)
&
(
js
.
df
.
submission_time
<
end
)]
fig
,
axe
=
plt
.
subplots
(
nrows
=
2
,
sharex
=
True
,
figsize
=
(
16
,
8
),
tight_layout
=
True
)
fig
.
suptitle
(
expe_file
,
fontsize
=
16
)
vleg
.
plot_load
(
js
.
utilisation
,
js
.
MaxProcs
,
time_scale
=
False
,
ax
=
axe
[
0
])
vleg
.
plot_job_details
(
js
.
df
,
js
.
MaxProcs
,
time_scale
=
False
,
ax
=
axe
[
1
])
for
ax
in
axe
:
ax
.
xaxis
.
set_ticks
(
np
.
arange
(
begin
,
end
,
2
*
3600
))
ax
.
xaxis
.
set_ticklabels
(
np
.
arange
(
24
,
48
,
2
))
plt
.
xlim
(
begin
,
end
)
fig
.
savefig
(
expe_file
+
'
_viz.png
'
)
plt
.
show
()
plt
.
close
(
fig
)
def
plot_energy_consumed
(
out_dir
,
red_windows
,
yellow_windows
,
label
=
None
,
tick_size
=
2
,
begin_time
=
0
,
end_time
=
None
):
if
label
is
None
:
label
=
out_dir
data
=
pandas
.
read_csv
(
out_dir
+
"
/_consumed_energy.csv
"
)
for
red_window
in
red_windows
:
plot_window
(
red_window
,
"
red
"
)
for
yellow_window
in
yellow_windows
:
plot_window
(
yellow_window
,
"
yellow
"
)
ax_1
=
plt
.
gca
()
data
.
plot
(
x
=
"
time
"
,
y
=
"
energy
"
,
ax
=
ax_1
,
xlim
=
(
begin_time
,
end_time
),
label
=
label
)
ax_1
.
xaxis
.
set_ticks
(
np
.
arange
(
begin_time
,
end_time
,
tick_size
*
3600
))
ax_1
.
xaxis
.
set_ticklabels
(
np
.
arange
(
begin_time
//
3600
,
end_time
//
3600
,
tick_size
))
def
plot_window_list
(
red_window_list
,
yellow_window_list
,
begin_exp
,
end_exp
,
tick
=
12
,
width
=
21
,
height
=
5
):
plt
.
figure
(
figsize
=
(
width
,
height
))
plot_window
([
begin_exp
,
end_exp
],
"
green
"
)
for
red_window
in
red_window_list
:
if
intersect_windows
([
begin_exp
,
end_exp
],
red_window
)
:
plot_window
(
red_window
,
"
red
"
)
for
yellow_window
in
yellow_window_list
:
if
intersect_windows
([
begin_exp
,
end_exp
],
yellow_window
)
:
plot_window
(
yellow_window
,
"
yellow
"
)
ax
=
plt
.
gca
()
ax
.
xaxis
.
set_ticks
(
np
.
arange
(
begin_exp
,
end_exp
+
1
,
tick
*
3600
))
ax
.
xaxis
.
set_ticklabels
(
np
.
arange
(
begin_exp
//
3600
,
end_exp
//
3600
+
1
,
tick
)
%
24
,
fontsize
=
12
)
def
plot_window_list_extra
(
red_window_list
,
yellow_window_list
,
begin_exp
,
end_exp
,
red_threshold
,
yellow_threshold
,
energy_produced_dataframe
,
offset_day_production
,
tick
=
12
,
width
=
21
,
height
=
5
,
fontsize
=
12
)
:
plt
.
figure
(
figsize
=
(
width
,
height
))
offset_time_prod
=
offset_day_production
*
24
*
3600
energy_produced_dataframe
[
"
time
"
]
-=
offset_time_prod
energy_produced_dataframe_sub
=
energy_produced_dataframe
[
energy_produced_dataframe
.
time
<=
end_exp
]
energy_produced_dataframe_sub
=
energy_produced_dataframe_sub
[
energy_produced_dataframe_sub
.
time
>=
begin_exp
]
power_produced_max
=
energy_produced_dataframe_sub
[
"
power
"
].
max
()
plot_window
([
begin_exp
,
end_exp
],
"
green
"
,
label
=
True
)
first_window
=
True
for
red_window
in
red_window_list
:
if
intersect_windows
([
begin_exp
,
end_exp
],
red_window
):
plot_window
(
red_window
,
"
red
"
,
label
=
first_window
)
first_window
=
False
first_window
=
True
for
yellow_window
in
yellow_window_list
:
if
intersect_windows
([
begin_exp
,
end_exp
],
yellow_window
):
plot_window
(
yellow_window
,
"
yellow
"
,
label
=
first_window
)
first_window
=
False
ax
=
plt
.
gca
()
energy_produced_dataframe_sub
.
plot
.
scatter
(
x
=
"
time
"
,
y
=
"
power
"
,
ax
=
ax
,
zorder
=
500
,
label
=
"
power produced
"
)
plt
.
axhline
(
red_threshold
,
label
=
"
red threshold
"
,
color
=
"
black
"
)
plt
.
axhline
(
yellow_threshold
,
label
=
"
yellow threshold
"
,
color
=
"
black
"
,
linestyle
=
"
dashed
"
)
ax
.
xaxis
.
set_ticks
(
np
.
arange
(
begin_exp
,
end_exp
+
1
,
tick
*
3600
))
ax
.
xaxis
.
set_ticklabels
(
np
.
arange
(
begin_exp
//
3600
,
end_exp
//
3600
+
1
,
tick
)
%
24
,
fontsize
=
fontsize
)
power_max
=
int
((
power_produced_max
*
1.2
)
//
100
*
100
)
tick_y
=
power_max
//
10
ax
.
yaxis
.
set_ticks
(
np
.
arange
(
0
,
power_max
,
tick_y
,
dtype
=
int
))
ax
.
yaxis
.
set_ticklabels
(
np
.
arange
(
0
,
power_max
,
tick_y
,
dtype
=
int
),
fontsize
=
fontsize
)
plt
.
xlabel
(
"
time (in hour of the day)
"
,
fontsize
=
fontsize
)
plt
.
ylabel
(
"
power (in Watt)
"
,
fontsize
=
fontsize
)
def
plot_window
(
window
,
window_type
,
label
=
False
):
[
begin
,
end
]
=
window
label_name
=
None
if
window_type
==
"
red
"
:
color_fig
=
"
#FDA3AB
"
if
label
:
label_name
=
"
red_window
"
elif
window_type
==
"
yellow
"
:
color_fig
=
"
#F9F99C
"
if
label
:
label_name
=
"
yellow_window
"
elif
window_type
==
"
green
"
:
color_fig
=
"
#DDFDCC
"
if
label
:
label_name
=
"
green_window
"
else
:
print
(
"
[Warning] undefined window color
"
)
return
plt
.
axvspan
(
xmin
=
begin
,
xmax
=
end
,
color
=
color_fig
,
label
=
label_name
)
def
plot_load_windows
(
expe_file_list
,
expe_name_list
,
color_panel
=
None
,
red_windows
=
None
,
yellow_windows
=
None
,
begin_time
=
24
,
end_time
=
48
,
split
=
12
,
interactive
=
False
,
width
=
20
,
height
=
10
,
fontsize
=
10
):
if
yellow_windows
is
None
:
yellow_windows
=
[]
if
red_windows
is
None
:
red_windows
=
[]
nb_exp
=
len
(
expe_name_list
)
begin
,
end
=
begin_time
*
3600
,
end_time
*
3600
fig
=
plt
.
figure
(
figsize
=
(
width
,
height
))
plot_window
([
begin
,
end
],
"
green
"
)
top
=
100
for
expe_file
,
expe_name
in
zip
(
expe_file_list
,
expe_name_list
):
js
=
JobSetMulticore
.
from_csv
(
expe_file
+
"
/_jobs.csv
"
)
js
.
df
=
js
.
df
[(
js
.
df
.
submission_time
>=
begin
)
&
(
js
.
df
.
submission_time
<
end
)]
vleg
.
plot_load
(
js
.
utilisation
,
js
.
MaxProcs
,
legend_label
=
expe_name
)
top
=
max
(
js
.
MaxProcs
+
100.0
,
top
)
ax
=
plt
.
gca
()
ax
.
xaxis
.
set_ticks
(
np
.
arange
(
begin
,
end
,
split
*
3600
))
ax
.
xaxis
.
set_ticklabels
(
np
.
arange
(
begin_time
,
end_time
,
split
)
%
24
,
fontsize
=
fontsize
)
ax
.
set_ylim
(
bottom
=-
10.0
,
top
=
top
)
for
window
in
yellow_windows
:
plot_window
(
window
,
"
yellow
"
)
if
color_panel
:
for
line
,
color
in
zip
(
plt
.
gca
().
get_lines
()[::
3
],
color_panel
):
print
(
line
,
color
)
line
.
set_color
(
color
)
for
window
in
red_windows
:
plot_window
(
window
,
"
red
"
)
plt
.
xlim
(
begin
,
end
)
for
label
in
(
ax
.
get_xticklabels
()
+
ax
.
get_yticklabels
()):
label
.
set_fontsize
(
fontsize
)
lgd
=
ax
.
legend
(
bbox_to_anchor
=
(
1
,
0.5
),
loc
=
"
upper left
"
)
plt
.
xlabel
(
"
time (in hour of the day)
"
,
fontsize
=
fontsize
)
plt
.
ylabel
(
"
Load of the server (in number of core)
"
,
fontsize
=
fontsize
)
fig
.
savefig
(
expe_file_list
[
0
]
+
'
comparative_viz.png
'
,
bbox_extra_artists
=
(
lgd
,),
bbox_inches
=
'
tight
'
)
fig
.
savefig
(
expe_file_list
[
0
]
+
'
comparative_viz.svg
'
,
bbox_extra_artists
=
(
lgd
,),
bbox_inches
=
'
tight
'
)
plt
.
show
()
if
not
interactive
:
plt
.
close
(
fig
)
def
plot_queue_windows
(
expe_file_list
,
expe_name_list
,
color_panel
=
None
,
red_windows
=
None
,
yellow_windows
=
None
,
begin_time
=
24
,
end_time
=
48
,
split
=
12
,
interactive
=
False
,
width
=
20
,
height
=
10
,
fontsize
=
10
):
if
yellow_windows
is
None
:
yellow_windows
=
[]
if
red_windows
is
None
:
red_windows
=
[]
nb_exp
=
len
(
expe_name_list
)
begin
,
end
=
begin_time
*
3600
,
end_time
*
3600
fig
=
plt
.
figure
(
figsize
=
(
width
,
height
))
plot_window
([
begin
,
end
],
"
green
"
)
top
=
100
for
expe_file
,
expe_name
in
zip
(
expe_file_list
,
expe_name_list
):
js
=
JobSetMulticore
.
from_csv
(
expe_file
+
"
/_jobs.csv
"
)
js
.
df
=
js
.
df
[(
js
.
df
.
submission_time
>=
begin
)
&
(
js
.
df
.
submission_time
<
end
)]
vleg
.
plot_load
(
js
.
queue
,
js
.
MaxProcs
,
legend_label
=
expe_name
)
top
=
max
(
top
,
6
*
js
.
MaxProcs
)
ax
=
plt
.
gca
()
ax
.
xaxis
.
set_ticks
(
np
.
arange
(
begin
,
end
,
split
*
3600
))
ax
.
xaxis
.
set_ticklabels
(
np
.
arange
(
begin_time
,
end_time
,
split
)
%
24
,
fontsize
=
fontsize
)
ax
.
set_ylim
(
bottom
=-
10.0
,
top
=
top
)
end_y
=
top
//
100
*
100
tick
=
end_y
//
10
ax
.
yaxis
.
set_ticks
(
np
.
arange
(
0
,
end_y
,
tick
))
ax
.
yaxis
.
set_ticklabels
(
np
.
arange
(
0
,
end_y
,
tick
),
fontsize
=
fontsize
)
plt
.
xlabel
(
"
time of the day
"
,
fontsize
=
fontsize
)
plt
.
ylabel
(
"
queue_size
"
,
fontsize
=
fontsize
)
for
window
in
yellow_windows
:
plot_window
(
window
,
"
yellow
"
)
if
color_panel
:
for
line
,
color
in
zip
(
plt
.
gca
().
get_lines
()[::
3
],
color_panel
):
print
(
line
,
color
)
line
.
set_color
(
color
)
for
window
in
red_windows
:
plot_window
(
window
,
"
red
"
)
plt
.
xlim
(
begin
,
end
)
lgd
=
ax
.
legend
(
bbox_to_anchor
=
(
1
,
0.5
),
loc
=
"
upper left
"
)
fig
.
savefig
(
expe_file_list
[
0
]
+
'
comparative_queue_viz.png
'
,
bbox_extra_artists
=
(
lgd
,),
bbox_inches
=
'
tight
'
)
fig
.
savefig
(
expe_file_list
[
0
]
+
'
comparative_queue_viz.svg
'
,
bbox_extra_artists
=
(
lgd
,),
bbox_inches
=
'
tight
'
)
plt
.
show
()
if
not
interactive
:
plt
.
close
(
fig
)
def
plot_load_and_details_windows
(
expe_file
,
red_windows
=
None
,
yellow_windows
=
None
,
begin_time
=
24
,
end_time
=
48
,
tick_size
=
2
):
if
yellow_windows
is
None
:
yellow_windows
=
[]
if
red_windows
is
None
:
red_windows
=
[]
begin
,
end
=
begin_time
*
3600
,
end_time
*
3600
js
=
JobSetMulticore
.
from_csv
(
expe_file
+
"
/_jobs.csv
"
)
# js.df = js.df[(js.df.submission_time >= begin) & (js.df.submission_time < end)]
fig
,
axe
=
plt
.
subplots
(
nrows
=
2
,
sharex
=
True
,
figsize
=
(
16
,
8
),
tight_layout
=
True
)
fig
.
suptitle
(
expe_file
,
fontsize
=
16
)
vleg
.
plot_load
(
js
.
utilisation
,
js
.
MaxProcs
,
time_scale
=
False
,
ax
=
axe
[
0
])
vleg
.
plot_job_details
(
js
.
df
,
js
.
MaxProcs
,
time_scale
=
False
,
ax
=
axe
[
1
])
for
ax
in
axe
:
ax
.
xaxis
.
set_ticks
(
np
.
arange
(
begin
,
end
,
tick_size
*
3600
))
ax
.
xaxis
.
set_ticklabels
(
np
.
arange
(
begin_time
,
end_time
,
tick_size
))
for
window
in
yellow_windows
:
plt
.
sca
(
axe
[
0
])
plot_window
(
window
,
"
yellow
"
)
plt
.
sca
(
axe
[
1
])
plot_window
(
window
,
"
yellow
"
)
for
window
in
red_windows
:
plt
.
sca
(
axe
[
0
])
plot_window
(
window
,
"
red
"
)
plt
.
sca
(
axe
[
1
])
plot_window
(
window
,
"
red
"
)
plt
.
xlim
(
begin
,
end
)
fig
.
savefig
(
expe_file
+
'
_viz.png
'
)
fig
.
savefig
(
expe_file
+
'
_viz.svg
'
)
plt
.
show
()
plt
.
close
(
fig
)
This diff is collapsed.
Click to expand it.
scripts/util.py
+
0
−
18
View file @
dce70a5b
...
@@ -248,21 +248,3 @@ def energy_consumed_in_windows_fast(window_list, out_dir):
...
@@ -248,21 +248,3 @@ def energy_consumed_in_windows_fast(window_list, out_dir):
energy_array
[
j
]
=
energy_total
energy_array
[
j
]
=
energy_total
j
+=
1
j
+=
1
return
energy_array
return
energy_array
def
scheduling_metrics_in
(
window
,
OUT_DIR
):
"""
Return the usual scheduling metrics for the subpart of jobs that have their submission time within the time window.
"""
[
inf
,
sup
]
=
window
data
=
pandas
.
read_csv
(
OUT_DIR
+
"
/_jobs.csv
"
)
data_in_window
=
data
[(
data
.
submission_time
>=
inf
)
&
(
data
.
submission_time
<=
sup
)]
out
=
{}
out
[
"
makespan
"
]
=
data_in_window
[
"
finish_time
"
].
max
()
-
inf
out
[
"
#jobs
"
]
=
len
(
data_in_window
.
index
)
out
[
"
mean_waiting_time
"
]
=
data_in_window
[
"
waiting_time
"
].
mean
()
out
[
"
max_waiting_time
"
]
=
data_in_window
[
"
waiting_time
"
].
max
()
out
[
"
mean_slowdown
"
]
=
data_in_window
[
"
stretch
"
].
mean
()
out
[
"
max_slowdown
"
]
=
data_in_window
[
"
stretch
"
].
max
()
return
out
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