Skip to content
Snippets Groups Projects
Commit 212d2130 authored by Maël Madon's avatar Maël Madon
Browse files

fix bug concurrent read of user_description_file

parent 624f9312
No related branches found
No related tags found
No related merge requests found
...@@ -41,7 +41,7 @@ def run_expe(expe_num, user_category, window_size, clean_log): ...@@ -41,7 +41,7 @@ def run_expe(expe_num, user_category, window_size, clean_log):
wl_folder = f'{WL_DIR}/expe{expe_num}' wl_folder = f'{WL_DIR}/expe{expe_num}'
pf = f"{ROOT_DIR}/platform/average_metacentrum.xml" pf = f"{ROOT_DIR}/platform/average_metacentrum.xml"
wl = f"{WL_DIR}/empty_workload.json" 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 # Demand response window, from 12 to (12 + window_size) on day2
dm_window = [(24+12)*3600, (int) ((24+12+window_size)*3600)] dm_window = [(24+12)*3600, (int) ((24+12+window_size)*3600)]
......
...@@ -2,6 +2,8 @@ ...@@ -2,6 +2,8 @@
import os import os
import os.path import os.path
import subprocess import subprocess
import numpy as np
import pandas
from matplotlib import figure, pyplot as plt from matplotlib import figure, pyplot as plt
from evalys.jobset import JobSet from evalys.jobset import JobSet
from evalys.metrics import compute_load from evalys.metrics import compute_load
...@@ -90,4 +92,37 @@ def plot_load_and_details(expe_file): ...@@ -90,4 +92,37 @@ def plot_load_and_details(expe_file):
plt.xlim(begin, end) plt.xlim(begin, end)
fig.savefig(expe_file + '_viz.png') fig.savefig(expe_file + '_viz.png')
plt.show() plt.show()
plt.close(fig) plt.close(fig)
\ No newline at end of file
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
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment