Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
Demand Response User
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
Demand Response User
Commits
212d2130
Commit
212d2130
authored
3 years ago
by
Maël Madon
Browse files
Options
Downloads
Patches
Plain Diff
fix bug concurrent read of user_description_file
parent
624f9312
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
instance1.py
+1
-1
1 addition, 1 deletion
instance1.py
scripts/util.py
+36
-1
36 additions, 1 deletion
scripts/util.py
with
37 additions
and
2 deletions
instance1.py
+
1
−
1
View file @
212d2130
...
...
@@ -41,7 +41,7 @@ def run_expe(expe_num, user_category, window_size, clean_log):
wl_folder
=
f
'
{
WL_DIR
}
/expe
{
expe_num
}
'
pf
=
f
"
{
ROOT_DIR
}
/platform/average_metacentrum.xml
"
wl
=
f
"
{
WL_DIR
}
/empty_workload.json
"
uf
=
f
"
{
ROOT
_DIR
}
/
sched_input
/user_description_file.json
"
uf
=
f
"
{
EXPE
_DIR
}
/
cmd
/user_description_file.json
"
# Demand response window, from 12 to (12 + window_size) on day2
dm_window
=
[(
24
+
12
)
*
3600
,
(
int
)
((
24
+
12
+
window_size
)
*
3600
)]
...
...
This diff is collapsed.
Click to expand it.
scripts/util.py
+
36
−
1
View file @
212d2130
...
...
@@ -2,6 +2,8 @@
import
os
import
os.path
import
subprocess
import
numpy
as
np
import
pandas
from
matplotlib
import
figure
,
pyplot
as
plt
from
evalys.jobset
import
JobSet
from
evalys.metrics
import
compute_load
...
...
@@ -90,4 +92,37 @@ def plot_load_and_details(expe_file):
plt
.
xlim
(
begin
,
end
)
fig
.
savefig
(
expe_file
+
'
_viz.png
'
)
plt
.
show
()
plt
.
close
(
fig
)
\ No newline at end of file
plt
.
close
(
fig
)
def
energy_consumed_in
(
window
,
OUT_DIR
):
"""
Return the energy consumed during the time window (in kWh).
"""
# The problem is that batsim time series don't always have the specific
# timestamp, we need to extrapolate
data
=
pandas
.
read_csv
(
OUT_DIR
+
"
/_consumed_energy.csv
"
)
energy
=
[
0
,
0
]
for
i
in
range
(
2
):
first_greater
=
data
[
data
[
'
time
'
].
ge
(
window
[
i
])].
index
[
0
]
df_entry
=
data
.
iloc
[
first_greater
]
energy
[
i
]
=
df_entry
[
'
energy
'
]
delta_energy
=
(
df_entry
[
'
time
'
]
-
window
[
i
])
*
df_entry
[
'
epower
'
]
energy
[
i
]
-=
delta_energy
return
(
energy
[
1
]
-
energy
[
0
])
/
3600
/
1000
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
\ No newline at end of file
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