34
34
level = logging .INFO ,
35
35
datefmt = '%I:%M:%S' )
36
36
37
- # Add support for Test Environment configuration
38
- from env import TestEnv
39
-
40
37
# Add JSON parsing support
41
38
from conf import JsonConf
42
39
49
46
50
47
class Executor ():
51
48
52
- def __init__ (self , target_conf = None , tests_conf = None ):
49
+ def __init__ (self , test_env , experiments_conf ):
53
50
"""
54
51
Tests Executor
55
52
@@ -58,73 +55,78 @@ def __init__(self, target_conf=None, tests_conf=None):
58
55
- a target configuration
59
56
- a worload to execute
60
57
61
- The executor module can be configured to run a set of workloads
62
- (wloads) in each different target configuration of a specified set
63
- (confs). These wloads and confs can be specified by the "tests_config"
64
- input dictionary.
58
+ The executor module can be configured to run a set of workloads (wloads)
59
+ in each different target configuration of a specified set (confs). These
60
+ wloads and confs can be specified by the "experiments_conf" input
61
+ dictionary. Each (workload, conf, iteration) tuple is called an
62
+ "experiment".
65
63
66
64
All the results generated by each experiment will be collected a result
67
65
folder which is named according to this template:
68
66
results/<test_id>/<wltype>:<conf>:<wload>/<run_id>
69
67
where:
70
- - <test_id> : the "tid" defined by the tests_config , or a timestamp
68
+ - <test_id> : the "tid" defined by the experiments_conf , or a timestamp
71
69
based folder in case "tid" is not specified
72
70
- <wltype> : the class of workload executed, e.g. rtapp or sched_perf
73
71
- <conf> : the identifier of one of the specified configurations
74
72
- <wload> : the identified of one of the specified workload
75
73
- <run_id> : the progressive execution number from 1 up to the
76
74
specified iterations
75
+
76
+ After the workloads have been run, the Executor object's `experiments`
77
+ attribute is a list of Experiment objects. The `out_dir` attribute of
78
+ these objects can be used to find the results of the experiment.
77
79
"""
78
80
79
81
# Initialize globals
80
82
self ._default_cgroup = None
81
83
self ._cgroup = None
82
84
83
85
# Setup test configuration
84
- if isinstance (tests_conf , dict ):
86
+ if isinstance (experiments_conf , dict ):
85
87
logging .info ('%14s - Loading custom (inline) test configuration' ,
86
88
'Target' )
87
- self ._tests_conf = tests_conf
88
- elif isinstance (tests_conf , str ):
89
+ self ._experiments_conf = experiments_conf
90
+ elif isinstance (experiments_conf , str ):
89
91
logging .info ('%14s - Loading custom (file) test configuration' ,
90
92
'Target' )
91
- json_conf = JsonConf (tests_conf )
92
- self ._tests_conf = json_conf .load ()
93
+ json_conf = JsonConf (experiments_conf )
94
+ self ._experiments_conf = json_conf .load ()
93
95
else :
94
- raise ValueError ('test_conf must be either a dictionary or a filepath' )
96
+ raise ValueError (
97
+ 'experiments_conf must be either a dictionary or a filepath' )
95
98
96
99
# Check for mandatory configurations
97
- if 'confs' not in self ._tests_conf or not self . _tests_conf [ 'confs' ] :
100
+ if not self ._experiments_conf . get ( 'confs' , None ) :
98
101
raise ValueError (
99
102
'Configuration error: missing \' conf\' definitions' )
100
- if 'wloads' not in self ._tests_conf or not self . _tests_conf [ 'wloads' ] :
103
+ if not self ._experiments_conf . get ( 'wloads' , None ) :
101
104
raise ValueError (
102
105
'Configuration error: missing \' wloads\' definitions' )
103
106
104
- # Setup devlib to access the configured target
105
- self .te = TestEnv (target_conf , tests_conf )
107
+ self .te = test_env
106
108
self .target = self .te .target
107
109
108
- self ._iterations = self ._tests_conf .get ('iterations' , 1 )
110
+ self ._iterations = self ._experiments_conf .get ('iterations' , 1 )
109
111
# Compute total number of experiments
110
112
self ._exp_count = self ._iterations \
111
- * len (self ._tests_conf ['wloads' ]) \
112
- * len (self ._tests_conf ['confs' ])
113
+ * len (self ._experiments_conf ['wloads' ]) \
114
+ * len (self ._experiments_conf ['confs' ])
113
115
114
116
self ._print_section ('Executor' , 'Experiments configuration' )
115
117
116
118
logging .info ('%14s - Configured to run:' , 'Executor' )
117
119
118
120
logging .info ('%14s - %3d target configurations:' ,
119
- 'Executor' , len (self ._tests_conf ['confs' ]))
120
- target_confs = [conf ['tag' ] for conf in self ._tests_conf ['confs' ]]
121
+ 'Executor' , len (self ._experiments_conf ['confs' ]))
122
+ target_confs = [conf ['tag' ] for conf in self ._experiments_conf ['confs' ]]
121
123
target_confs = ', ' .join (target_confs )
122
124
logging .info ('%14s - %s' , 'Executor' , target_confs )
123
125
124
126
logging .info ('%14s - %3d workloads (%d iterations each)' ,
125
- 'Executor' , len (self ._tests_conf ['wloads' ]),
127
+ 'Executor' , len (self ._experiments_conf ['wloads' ]),
126
128
self ._iterations )
127
- wload_confs = ', ' .join (self ._tests_conf ['wloads' ])
129
+ wload_confs = ', ' .join (self ._experiments_conf ['wloads' ])
128
130
logging .info ('%14s - %s' , 'Executor' , wload_confs )
129
131
130
132
logging .info ('%14s - Total: %d experiments' ,
@@ -140,11 +142,11 @@ def run(self):
140
142
141
143
# Run all the configured experiments
142
144
exp_idx = 0
143
- for tc in self ._tests_conf ['confs' ]:
145
+ for tc in self ._experiments_conf ['confs' ]:
144
146
# TARGET: configuration
145
147
if not self ._target_configure (tc ):
146
148
continue
147
- for wl_idx in self ._tests_conf ['wloads' ]:
149
+ for wl_idx in self ._experiments_conf ['wloads' ]:
148
150
# TEST: configuration
149
151
wload , test_dir = self ._wload_init (tc , wl_idx )
150
152
for itr_idx in range (1 , self ._iterations + 1 ):
@@ -502,7 +504,7 @@ def _wload_init(self, tc, wl_idx):
502
504
tc_idx = tc ['tag' ]
503
505
504
506
# Configure the test workload
505
- wlspec = self ._tests_conf ['wloads' ][wl_idx ]
507
+ wlspec = self ._experiments_conf ['wloads' ][wl_idx ]
506
508
wload = self ._wload_conf (wl_idx , wlspec )
507
509
508
510
# Keep track of platform configuration
0 commit comments