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

made changes for absolute path in python

parent 8888f80b
Branches
Tags
No related merge requests found
......@@ -8,6 +8,6 @@ jun1_unix_time, nov30_unix_time = mktime(strptime('Sun Jun 1 00:00:00 2014')),
jun1, nov30 = (int) (jun1_unix_time - begin_trace), (int) (nov30_unix_time - begin_trace)
start_date = randint(jun1, nov30 - 72 * 3600)
print(jun1)
# For every start date
# Call the one_instance file with this date
\ No newline at end of file
#!/usr/bin/env python3
import time
import sys
# import sys
import os
import subprocess
import argparse
sys.path.insert(0, '/scripts')
# sys.path.insert(0, '/scripts')
import scripts.swf_to_batsim_split_by_user as split_user
from scripts.run_batsim_exp import *
from scripts.util import *
#import swf_moulinette
......@@ -17,11 +17,11 @@ def prepare_input_data(expe_num, start_date):
end_date = start_date + 72*3600
to_keep = f"submit_time >= {start_date} and submit_time <= {end_date}"
if not os.path.exists(f'workload/expe{expe_num}'):
os.makedirs(f'workload/expe{expe_num}')
if not os.path.exists(f'{WL_DIR}/expe{expe_num}'):
os.makedirs(f'{WL_DIR}/expe{expe_num}')
split_user.generate_workload(
input_swf='workload/MC_selection_article.swf',
output_folder=f'workload/expe{expe_num}',
input_swf=f'{WL_DIR}/MC_selection_article.swf',
output_folder=f'{WL_DIR}/expe{expe_num}',
keep_only=to_keep,
job_grain=10,
job_walltime_factor=8)
......@@ -34,11 +34,12 @@ def run_expe(expe_num, user_category, window_size):
w_size = '05'
else:
w_size = f"{window_size}"
EXPE_FILE = f"out/expe{expe_num}/{user_category}_window{w_size}"
wl_folder = f'workload/expe{expe_num}'
pf = "platform/average_metacentrum.xml"
wl = "workload/empty_workload.json"
uf = "sched_input/user_description_file.json"
EXPE_DIR = f"{ROOT_DIR}/out/expe{expe_num}/{user_category}_window{w_size}"
EXPE_FILE = f"{EXPE_DIR}.yaml"
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"
# Demand response window, from 12 to (12 + window_size) on day2
dm_window = [(24+12)*3600, (24+12+window_size)*3600]
......@@ -54,23 +55,23 @@ def run_expe(expe_num, user_category, window_size):
data = {}
data["dm_window"] = dm_window
data["log_user_stats"] = True
data["log_folder"] = EXPE_FILE
data["log_folder"] = EXPE_DIR
data["users"] = [user_description(user) for user in user_names]
with open(uf, 'w') as user_description_file:
json.dump(data, user_description_file)
# Generate and run robin instance
batcmd = gen_batsim_cmd(
pf, wl, EXPE_FILE, "--energy --enable-compute-sharing --enable-dynamic-jobs --acknowledge-dynamic-jobs --enable-profile-reuse")
pf, wl, EXPE_DIR, "--energy --enable-compute-sharing --enable-dynamic-jobs --acknowledge-dynamic-jobs --enable-profile-reuse")
schedcmd = f"batsched -v bin_packing_energy --queue_order=desc_size --variant_options_filepath={uf}"
instance = RobinInstance(output_dir=EXPE_FILE,
instance = RobinInstance(output_dir=EXPE_DIR,
batcmd=batcmd,
schedcmd=schedcmd,
simulation_timeout=30, ready_timeout=5,
success_timeout=10, failure_timeout=0
)
instance.to_file(robin_filename)
ret = run_robin(robin_filename)
instance.to_file(EXPE_FILE)
ret = run_robin(EXPE_FILE)
......
......@@ -5,6 +5,9 @@ import subprocess
import filecmp
from collections import namedtuple
ROOT_DIR = os.path.realpath(os.path.join(os.path.dirname(__file__), '..'))
WL_DIR = f'{ROOT_DIR}/workload'
class RobinInstance(object):
def __init__(self, output_dir, batcmd, schedcmd, simulation_timeout, ready_timeout, success_timeout, failure_timeout):
self.output_dir = output_dir
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment