Skip to content
Snippets Groups Projects
Commit 4714041c authored by jgatt's avatar jgatt
Browse files

added test for user_stat_behavior

parent 0f45b612
No related branches found
No related tags found
1 merge request!16Merge request multibehavior
Pipeline #5659 passed
Showing
with 1558 additions and 5 deletions
user,job_id,submission_time,behavior_name,time_delayed
user14,0,0,C_you_later,3600
user14,1,1000,rigid,0
user14,0,3600,rigid,0
user,job_id,submission_time,behavior_name,time_delayed
user18,1384,119976,rigid,0
user18,1386,120259,rigid,0
user18,1387,120441,rigid,0
user18,1956,210993,consider_degrad,0
user18,1956,210993,degrad,0
user18,1962,211560,consider_reconfig,0
user18,1962,211560,reconfig,0
user15,2427,243133,renonce,0
user15,2428,243374,rigid,0
user15,2442,244342,renonce,0
user15,2443,244436,C_you_later,3600
user15,2443,248036,renonce,0
user15,8596,730546,rigid,0
user15,8597,730546,rigid,0
user15,8598,730564,rigid,0
job_id,workload_name,profile,submission_time,requested_number_of_resources,requested_time,success,final_state,starting_time,execution_time,finish_time,waiting_time,turnaround_time,stretch,allocated_resources,consumed_energy,metadata
1,user14,200,1000.000000,8,-1.000000,1,COMPLETED_SUCCESSFULLY,1000.000000,200.000000,1200.000000,0.000000,200.000000,1.000000,0,31700.000000,""
0,user14,200,3600.000000,8,-1.000000,1,COMPLETED_SUCCESSFULLY,3600.000000,200.000000,3800.000000,0.000000,200.000000,1.000000,0,31700.000000,""
job_id,workload_name,profile,submission_time,requested_number_of_resources,requested_time,success,final_state,starting_time,execution_time,finish_time,waiting_time,turnaround_time,stretch,allocated_resources,consumed_energy,metadata
1384,user18,10,119976.000000,4,7200.000000,1,COMPLETED_SUCCESSFULLY,119976.000000,10.000000,119986.000000,0.000000,10.000000,1.000000,0,1292.500000,""
1386,user18,60,120259.000000,4,7200.000000,1,COMPLETED_SUCCESSFULLY,120259.000000,60.000000,120319.000000,0.000000,60.000000,1.000000,0,7755.000000,""
1387,user18,60,120441.000000,4,7200.000000,1,COMPLETED_SUCCESSFULLY,120441.000000,60.000000,120501.000000,0.000000,60.000000,1.000000,0,7755.000000,""
1956,user18,d520,210993.000000,2,7200.000000,1,COMPLETED_SUCCESSFULLY,210993.000000,520.000000,211513.000000,0.000000,520.000000,1.000000,0,59605.000000,""
1962,user18,r580,211560.000000,2,7200.000000,1,COMPLETED_SUCCESSFULLY,211560.000000,1160.000000,212720.000000,0.000000,1160.000000,1.000000,0,132965.000000,""
2428,user15,18080,243374.000000,4,2592000.000000,1,COMPLETED_SUCCESSFULLY,243374.000000,18080.000000,261454.000000,0.000000,18080.000000,1.000000,0,2336840.000000,""
8598,user15,19250,730564.000000,4,2592000.000000,1,COMPLETED_SUCCESSFULLY,730564.000000,19250.000000,749814.000000,0.000000,19250.000000,1.000000,0,3614187.500000,""
8596,user15,22700,730546.000000,4,2592000.000000,1,COMPLETED_SUCCESSFULLY,730546.000000,22700.000000,753246.000000,0.000000,22700.000000,1.000000,0,4161012.500000,""
8597,user15,23550,730546.000000,4,2592000.000000,1,COMPLETED_SUCCESSFULLY,730546.000000,23550.000000,754096.000000,0.000000,23550.000000,1.000000,0,4270875.000000,""
This diff is collapsed.
......@@ -65,6 +65,15 @@ def assert_expected_output(test_file):
expected = 'test/expected_log/' + test_file + '_jobs.csv'
obtained = 'test-out/' + test_file + '/_jobs.csv'
assert filecmp.cmp(expected, obtained), f"\
Files {expected} and {obtained} should be equal but are not.\n\
Run `diff {expected} {obtained}` to investigate why.\n\
Run `cp {obtained} {expected}` to override the expected file with the obtained."
def assert_expected_behavior(test_file) :
expected = "test/expected_behavior_log/" + test_file + "_user_stats_behaviors.csv"
obtained = "test-out/" + test_file + "/user_stats_behaviors.csv"
if os.path.exists(expected) :
assert filecmp.cmp(expected, obtained), f"\
Files {expected} and {obtained} should be equal but are not.\n\
Run `diff {expected} {obtained}` to investigate why.\n\
Run `cp {obtained} {expected}` to override the expected file with the obtained."
\ No newline at end of file
{
"seed" : -3,
"red_windows" : [[0, 500]],
"log_user_stats" : true,
"log_folder" : "test-out/dm_user_multi_behavior_C_you_later_only_two_jobs-2machines",
"users": [
{
"name": "user14",
......
......@@ -6,8 +6,10 @@ create_dir_rec_if_needed("test-instances")
import json
def make_error_file(seed=None, red_windows=None, probas=[("red_prob_see_you_later", 1.0)], yellow_windows=None):
def make_error_file(seed=None, red_windows=None, probas=None, yellow_windows=None):
"""Create a simple user_description_file with the given parameters to check for proper handling of errors"""
if probas is None:
probas = [("red_prob_see_you_later", 1.0)]
param = {"input_json": "test/workloads/dyn/two_jobs.json"}
for proba in probas:
proba_name, proba_value = proba
......@@ -137,9 +139,10 @@ def test_error_intersection_red_yellow(platform_multiC):
intersecting_windows_list = [[[[300, 301], [400, 401]], [[399, 400]]],
[[[300, 400]], [[320, 350]]],
[[[300, 400]], [[250, 350]]]]
probas = [("red_prob_rigid",1.0),("yellow_prob_rigid",1.0)]
for i in range(len(intersecting_windows_list)):
intersecting_windows = intersecting_windows_list[i]
for j in range(1, 3):
make_error_file(3, red_windows=intersecting_windows[j % 2], yellow_windows=intersecting_windows[j // 2])
make_error_file(3, red_windows=intersecting_windows[j % 2], yellow_windows=intersecting_windows[j // 2],probas=probas)
error_user(f"dm_user_multi_behavior_intersecting_red_yellow_{i}_{j}", platform_multiC,
"at least one common element in their interval")
from helper import *
def test_expected_output(test_instance):
"""Test for each expected log (thanks to pytest fixtures) that the test was
run and the _jobs.csv outputs are strictly equal"""
run and the _jobs.csv outputs are strictly equal"""
assert_expected_output(test_instance)
assert_expected_behavior(test_instance)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment