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

test: add the case of an undersized plateform file

parent 20245fb4
No related branches found
No related tags found
1 merge request!2Feature "replay with feedback" ready and tested
Pipeline #4513 passed
......@@ -22,7 +22,7 @@ def clean_and_select(df):
select["job_id"] = select["job_id"].str.split(':', expand=True)[0]
select.job_id = select.job_id.astype(int)
return select.sort_values(by="job_id")
return select.sort_values(by="job_id").set_index("job_id")
def open_and_compare(file1, file2):
......@@ -35,7 +35,7 @@ def open_and_compare(file1, file2):
out1 = clean_and_select(out1)
out2 = clean_and_select(out2)
if not out1.job_id.equals(out2.job_id):
if not out1.index.equals(out2.index):
raise KeyError(
f"{file1} and {file2} cannot be compared: they don't have the same job_ids")
......
......@@ -95,7 +95,7 @@ def test_tt_only_simple_workload():
launch_fb_test_1user(user_category='fb_user_think_time_only',
test_input='proto_SABjson_v2')
def assert_simu_output_are_close_enough(out_dir1, out_dir2):
def simu_output_are_close_enough(out_dir1, out_dir2):
"""Returns true if the jobs.csv in both directories are epsilon-close (for
the normalized euclidean distance) for each of the fields submission time,
start time and finish time."""
......@@ -104,9 +104,10 @@ def assert_simu_output_are_close_enough(out_dir1, out_dir2):
dis = distances(f"{out_dir1}/_jobs.csv", f"{out_dir2}/_jobs.csv",
euclidean=False, norm_eucl=True,
field=["submission_time", "starting_time", "finish_time"])
assert dis["submission_time"]["normalized_euclidean"] < epsilon
assert dis["starting_time"]["normalized_euclidean"] < epsilon
assert dis["finish_time"]["normalized_euclidean"] < epsilon
return dis["submission_time"]["normalized_euclidean"] < epsilon and (
dis["starting_time"]["normalized_euclidean"] < epsilon) and (
dis["finish_time"]["normalized_euclidean"] < epsilon)
def test_tt_only_multiuser():
......@@ -139,7 +140,7 @@ def test_tt_only_multiuser():
user_name=names, user_category=[category]*4, input_json=jsons)
feedback_dir = run_user(category, mc_europar_platform, empty_workload,
test_name=f'{category}-{test_name}', schedconf=schedconf_file)
assert_simu_output_are_close_enough(feedback_dir, rigid_dir)
assert simu_output_are_close_enough(feedback_dir, rigid_dir)
# mc_10_days_l60
test_name = "mc_10days_l60"
......@@ -148,7 +149,7 @@ def test_tt_only_multiuser():
user_name=names, user_category=[category]*4, input_json=jsons)
run_user(category, mc_europar_platform, empty_workload,
test_name=f'{category}-{test_name}', schedconf=schedconf_file)
assert_simu_output_are_close_enough(feedback_dir, rigid_dir)
assert simu_output_are_close_enough(feedback_dir, rigid_dir)
# mc_10_days_m60
......@@ -158,7 +159,53 @@ def test_tt_only_multiuser():
user_name=names, user_category=[category]*4, input_json=jsons)
run_user(category, mc_europar_platform, empty_workload,
test_name=f'{category}-{test_name}', schedconf=schedconf_file)
assert_simu_output_are_close_enough(feedback_dir, rigid_dir)
assert simu_output_are_close_enough(feedback_dir, rigid_dir)
def test_tt_only_multiuser_undersized_platform():
"""Same test than the previous one, but with an undersized plateform."""
names = ["user5", "user9", "user10", "user11"]
# Launch a simulation with replay rigid, for comparison
category = "replay_user_rigid"
test_name = "mc_10days"
jsons = [f"test/workloads/split_by_user/{user}.json" for user in names]
make_fb_user_description_file(
user_name=names, user_category=[category]*4, input_json=jsons)
rigid_dir = run_user(category, two_machine_platform, empty_workload,
test_name=f'{category}-{test_name}_undersized', schedconf=schedconf_file)
# Launch feedback users on the same original log, and compare with rigid
category = "fb_user_think_time_only"
# mc_10_days_a60
test_name = "mc_10days_a60"
jsons = [f"test/workloads/SABjson/{test_name}/{user}.SABjson" for user in names]
make_fb_user_description_file(
user_name=names, user_category=[category]*4, input_json=jsons)
feedback_dir = run_user(category, two_machine_platform, empty_workload,
test_name=f'{category}-{test_name}_undersized', schedconf=schedconf_file)
assert not simu_output_are_close_enough(feedback_dir, rigid_dir)
# mc_10_days_l60
test_name = "mc_10days_l60"
jsons = [f"test/workloads/SABjson/{test_name}/{user}.SABjson" for user in names]
make_fb_user_description_file(
user_name=names, user_category=[category]*4, input_json=jsons)
run_user(category, two_machine_platform, empty_workload,
test_name=f'{category}-{test_name}_undersized', schedconf=schedconf_file)
assert not simu_output_are_close_enough(feedback_dir, rigid_dir)
# mc_10_days_m60
test_name = "mc_10days_m60"
jsons = [f"test/workloads/SABjson/{test_name}/{user}.SABjson" for user in names]
make_fb_user_description_file(
user_name=names, user_category=[category]*4, input_json=jsons)
run_user(category, two_machine_platform, empty_workload,
test_name=f'{category}-{test_name}_undersized', schedconf=schedconf_file)
assert not simu_output_are_close_enough(feedback_dir, rigid_dir)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment