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

test: add expected output for edge cases. Still need to test and debug

parent d15da923
Branches
Tags
No related merge requests found
......@@ -15,18 +15,18 @@ def create_dir_rec_if_needed(dirname):
os.makedirs(dirname)
def run_script(delim,
threshold,
input_swf=KTH_WL.swf_file,
dyn_red=True,
graph=False):
if input_swf == KTH_WL.swf_file:
pfx = "KTH"
else:
pfx = input_swf.split("/")[-1].split(".")[0]
test_name = f"{pfx}_{delim}_t{threshold}"
if not dyn_red:
test_name += "_nodyn"
def run_script(delim, threshold,
input_swf=KTH_WL.swf_file, test_name=None,
dyn_red=True, graph=False):
if test_name is None:
if input_swf == KTH_WL.swf_file:
pfx = "KTH"
else:
pfx = input_swf.split("/")[-1].split(".")[0]
test_name = f"{pfx}_{delim}_t{threshold}"
if not dyn_red:
test_name += "_nodyn"
out_dir = os.path.abspath(f'test-out/{test_name}')
create_dir_rec_if_needed(out_dir)
......
......@@ -36,18 +36,25 @@
},
{
"id": 3,
"first_submit_time": 10000.0,
"first_submit_time": 9000.0,
"preceding_sessions": [
2
],
"thinking_time_after_preceding_session": [
7000.0
6000.0
],
"nb_jobs": 1,
"nb_jobs": 2,
"jobs": [
{
"id": 3,
"profile": "1000",
"id": 5,
"profile": "5000",
"res": 16,
"subtime": 0.0,
"walltime": 2592000.0
},
{
"id": 6,
"profile": "5000",
"res": 16,
"subtime": 0.0,
"walltime": 2592000.0
......@@ -56,17 +63,17 @@
},
{
"id": 4,
"first_submit_time": 12000.0,
"first_submit_time": 10000.0,
"preceding_sessions": [
3
2
],
"thinking_time_after_preceding_session": [
1000.0
7000.0
],
"nb_jobs": 1,
"jobs": [
{
"id": 4,
"id": 3,
"profile": "1000",
"res": 16,
"subtime": 0.0,
......@@ -76,25 +83,18 @@
},
{
"id": 5,
"first_submit_time": 9000.0,
"first_submit_time": 12000.0,
"preceding_sessions": [
2
4
],
"thinking_time_after_preceding_session": [
6000.0
1000.0
],
"nb_jobs": 2,
"nb_jobs": 1,
"jobs": [
{
"id": 5,
"profile": "5000",
"res": 16,
"subtime": 0.0,
"walltime": 2592000.0
},
{
"id": 6,
"profile": "5000",
"id": 4,
"profile": "1000",
"res": 16,
"subtime": 0.0,
"walltime": 2592000.0
......
{
"description": "A session (session 1) has five followers, four with a think time of 1000s and one with a think time of 2000s.",
"description": "A session (session 1) has five followers: four with a think time of 1000s, 1001s, 1002s and 1003s respectively (had to be changed compared to the batmen test) and one with a think time of 2000s.",
"nb_res": 16,
"sessions": [
{
......@@ -36,9 +36,9 @@
},
{
"id": 3,
"first_submit_time": 2000.0,
"first_submit_time": 2001.0,
"preceding_sessions": [1],
"thinking_time_after_preceding_session": [1000],
"thinking_time_after_preceding_session": [1001],
"nb_jobs": 1,
"jobs": [
{
......@@ -52,9 +52,9 @@
},
{
"id": 4,
"first_submit_time": 2000.0,
"first_submit_time": 2002.0,
"preceding_sessions": [1],
"thinking_time_after_preceding_session": [1000],
"thinking_time_after_preceding_session": [1002],
"nb_jobs": 1,
"jobs": [
{
......@@ -68,9 +68,9 @@
},
{
"id": 5,
"first_submit_time": 2000.0,
"first_submit_time": 2003.0,
"preceding_sessions": [1],
"thinking_time_after_preceding_session": [1000],
"thinking_time_after_preceding_session": [1003],
"nb_jobs": 1,
"jobs": [
{
......
{
"description": "A session (session 6) depends on five others, with a think time of 1000s.",
"description": "A session (session 6) depends on five others, with a think time of 1000s. Slightly different than batmen version.",
"nb_res": 16,
"sessions": [
{
......@@ -20,14 +20,14 @@
},
{
"id": 2,
"first_submit_time": 1000.0,
"first_submit_time": 1001.0,
"preceding_sessions": [],
"thinking_time_after_preceding_session": [],
"nb_jobs": 1,
"jobs": [
{
"id": 2,
"profile": "2000",
"profile": "1500",
"res": 16,
"subtime": 0.0,
"walltime": 2592000.0
......@@ -36,7 +36,7 @@
},
{
"id": 3,
"first_submit_time": 1000.0,
"first_submit_time": 1002.0,
"preceding_sessions": [],
"thinking_time_after_preceding_session": [],
"nb_jobs": 1,
......
{
"description": "Five start sessions with no dependency between them.",
"nb_res": 16,
"sessions": [
{
"id": 1,
"first_submit_time": 1000.0,
"preceding_sessions": [],
"thinking_time_after_preceding_session": [],
"nb_jobs": 1,
"jobs": [
{
"id": 1,
"profile": "1000",
"res": 16,
"subtime": 0.0,
"walltime": 2592000.0
}
]
},
{
"id": 2,
"first_submit_time": 1000.0,
"preceding_sessions": [],
"thinking_time_after_preceding_session": [],
"nb_jobs": 1,
"jobs": [
{
"id": 2,
"profile": "2000",
"res": 16,
"subtime": 0.0,
"walltime": 2592000.0
}
]
},
{
"id": 3,
"first_submit_time": 1000.0,
"preceding_sessions": [],
"thinking_time_after_preceding_session": [],
"nb_jobs": 1,
"jobs": [
{
"id": 3,
"profile": "1000",
"res": 16,
"subtime": 0.0,
"walltime": 2592000.0
}
]
},
{
"id": 4,
"first_submit_time": 1500.0,
"preceding_sessions": [],
"thinking_time_after_preceding_session": [],
"nb_jobs": 1,
"jobs": [
{
"id": 4,
"profile": "1000",
"res": 16,
"subtime": 0.0,
"walltime": 2592000.0
}
]
},
{
"id": 5,
"first_submit_time": 2000.0,
"preceding_sessions": [],
"thinking_time_after_preceding_session": [],
"nb_jobs": 1,
"jobs": [
{
"id": 5,
"profile": "1000",
"res": 16,
"subtime": 0.0,
"walltime": 2592000.0
}
]
}
]
}
\ No newline at end of file
......@@ -20,7 +20,7 @@
},
{
"id": 2,
"first_submit_time": 2000.0,
"first_submit_time": 1000.0,
"preceding_sessions": [1],
"thinking_time_after_preceding_session": [0],
"nb_jobs": 1,
......
......@@ -56,4 +56,18 @@ def test_example_workload():
test_name = "example_last_t30"
run_script(delim="last", threshold=30, input_swf="workloads/example.swf")
compare_with_expected_output(test_name)
\ No newline at end of file
compare_with_expected_output(test_name)
def test_edge_cases():
"""Hand written SWF and SABjson files, testing some edge cases.
Same tests than in batmen."""
test_name = "load_platform"
run_script(delim="arrival", threshold=10,
input_swf=f"test/workload/{test_name}.swf", test_name=test_name)
compare_with_expected_output(test_name)
test_name = "many_following"
run_script(delim="arrival", threshold=0,
input_swf=f"test/workload/{test_name}.swf", test_name=test_name)
compare_with_expected_output(test_name)
; Written by hand.
; Expected to produce load_platform.SABjson with arrival_t10
1 0 0 1000 16 -1 -1 16 2592000 -1 1 1 1 -1 -1 -1 -1 -1
2 2000 0 1000 16 -1 -1 16 2592000 -1 1 1 1 -1 -1 -1 -1 -1
5 9000 0 5000 16 -1 -1 16 2592000 -1 1 1 1 -1 -1 -1 -1 -1
6 9000 0 5000 16 -1 -1 16 2592000 -1 1 1 1 -1 -1 -1 -1 -1
3 10000 0 1000 16 -1 -1 16 2592000 -1 1 1 1 -1 -1 -1 -1 -1
4 12000 0 1000 16 -1 -1 16 2592000 -1 1 1 1 -1 -1 -1 -1 -1
; Written by hand.
; Expected to produce many_following.SABjson with arrival_t0
1 0 0 1000 16 -1 -1 16 2592000 -1 1 1 1 -1 -1 -1 -1 -1
2 2000 0 2000 16 -1 -1 16 2592000 -1 1 1 1 -1 -1 -1 -1 -1
3 2001 0 1000 16 -1 -1 16 2592000 -1 1 1 1 -1 -1 -1 -1 -1
4 2002 0 1000 16 -1 -1 16 2592000 -1 1 1 1 -1 -1 -1 -1 -1
5 2003 0 1000 16 -1 -1 16 2592000 -1 1 1 1 -1 -1 -1 -1 -1
6 3000 0 1000 16 -1 -1 16 2592000 -1 1 1 1 -1 -1 -1 -1 -1
; Written by hand.
; Expected to produce many_preceding.SABjson with arrival_t0
1 1000 1000 1000 16 -1 -1 16 2592000 -1 1 1 1 -1 -1 -1 -1 -1
2 1001 499 1500 16 -1 -1 16 2592000 -1 1 1 1 -1 -1 -1 -1 -1
3 1002 998 1000 16 -1 -1 16 2592000 -1 1 1 1 -1 -1 -1 -1 -1
4 1500 500 1000 16 -1 -1 16 2592000 -1 1 1 1 -1 -1 -1 -1 -1
5 2000 0 1000 16 -1 -1 16 2592000 -1 1 1 1 -1 -1 -1 -1 -1
6 4000 0 1000 16 -1 -1 16 2592000 -1 1 1 1 -1 -1 -1 -1 -1
; Written by hand.
; Expected to produce no_session.SABjson, whatever the delimitation approach
; Written by hand.
; Expected to produce one_session_many_jobs.SABjson with last_t10
750 0 0 450 16 -1 -1 16 86400 -1 1 1 1 -1 -1 -1 -1 -1
751 591 0 210 16 -1 -1 16 86400 -1 1 1 1 -1 -1 -1 -1 -1
752 767 0 81540 16 -1 -1 16 163068 -1 1 1 1 -1 -1 -1 -1 -1
757 895 0 86140 16 -1 -1 16 172260 -1 1 1 1 -1 -1 -1 -1 -1
758 959 0 86130 16 -1 -1 16 172250 -1 1 1 1 -1 -1 -1 -1 -1
768 1537 0 920 16 -1 -1 16 86400 -1 1 1 1 -1 -1 -1 -1 -1
781 1841 0 290 16 -1 -1 16 86400 -1 1 1 1 -1 -1 -1 -1 -1
791 2068 0 86130 16 -1 -1 16 172248 -1 1 1 1 -1 -1 -1 -1 -1
794 2149 0 86120 16 -1 -1 16 172226 -1 1 1 1 -1 -1 -1 -1 -1
795 2533 0 86130 16 -1 -1 16 172246 -1 1 1 1 -1 -1 -1 -1 -1
; Written by hand.
; Expected to produce many_preceding.SABjson with last_t0
1 0 1000 1000 16 -1 -1 16 2592000 -1 1 1 1 -1 -1 -1 -1 -1
2 2000 0 2000 16 -1 -1 16 2592000 -1 1 1 1 -1 -1 -1 -1 -1
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment