koder aka kdanilov | 4643fd6 | 2015-02-10 16:20:13 -0800 | [diff] [blame] | 1 | import abc |
koder aka kdanilov | bc2c898 | 2015-06-13 02:50:43 +0300 | [diff] [blame] | 2 | import time |
| 3 | import logging |
koder aka kdanilov | 4643fd6 | 2015-02-10 16:20:13 -0800 | [diff] [blame] | 4 | import os.path |
koder aka kdanilov | 7022706 | 2016-11-26 23:23:21 +0200 | [diff] [blame] | 5 | import datetime |
koder aka kdanilov | 7f59d56 | 2016-12-26 01:34:23 +0200 | [diff] [blame^] | 6 | from typing import Dict, Any, List, Optional, Callable, cast |
koder aka kdanilov | 652cd80 | 2015-04-13 12:21:07 +0300 | [diff] [blame] | 7 | |
koder aka kdanilov | 23e6bdf | 2016-12-24 02:18:54 +0200 | [diff] [blame] | 8 | from concurrent.futures import ThreadPoolExecutor, wait |
koder aka kdanilov | 4643fd6 | 2015-02-10 16:20:13 -0800 | [diff] [blame] | 9 | |
koder aka kdanilov | 7022706 | 2016-11-26 23:23:21 +0200 | [diff] [blame] | 10 | from ..utils import Barrier, StopTestError, sec_to_str |
| 11 | from ..node_interfaces import IRPCNode |
koder aka kdanilov | 3d2bc4f | 2016-11-12 18:31:18 +0200 | [diff] [blame] | 12 | from ..storage import Storage |
koder aka kdanilov | 7f59d56 | 2016-12-26 01:34:23 +0200 | [diff] [blame^] | 13 | from ..result_classes import NodeTestResults, IStorable |
| 14 | from queue import Queue |
koder aka kdanilov | 7022706 | 2016-11-26 23:23:21 +0200 | [diff] [blame] | 15 | |
koder aka kdanilov | 4af1c1d | 2015-05-18 15:48:58 +0300 | [diff] [blame] | 16 | |
koder aka kdanilov | bc2c898 | 2015-06-13 02:50:43 +0300 | [diff] [blame] | 17 | logger = logging.getLogger("wally") |
koder aka kdanilov | 88407ff | 2015-05-26 15:35:57 +0300 | [diff] [blame] | 18 | |
| 19 | |
koder aka kdanilov | 7022706 | 2016-11-26 23:23:21 +0200 | [diff] [blame] | 20 | __doc__ = "Contains base classes for performance tests" |
| 21 | |
| 22 | |
| 23 | class TestInputConfig: |
koder aka kdanilov | bc2c898 | 2015-06-13 02:50:43 +0300 | [diff] [blame] | 24 | """ |
| 25 | this class describe test input configuration |
koder aka kdanilov | 88407ff | 2015-05-26 15:35:57 +0300 | [diff] [blame] | 26 | |
koder aka kdanilov | 7022706 | 2016-11-26 23:23:21 +0200 | [diff] [blame] | 27 | test_type - test type name |
| 28 | params - parameters from yaml file for this test |
| 29 | test_uuid - UUID to be used to create file names & Co |
| 30 | log_directory - local directory to store results |
| 31 | nodes - nodes to run tests on |
| 32 | remote_dir - directory on nodes to be used for local files |
koder aka kdanilov | bc2c898 | 2015-06-13 02:50:43 +0300 | [diff] [blame] | 33 | """ |
koder aka kdanilov | 3b4da8b | 2016-10-17 00:17:53 +0300 | [diff] [blame] | 34 | def __init__(self, |
| 35 | test_type: str, |
| 36 | params: Dict[str, Any], |
koder aka kdanilov | 3d2bc4f | 2016-11-12 18:31:18 +0200 | [diff] [blame] | 37 | run_uuid: str, |
koder aka kdanilov | 7022706 | 2016-11-26 23:23:21 +0200 | [diff] [blame] | 38 | nodes: List[IRPCNode], |
koder aka kdanilov | 3d2bc4f | 2016-11-12 18:31:18 +0200 | [diff] [blame] | 39 | storage: Storage, |
koder aka kdanilov | 7022706 | 2016-11-26 23:23:21 +0200 | [diff] [blame] | 40 | remote_dir: str) -> None: |
koder aka kdanilov | bc2c898 | 2015-06-13 02:50:43 +0300 | [diff] [blame] | 41 | self.test_type = test_type |
| 42 | self.params = params |
koder aka kdanilov | 3d2bc4f | 2016-11-12 18:31:18 +0200 | [diff] [blame] | 43 | self.run_uuid = run_uuid |
koder aka kdanilov | bc2c898 | 2015-06-13 02:50:43 +0300 | [diff] [blame] | 44 | self.nodes = nodes |
koder aka kdanilov | 3d2bc4f | 2016-11-12 18:31:18 +0200 | [diff] [blame] | 45 | self.storage = storage |
koder aka kdanilov | bc2c898 | 2015-06-13 02:50:43 +0300 | [diff] [blame] | 46 | self.remote_dir = remote_dir |
koder aka kdanilov | 88407ff | 2015-05-26 15:35:57 +0300 | [diff] [blame] | 47 | |
| 48 | |
koder aka kdanilov | 7f59d56 | 2016-12-26 01:34:23 +0200 | [diff] [blame^] | 49 | class IterationConfig(IStorable): |
koder aka kdanilov | 7022706 | 2016-11-26 23:23:21 +0200 | [diff] [blame] | 50 | name = None # type: str |
koder aka kdanilov | 23e6bdf | 2016-12-24 02:18:54 +0200 | [diff] [blame] | 51 | summary = None # type: str |
koder aka kdanilov | bc2c898 | 2015-06-13 02:50:43 +0300 | [diff] [blame] | 52 | |
| 53 | |
koder aka kdanilov | 7f59d56 | 2016-12-26 01:34:23 +0200 | [diff] [blame^] | 54 | class PerfTest(metaclass=abc.ABCMeta): |
koder aka kdanilov | 7022706 | 2016-11-26 23:23:21 +0200 | [diff] [blame] | 55 | """Base class for all tests""" |
| 56 | name = None # type: str |
| 57 | max_retry = 3 |
| 58 | retry_time = 30 |
| 59 | |
koder aka kdanilov | 7f59d56 | 2016-12-26 01:34:23 +0200 | [diff] [blame^] | 60 | def __init__(self, config: TestInputConfig, on_idle: Callable[[], None] = None) -> None: |
koder aka kdanilov | bc2c898 | 2015-06-13 02:50:43 +0300 | [diff] [blame] | 61 | self.config = config |
koder aka kdanilov | e2de58c | 2015-04-24 22:59:36 +0300 | [diff] [blame] | 62 | self.stop_requested = False |
koder aka kdanilov | 7022706 | 2016-11-26 23:23:21 +0200 | [diff] [blame] | 63 | self.nodes = self.config.nodes # type: List[IRPCNode] |
| 64 | self.sorted_nodes_ids = sorted(node.info.node_id() for node in self.nodes) |
koder aka kdanilov | 7f59d56 | 2016-12-26 01:34:23 +0200 | [diff] [blame^] | 65 | self.on_idle = on_idle |
koder aka kdanilov | e2de58c | 2015-04-24 22:59:36 +0300 | [diff] [blame] | 66 | |
koder aka kdanilov | 3b4da8b | 2016-10-17 00:17:53 +0300 | [diff] [blame] | 67 | def request_stop(self) -> None: |
koder aka kdanilov | e2de58c | 2015-04-24 22:59:36 +0300 | [diff] [blame] | 68 | self.stop_requested = True |
koder aka kdanilov | 2066daf | 2015-04-23 21:05:41 +0300 | [diff] [blame] | 69 | |
koder aka kdanilov | 3b4da8b | 2016-10-17 00:17:53 +0300 | [diff] [blame] | 70 | def join_remote(self, path: str) -> str: |
koder aka kdanilov | bc2c898 | 2015-06-13 02:50:43 +0300 | [diff] [blame] | 71 | return os.path.join(self.config.remote_dir, path) |
koder aka kdanilov | 4500a5f | 2015-04-17 16:55:17 +0300 | [diff] [blame] | 72 | |
koder aka kdanilov | 4af1c1d | 2015-05-18 15:48:58 +0300 | [diff] [blame] | 73 | @abc.abstractmethod |
koder aka kdanilov | bbbe1dc | 2016-12-20 01:19:56 +0200 | [diff] [blame] | 74 | def run(self) -> None: |
koder aka kdanilov | 4643fd6 | 2015-02-10 16:20:13 -0800 | [diff] [blame] | 75 | pass |
| 76 | |
koder aka kdanilov | bc2c898 | 2015-06-13 02:50:43 +0300 | [diff] [blame] | 77 | @abc.abstractmethod |
koder aka kdanilov | 39e449e | 2016-12-17 15:15:26 +0200 | [diff] [blame] | 78 | def format_for_console(self, data: Any) -> str: |
koder aka kdanilov | ec1b973 | 2015-04-23 20:43:29 +0300 | [diff] [blame] | 79 | pass |
| 80 | |
koder aka kdanilov | 4643fd6 | 2015-02-10 16:20:13 -0800 | [diff] [blame] | 81 | |
koder aka kdanilov | 7022706 | 2016-11-26 23:23:21 +0200 | [diff] [blame] | 82 | class ThreadedTest(PerfTest, metaclass=abc.ABCMeta): |
| 83 | """Base class for tests, which spawn separated thread for each node""" |
| 84 | |
| 85 | # max allowed time difference between starts and stops of run of the same test on different test nodes |
| 86 | # used_max_diff = max((min_run_time * max_rel_time_diff), max_time_diff) |
| 87 | max_time_diff = 5 |
| 88 | max_rel_time_diff = 0.05 |
| 89 | |
koder aka kdanilov | 7f59d56 | 2016-12-26 01:34:23 +0200 | [diff] [blame^] | 90 | def __init__(self, *args, **kwargs) -> None: |
| 91 | PerfTest.__init__(self, *args, **kwargs) |
koder aka kdanilov | 7022706 | 2016-11-26 23:23:21 +0200 | [diff] [blame] | 92 | self.iterations_configs = [None] # type: List[Optional[IterationConfig]] |
koder aka kdanilov | 7f59d56 | 2016-12-26 01:34:23 +0200 | [diff] [blame^] | 93 | self.storage_q = Queue() # type: Any |
koder aka kdanilov | bc2c898 | 2015-06-13 02:50:43 +0300 | [diff] [blame] | 94 | |
| 95 | @abc.abstractmethod |
koder aka kdanilov | 7022706 | 2016-11-26 23:23:21 +0200 | [diff] [blame] | 96 | def get_expected_runtime(self, iter_cfg: IterationConfig) -> Optional[int]: |
koder aka kdanilov | bc2c898 | 2015-06-13 02:50:43 +0300 | [diff] [blame] | 97 | pass |
| 98 | |
koder aka kdanilov | 7022706 | 2016-11-26 23:23:21 +0200 | [diff] [blame] | 99 | def get_not_done_stages(self, storage: Storage) -> Dict[int, IterationConfig]: |
koder aka kdanilov | 7f59d56 | 2016-12-26 01:34:23 +0200 | [diff] [blame^] | 100 | not_done = {} # type: Dict[int, IterationConfig] |
koder aka kdanilov | bbbe1dc | 2016-12-20 01:19:56 +0200 | [diff] [blame] | 101 | |
koder aka kdanilov | 7f59d56 | 2016-12-26 01:34:23 +0200 | [diff] [blame^] | 102 | for run_id, iteration_config in enumerate(self.iterations_configs): |
koder aka kdanilov | 7022706 | 2016-11-26 23:23:21 +0200 | [diff] [blame] | 103 | info_path = "result/{}/info".format(run_id) |
| 104 | if info_path in storage: |
koder aka kdanilov | 7f59d56 | 2016-12-26 01:34:23 +0200 | [diff] [blame^] | 105 | info = cast(Dict[str, Any], storage.get(info_path)) # type: Dict[str, Any] |
koder aka kdanilov | 3b4da8b | 2016-10-17 00:17:53 +0300 | [diff] [blame] | 106 | |
koder aka kdanilov | 7022706 | 2016-11-26 23:23:21 +0200 | [diff] [blame] | 107 | assert isinstance(info, dict), \ |
| 108 | "Broken storage at path {}. Expect test info dict, obtain {!r}".format(info_path, info) |
koder aka kdanilov | 3b4da8b | 2016-10-17 00:17:53 +0300 | [diff] [blame] | 109 | |
koder aka kdanilov | 7022706 | 2016-11-26 23:23:21 +0200 | [diff] [blame] | 110 | info = info.copy() |
| 111 | del info['begin_time'] |
| 112 | del info['end_time'] |
koder aka kdanilov | bc2c898 | 2015-06-13 02:50:43 +0300 | [diff] [blame] | 113 | |
koder aka kdanilov | 7022706 | 2016-11-26 23:23:21 +0200 | [diff] [blame] | 114 | iter_name = "Unnamed" if iteration_config is None else iteration_config.name |
| 115 | expected_config = { |
| 116 | 'name': self.name, |
| 117 | 'iteration_name': iter_name, |
koder aka kdanilov | 7f59d56 | 2016-12-26 01:34:23 +0200 | [diff] [blame^] | 118 | 'iteration_config': iteration_config.raw(), |
koder aka kdanilov | 7022706 | 2016-11-26 23:23:21 +0200 | [diff] [blame] | 119 | 'params': self.config.params, |
| 120 | 'nodes': self.sorted_nodes_ids |
| 121 | } |
| 122 | |
| 123 | assert info == expected_config, \ |
koder aka kdanilov | 39e449e | 2016-12-17 15:15:26 +0200 | [diff] [blame] | 124 | ("Test info at path {} is not equal to expected config." + |
| 125 | "Maybe configuration was changed before test was restarted. " + |
| 126 | "Current cfg is {!r}, expected cfg is {!r}").format(info_path, info, expected_config) |
koder aka kdanilov | 7022706 | 2016-11-26 23:23:21 +0200 | [diff] [blame] | 127 | |
| 128 | logger.info("Test iteration {} found in storage and will be skipped".format(iter_name)) |
| 129 | else: |
koder aka kdanilov | 7f59d56 | 2016-12-26 01:34:23 +0200 | [diff] [blame^] | 130 | not_done[run_id] = iteration_config |
| 131 | |
| 132 | return not_done |
koder aka kdanilov | 7022706 | 2016-11-26 23:23:21 +0200 | [diff] [blame] | 133 | |
koder aka kdanilov | bbbe1dc | 2016-12-20 01:19:56 +0200 | [diff] [blame] | 134 | def run(self) -> None: |
| 135 | not_in_storage = self.get_not_done_stages(self.config.storage) |
koder aka kdanilov | 7022706 | 2016-11-26 23:23:21 +0200 | [diff] [blame] | 136 | |
| 137 | if not not_in_storage: |
| 138 | logger.info("All test iteration in storage already. Skip test") |
| 139 | return |
| 140 | |
| 141 | logger.debug("Run test {} on nodes {}.".format(self.name, ",".join(self.sorted_nodes_ids))) |
koder aka kdanilov | 23e6bdf | 2016-12-24 02:18:54 +0200 | [diff] [blame] | 142 | logger.debug("Prepare nodes") |
koder aka kdanilov | 7022706 | 2016-11-26 23:23:21 +0200 | [diff] [blame] | 143 | |
| 144 | with ThreadPoolExecutor(len(self.nodes)) as pool: |
| 145 | list(pool.map(self.config_node, self.nodes)) |
| 146 | |
| 147 | # +5% - is a rough estimation for additional operations |
| 148 | run_times = [self.get_expected_runtime(iteration_config) for iteration_config in not_in_storage.values()] |
| 149 | if None not in run_times: |
| 150 | expected_run_time = int(sum(run_times) * 1.05) |
| 151 | exec_time_s = sec_to_str(expected_run_time) |
| 152 | now_dt = datetime.datetime.now() |
| 153 | end_dt = now_dt + datetime.timedelta(0, expected_run_time) |
| 154 | logger.info("Entire test should takes aroud: {} and finished at {:%H:%M:%S}" |
| 155 | .format(exec_time_s, end_dt)) |
| 156 | |
| 157 | for run_id, iteration_config in sorted(not_in_storage.items()): |
| 158 | iter_name = "Unnamed" if iteration_config is None else iteration_config.name |
koder aka kdanilov | 23e6bdf | 2016-12-24 02:18:54 +0200 | [diff] [blame] | 159 | logger.info("Run test iteration %s", iter_name) |
koder aka kdanilov | 7022706 | 2016-11-26 23:23:21 +0200 | [diff] [blame] | 160 | |
koder aka kdanilov | 7f59d56 | 2016-12-26 01:34:23 +0200 | [diff] [blame^] | 161 | current_result_path = "result/{}_{}".format(iteration_config.summary, run_id) |
koder aka kdanilov | 23e6bdf | 2016-12-24 02:18:54 +0200 | [diff] [blame] | 162 | results = [] # type: List[NodeTestResults] |
koder aka kdanilov | 7022706 | 2016-11-26 23:23:21 +0200 | [diff] [blame] | 163 | for idx in range(self.max_retry): |
koder aka kdanilov | 23e6bdf | 2016-12-24 02:18:54 +0200 | [diff] [blame] | 164 | logger.debug("Prepare iteration %s", iter_name) |
koder aka kdanilov | 7022706 | 2016-11-26 23:23:21 +0200 | [diff] [blame] | 165 | |
koder aka kdanilov | 23e6bdf | 2016-12-24 02:18:54 +0200 | [diff] [blame] | 166 | # prepare nodes for new iterations |
| 167 | futures = [pool.submit(self.prepare_iteration, node, iteration_config) for node in self.nodes] |
| 168 | wait(futures) |
| 169 | |
| 170 | # run iteration |
| 171 | logger.debug("Run iteration %s", iter_name) |
| 172 | try: |
| 173 | futures = [] |
| 174 | for node in self.nodes: |
koder aka kdanilov | 7f59d56 | 2016-12-26 01:34:23 +0200 | [diff] [blame^] | 175 | path = "{}/measurement/{}".format(current_result_path, node.info.node_id()) |
| 176 | futures.append(pool.submit(self.run_iteration, node, iteration_config, path)) |
koder aka kdanilov | 23e6bdf | 2016-12-24 02:18:54 +0200 | [diff] [blame] | 177 | |
| 178 | results = [fut.result() for fut in futures] |
| 179 | break |
| 180 | except EnvironmentError: |
| 181 | if self.max_retry - 1 == idx: |
| 182 | logger.exception("Fio failed") |
| 183 | raise StopTestError() |
| 184 | logger.exception("During fio run") |
| 185 | logger.info("Sleeping %ss and retrying", self.retry_time) |
| 186 | time.sleep(self.retry_time) |
koder aka kdanilov | 7022706 | 2016-11-26 23:23:21 +0200 | [diff] [blame] | 187 | |
| 188 | start_times = [] # type: List[int] |
| 189 | stop_times = [] # type: List[int] |
| 190 | |
koder aka kdanilov | 23e6bdf | 2016-12-24 02:18:54 +0200 | [diff] [blame] | 191 | # TODO: FIX result processing - NodeTestResults |
koder aka kdanilov | 23e6bdf | 2016-12-24 02:18:54 +0200 | [diff] [blame] | 192 | for result in results: |
koder aka kdanilov | 23e6bdf | 2016-12-24 02:18:54 +0200 | [diff] [blame] | 193 | for name, serie in result.series.items(): |
| 194 | start_times.append(serie.start_at) |
| 195 | stop_times.append(serie.step * len(serie.data)) |
koder aka kdanilov | 7022706 | 2016-11-26 23:23:21 +0200 | [diff] [blame] | 196 | |
| 197 | min_start_time = min(start_times) |
| 198 | max_start_time = max(start_times) |
| 199 | min_stop_time = min(stop_times) |
| 200 | max_stop_time = max(stop_times) |
| 201 | |
| 202 | max_allowed_time_diff = int((min_stop_time - max_start_time) * self.max_rel_time_diff) |
| 203 | max_allowed_time_diff = max(max_allowed_time_diff, self.max_time_diff) |
| 204 | |
| 205 | if min_start_time + self.max_time_diff < max_allowed_time_diff: |
| 206 | logger.warning("Too large difference in {}:{} start time - {}. Max recommended difference is {}" |
| 207 | .format(self.name, iter_name, max_start_time - min_start_time, self.max_time_diff)) |
| 208 | |
| 209 | if min_stop_time + self.max_time_diff < max_allowed_time_diff: |
| 210 | logger.warning("Too large difference in {}:{} stop time - {}. Max recommended difference is {}" |
| 211 | .format(self.name, iter_name, max_start_time - min_start_time, self.max_time_diff)) |
| 212 | |
| 213 | test_config = { |
| 214 | 'name': self.name, |
| 215 | 'iteration_name': iter_name, |
koder aka kdanilov | 7f59d56 | 2016-12-26 01:34:23 +0200 | [diff] [blame^] | 216 | 'iteration_config': iteration_config.raw(), |
koder aka kdanilov | 7022706 | 2016-11-26 23:23:21 +0200 | [diff] [blame] | 217 | 'params': self.config.params, |
| 218 | 'nodes': self.sorted_nodes_ids, |
| 219 | 'begin_time': min_start_time, |
| 220 | 'end_time': max_stop_time |
| 221 | } |
| 222 | |
koder aka kdanilov | 7f59d56 | 2016-12-26 01:34:23 +0200 | [diff] [blame^] | 223 | self.process_storage_queue() |
| 224 | self.config.storage.put(test_config, "result", str(run_id), "info") |
| 225 | |
| 226 | if "all_results" in self.config.storage: |
| 227 | all_results = self.config.storage.get("all_results") |
| 228 | else: |
| 229 | all_results = [] |
| 230 | |
| 231 | all_results.append([self.name, iteration_config.summary, current_result_path]) |
| 232 | self.config.storage.put(all_results, "all_results") |
| 233 | self.config.storage.sync() |
| 234 | |
| 235 | if self.on_idle is not None: |
| 236 | self.on_idle() |
| 237 | |
| 238 | def store_data(self, val: Any, type: str, prefix: str, *path: str) -> None: |
| 239 | self.storage_q.put((val, type, prefix, path)) |
| 240 | |
| 241 | def process_storage_queue(self) -> None: |
| 242 | while not self.storage_q.empty(): |
| 243 | value, val_type, subpath, val_path = self.storage_q.get() |
| 244 | if val_type == 'raw': |
| 245 | self.config.storage.put_raw(value, subpath, *val_path) |
| 246 | elif val_type == 'yaml': |
| 247 | self.config.storage.put(value, subpath, *val_path) |
| 248 | elif val_type == 'array': |
| 249 | self.config.storage.put_array(value, subpath, *val_path) |
| 250 | else: |
| 251 | logger.error("Internal logic error - unknown data stop type {!r}".format(val_path)) |
| 252 | raise StopTestError() |
koder aka kdanilov | 7022706 | 2016-11-26 23:23:21 +0200 | [diff] [blame] | 253 | |
| 254 | @abc.abstractmethod |
| 255 | def config_node(self, node: IRPCNode) -> None: |
| 256 | pass |
| 257 | |
| 258 | @abc.abstractmethod |
koder aka kdanilov | 23e6bdf | 2016-12-24 02:18:54 +0200 | [diff] [blame] | 259 | def prepare_iteration(self, node: IRPCNode, iter_config: IterationConfig) -> None: |
| 260 | pass |
| 261 | |
| 262 | @abc.abstractmethod |
koder aka kdanilov | 7f59d56 | 2016-12-26 01:34:23 +0200 | [diff] [blame^] | 263 | def run_iteration(self, node: IRPCNode, iter_config: IterationConfig, stor_prefix: str) -> NodeTestResults: |
koder aka kdanilov | bc2c898 | 2015-06-13 02:50:43 +0300 | [diff] [blame] | 264 | pass |
| 265 | |
| 266 | |
koder aka kdanilov | 7022706 | 2016-11-26 23:23:21 +0200 | [diff] [blame] | 267 | class TwoScriptTest(ThreadedTest, metaclass=abc.ABCMeta): |
| 268 | def __init__(self, *dt, **mp) -> None: |
koder aka kdanilov | bc2c898 | 2015-06-13 02:50:43 +0300 | [diff] [blame] | 269 | ThreadedTest.__init__(self, *dt, **mp) |
koder aka kdanilov | bc2c898 | 2015-06-13 02:50:43 +0300 | [diff] [blame] | 270 | self.prerun_script = self.config.params['prerun_script'] |
| 271 | self.run_script = self.config.params['run_script'] |
koder aka kdanilov | bc2c898 | 2015-06-13 02:50:43 +0300 | [diff] [blame] | 272 | self.prerun_tout = self.config.params.get('prerun_tout', 3600) |
| 273 | self.run_tout = self.config.params.get('run_tout', 3600) |
koder aka kdanilov | 7022706 | 2016-11-26 23:23:21 +0200 | [diff] [blame] | 274 | self.iterations_configs = [None] |
Yulia Portnova | 7ddfa73 | 2015-02-24 17:32:58 +0200 | [diff] [blame] | 275 | |
koder aka kdanilov | 7022706 | 2016-11-26 23:23:21 +0200 | [diff] [blame] | 276 | def get_expected_runtime(self, iter_cfg: IterationConfig) -> Optional[int]: |
| 277 | return None |
Yulia Portnova | 7ddfa73 | 2015-02-24 17:32:58 +0200 | [diff] [blame] | 278 | |
koder aka kdanilov | 7022706 | 2016-11-26 23:23:21 +0200 | [diff] [blame] | 279 | def config_node(self, node: IRPCNode) -> None: |
| 280 | node.copy_file(self.run_script, self.join_remote(self.run_script)) |
| 281 | node.copy_file(self.prerun_script, self.join_remote(self.prerun_script)) |
koder aka kdanilov | bc2c898 | 2015-06-13 02:50:43 +0300 | [diff] [blame] | 282 | |
koder aka kdanilov | 7022706 | 2016-11-26 23:23:21 +0200 | [diff] [blame] | 283 | cmd = self.join_remote(self.prerun_script) |
koder aka kdanilov | bc2c898 | 2015-06-13 02:50:43 +0300 | [diff] [blame] | 284 | cmd += ' ' + self.config.params.get('prerun_opts', '') |
koder aka kdanilov | 3b4da8b | 2016-10-17 00:17:53 +0300 | [diff] [blame] | 285 | node.run(cmd, timeout=self.prerun_tout) |
Yulia Portnova | 7ddfa73 | 2015-02-24 17:32:58 +0200 | [diff] [blame] | 286 | |
koder aka kdanilov | 23e6bdf | 2016-12-24 02:18:54 +0200 | [diff] [blame] | 287 | def prepare_iteration(self, node: IRPCNode, iter_config: IterationConfig) -> None: |
| 288 | pass |
| 289 | |
koder aka kdanilov | 7f59d56 | 2016-12-26 01:34:23 +0200 | [diff] [blame^] | 290 | def run_iteration(self, node: IRPCNode, iter_config: IterationConfig, stor_prefix: str) -> NodeTestResults: |
koder aka kdanilov | 23e6bdf | 2016-12-24 02:18:54 +0200 | [diff] [blame] | 291 | # TODO: have to store logs |
koder aka kdanilov | 7022706 | 2016-11-26 23:23:21 +0200 | [diff] [blame] | 292 | cmd = self.join_remote(self.run_script) |
koder aka kdanilov | bc2c898 | 2015-06-13 02:50:43 +0300 | [diff] [blame] | 293 | cmd += ' ' + self.config.params.get('run_opts', '') |
koder aka kdanilov | 23e6bdf | 2016-12-24 02:18:54 +0200 | [diff] [blame] | 294 | return self.parse_results(node.run(cmd, timeout=self.run_tout)) |
koder aka kdanilov | 7022706 | 2016-11-26 23:23:21 +0200 | [diff] [blame] | 295 | |
| 296 | @abc.abstractmethod |
koder aka kdanilov | 23e6bdf | 2016-12-24 02:18:54 +0200 | [diff] [blame] | 297 | def parse_results(self, data: str) -> NodeTestResults: |
koder aka kdanilov | 7022706 | 2016-11-26 23:23:21 +0200 | [diff] [blame] | 298 | pass |
| 299 | |