Skip to content
Snippets Groups Projects
Commit 41445b75 authored by jgatt's avatar jgatt
Browse files

now red_windows and yellow_windows are asummed to be sorted and disjoint +...

now red_windows and yellow_windows are asummed to be sorted and disjoint + changing test according to this change
parent 78c6ddae
No related branches found
No related tags found
1 merge request!16Merge request multibehavior
......@@ -313,7 +313,11 @@ DMWindow_list* Broker::parse_dm_windows(const std::string attr_name,
error_message = "Invalid user_description file: the field ";
error_message += attr_name;
error_message += " should be an array of intervals (pairs of integers).";
std::string error_message_sorted_disjoint = "Invalid user_description file : the field ";
error_message_sorted_disjoint += attr_name;
error_message_sorted_disjoint += " should be sorted and contains disjoint interval";
std::vector<DMWindow> windows_collect;
int last_bound = -1;
for (SizeType i = 0 ; i < windows_param.GetArray().Size(); i++) {
const Value &window =
(*user_description_file)[attr_name.c_str()].GetArray()[i];
......@@ -322,10 +326,14 @@ DMWindow_list* Broker::parse_dm_windows(const std::string attr_name,
&& window.GetArray()[0].IsInt()
&& window.GetArray()[1].IsInt(),
"%s", error_message.c_str());
DMWindow* dm_window =
new DMWindow(window.GetArray()[0].GetInt(),
window.GetArray()[1].GetInt());
windows_collect.push_back(*dm_window);
int begin_window = window.GetArray()[0].GetInt();
int end_window = window.GetArray()[1].GetInt();
PPK_ASSERT_ERROR(begin_window > last_bound,
"%s",error_message_sorted_disjoint.c_str());
last_bound = end_window;
DMWindow* to_add =
new DMWindow(begin_window,end_window);
windows_collect.push_back(*to_add);
}
return new DMWindow_list(windows_collect);
}
......
{
"seed" : -3,
"red_windows" : [[200000, 300000]],
"log_user_stats" : true,
"log_folder" : "test-out/dm_user_multi_behavior_small_workload-2machines/",
"users": [
{
"name": "user18",
"category": "dm_user_multi_behavior",
"param": {
"input_json": "test/workloads/dyn/user18.json",
"red_prob_rigid" : 0.2,
"red_prob_degrad" : 0.2,
"red_prob_reconfig" : 0.2,
"red_prob_renonce" : 0.2,
"red_prob_see_you_later": 0.2,
"yellow_prob_degrad" : 0.3,
"yellow_prob_reconfig" : 0.3,
"yellow_prob_rigid" : 0.3
}
},
{
"name": "user15",
"category": "dm_user_multi_behavior",
"param": {
"input_json": "test/workloads/dyn/user15.json",
"red_prob_rigid" : 0.2,
"red_prob_degrad" : 0.2,
"red_prob_reconfig" : 0.2,
"red_prob_renonce" : 0.2,
"red_prob_see_you_later": 0.2,
"yellow_prob_degrad" : 0.3,
"yellow_prob_reconfig" : 0.3,
"yellow_prob_rigid" : 0.3
}
}
]
}
\ No newline at end of file
......@@ -96,11 +96,19 @@ def test_invalid_yellow_prob(platform_multiC) :
out_dir = error_user("dm_user_multi_behavior_invalid_yellow_prob_" + str(i), platform_multiC, "yellow")
i += 1
def test_error_invalid_window(platform_multiC) :
invalid_windows_list = [[[0]], [[0.0, 1.0]], [[0, 1, 2]], [[0, 1], [1, 2], [3, 4], 5], [[1, 4.0]], [[1.0, 4]]]
def test_error_invalid_window_order(platform_multiC) :
invalid_windows_list = [[[2, 3], [0, 1]], [[0, 1], [1, 2]], [[1, 2], [0, 1]], [[0, 1], [2, 3], [4, 5], [5, 6]],
[[1, 4], [2, 6]], [[1, 4], [2, 3]]]
for i in range(len(invalid_windows_list)) :
invalid_window =invalid_windows_list[i]
make_error_file(3,invalid_window)
out_dir = error_user("dm_user_multi_behavior_invalid_windows_order_"+str(i),platform_multiC, "should be sorted and contains disjoint interval")
out_dir_2 = error_user("dm_user_multi_behavior_many_windows", platform_multiC,schedconf="test/schedconf/dm_user_multi_behavior_many_windows.json")
out_dir_3 = error_user("dm_user_multi_behavior_many_windows_wrong_order", platform_multiC,schedconf="test/schedconf/dm_user_multi_behavior_many_windows_wrong_order.json")
def test_error_invalid_window_type(platform_multiC) :
invalid_windows_list = [[[0]], [[0.0, 1.0]], [[0, 1, 2]], [[0, 1], [2, 3], [4, 5], 5], [[1, 4.0]], [[1.0, 4]]]
for i in range(len(invalid_windows_list)):
invalid_window = invalid_windows_list[i]
make_error_file(3, invalid_window)
out_dir = error_user("dm_user_multi_behavior_invalid_windows_"+str(i),platform_multiC, "should be an array of intervals (pairs of integers)")
out_dir = error_user("dm_user_multi_behavior_invalid_windows_type"+str(i),platform_multiC, "should be an array of intervals (pairs of integers)")
......@@ -78,13 +78,6 @@ def test_speedup():
def test_dm_user_multi_behavior(platform_multiC) :
out_dir_1 = run_user("dm_user_multi_behavior", platform_multiC)
out_dir_2 = run_user("dm_user_multi_behavior_many_windows", platform_multiC)
out_dir_3 = run_user("dm_user_multi_behavior_many_windows_wrong_order", platform_multiC)
content_1 = open(out_dir_1 + "/_jobs.csv").readlines()
content_2 = open(out_dir_2 + "/_jobs.csv").readlines()
content_3 = open(out_dir_3+ "/_jobs.csv").readlines()
assert (content_1 == content_2)
assert (content_2 == content_3)
def test_dm_user_multi_behavior_yellow(platform_multiC) :
run_user("dm_user_multi_behavior_yellow",platform_multiC)
......@@ -104,3 +97,6 @@ def test_dm_user_multi_behabior_monobehavior_yellow(platform_multiC) :
names = ["user" + str(i+14) for i in range(3)] + ["user18"]
input_json = ["test/workloads/dyn/user" + str(i+14) + ".json" for i in range(3)] + ["test/workloads/dyn/user18.json"]
monolithics_test(proba_names,names,input_json,seed=3,yellow_windows=[[200000, 300000]])
def test_dm_user_small_workload(platform_multiC) :
run_user("dm_user_multi_behavior_small_workload", platform_multiC)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment