koder aka kdanilov | bc2c898 | 2015-06-13 02:50:43 +0300 | [diff] [blame] | 1 | import os.path |
| 2 | import logging |
koder aka kdanilov | a732a60 | 2017-02-01 20:29:56 +0200 | [diff] [blame] | 3 | from typing import cast, Any, List, Union |
| 4 | |
| 5 | import numpy |
koder aka kdanilov | bc2c898 | 2015-06-13 02:50:43 +0300 | [diff] [blame] | 6 | |
koder aka kdanilov | 6ab4d43 | 2015-06-22 00:26:28 +0300 | [diff] [blame] | 7 | import wally |
koder aka kdanilov | 108ac36 | 2017-01-19 20:17:16 +0200 | [diff] [blame] | 8 | from ...utils import StopTestError, ssize2b, b2ssize |
koder aka kdanilov | 7022706 | 2016-11-26 23:23:21 +0200 | [diff] [blame] | 9 | from ...node_interfaces import IRPCNode |
koder aka kdanilov | 108ac36 | 2017-01-19 20:17:16 +0200 | [diff] [blame] | 10 | from ...node_utils import get_os |
koder aka kdanilov | f286517 | 2016-12-30 03:35:11 +0200 | [diff] [blame] | 11 | from ..itest import ThreadedTest |
koder aka kdanilov | f90de85 | 2017-01-20 18:12:27 +0200 | [diff] [blame] | 12 | from ...result_classes import TimeSeries, DataSource |
| 13 | from ..job import JobConfig |
koder aka kdanilov | f286517 | 2016-12-30 03:35:11 +0200 | [diff] [blame] | 14 | from .fio_task_parser import execution_time, fio_cfg_compile, FioJobConfig, FioParams, get_log_files |
koder aka kdanilov | bbbe1dc | 2016-12-20 01:19:56 +0200 | [diff] [blame] | 15 | from . import rpc_plugin |
koder aka kdanilov | 23e6bdf | 2016-12-24 02:18:54 +0200 | [diff] [blame] | 16 | from .fio_hist import expected_lat_bins |
koder aka kdanilov | 7f59d56 | 2016-12-26 01:34:23 +0200 | [diff] [blame] | 17 | |
koder aka kdanilov | bc2c898 | 2015-06-13 02:50:43 +0300 | [diff] [blame] | 18 | |
| 19 | logger = logging.getLogger("wally") |
| 20 | |
| 21 | |
koder aka kdanilov | 108ac36 | 2017-01-19 20:17:16 +0200 | [diff] [blame] | 22 | class FioTest(ThreadedTest): |
koder aka kdanilov | bc2c898 | 2015-06-13 02:50:43 +0300 | [diff] [blame] | 23 | soft_runcycle = 5 * 60 |
Michael Semenov | 8ba6e23 | 2015-08-28 10:57:18 +0000 | [diff] [blame] | 24 | retry_time = 30 |
koder aka kdanilov | 7022706 | 2016-11-26 23:23:21 +0200 | [diff] [blame] | 25 | configs_dir = os.path.dirname(__file__) # type: str |
koder aka kdanilov | 7f59d56 | 2016-12-26 01:34:23 +0200 | [diff] [blame] | 26 | name = 'fio' |
koder aka kdanilov | f286517 | 2016-12-30 03:35:11 +0200 | [diff] [blame] | 27 | job_config_cls = FioJobConfig |
koder aka kdanilov | bc2c898 | 2015-06-13 02:50:43 +0300 | [diff] [blame] | 28 | |
koder aka kdanilov | 7022706 | 2016-11-26 23:23:21 +0200 | [diff] [blame] | 29 | def __init__(self, *args, **kwargs) -> None: |
| 30 | super().__init__(*args, **kwargs) |
koder aka kdanilov | bc2c898 | 2015-06-13 02:50:43 +0300 | [diff] [blame] | 31 | |
koder aka kdanilov | 108ac36 | 2017-01-19 20:17:16 +0200 | [diff] [blame] | 32 | get = self.suite.params.get |
koder aka kdanilov | bc2c898 | 2015-06-13 02:50:43 +0300 | [diff] [blame] | 33 | |
koder aka kdanilov | bbbe1dc | 2016-12-20 01:19:56 +0200 | [diff] [blame] | 34 | self.remote_task_file = self.join_remote("task.fio") |
| 35 | self.remote_output_file = self.join_remote("fio_result.json") |
| 36 | self.use_system_fio = get('use_system_fio', False) # type: bool |
| 37 | self.use_sudo = get("use_sudo", True) # type: bool |
| 38 | self.force_prefill = get('force_prefill', False) # type: bool |
koder aka kdanilov | a732a60 | 2017-02-01 20:29:56 +0200 | [diff] [blame] | 39 | self.skip_prefill = get('skip_prefill', False) # type: bool |
koder aka kdanilov | 108ac36 | 2017-01-19 20:17:16 +0200 | [diff] [blame] | 40 | self.load_profile_name = self.suite.params['load'] # type: str |
koder aka kdanilov | bc2c898 | 2015-06-13 02:50:43 +0300 | [diff] [blame] | 41 | |
koder aka kdanilov | 7022706 | 2016-11-26 23:23:21 +0200 | [diff] [blame] | 42 | if os.path.isfile(self.load_profile_name): |
koder aka kdanilov | bbbe1dc | 2016-12-20 01:19:56 +0200 | [diff] [blame] | 43 | self.load_profile_path = self.load_profile_name # type: str |
koder aka kdanilov | 6ab4d43 | 2015-06-22 00:26:28 +0300 | [diff] [blame] | 44 | else: |
koder aka kdanilov | bbbe1dc | 2016-12-20 01:19:56 +0200 | [diff] [blame] | 45 | self.load_profile_path = os.path.join(self.configs_dir, self.load_profile_name+ '.cfg') |
koder aka kdanilov | bc2c898 | 2015-06-13 02:50:43 +0300 | [diff] [blame] | 46 | |
koder aka kdanilov | 7022706 | 2016-11-26 23:23:21 +0200 | [diff] [blame] | 47 | self.load_profile = open(self.load_profile_path, 'rt').read() # type: str |
koder aka kdanilov | bc2c898 | 2015-06-13 02:50:43 +0300 | [diff] [blame] | 48 | |
koder aka kdanilov | bc2c898 | 2015-06-13 02:50:43 +0300 | [diff] [blame] | 49 | if self.use_system_fio: |
koder aka kdanilov | 7022706 | 2016-11-26 23:23:21 +0200 | [diff] [blame] | 50 | self.fio_path = "fio" # type: str |
koder aka kdanilov | bc2c898 | 2015-06-13 02:50:43 +0300 | [diff] [blame] | 51 | else: |
koder aka kdanilov | 108ac36 | 2017-01-19 20:17:16 +0200 | [diff] [blame] | 52 | self.fio_path = os.path.join(self.suite.remote_dir, "fio") |
koder aka kdanilov | bc2c898 | 2015-06-13 02:50:43 +0300 | [diff] [blame] | 53 | |
koder aka kdanilov | 108ac36 | 2017-01-19 20:17:16 +0200 | [diff] [blame] | 54 | self.load_params = self.suite.params['params'] |
koder aka kdanilov | bbbe1dc | 2016-12-20 01:19:56 +0200 | [diff] [blame] | 55 | self.file_name = self.load_params['FILENAME'] |
koder aka kdanilov | bc2c898 | 2015-06-13 02:50:43 +0300 | [diff] [blame] | 56 | |
koder aka kdanilov | bbbe1dc | 2016-12-20 01:19:56 +0200 | [diff] [blame] | 57 | if 'FILESIZE' not in self.load_params: |
| 58 | logger.debug("Getting test file sizes on all nodes") |
| 59 | try: |
koder aka kdanilov | 108ac36 | 2017-01-19 20:17:16 +0200 | [diff] [blame] | 60 | sizes = {node.conn.fs.file_stat(self.file_name)[b'size'] |
| 61 | for node in self.suite.nodes} |
koder aka kdanilov | bbbe1dc | 2016-12-20 01:19:56 +0200 | [diff] [blame] | 62 | except Exception: |
| 63 | logger.exception("FILESIZE is not set in config file and fail to detect it." + |
| 64 | "Set FILESIZE or fix error and rerun test") |
| 65 | raise StopTestError() |
koder aka kdanilov | a94dfe1 | 2015-08-19 13:04:51 +0300 | [diff] [blame] | 66 | |
koder aka kdanilov | bbbe1dc | 2016-12-20 01:19:56 +0200 | [diff] [blame] | 67 | if len(sizes) != 1: |
| 68 | logger.error("IO target file %r has different sizes on test nodes - %r", |
| 69 | self.file_name, sizes) |
| 70 | raise StopTestError() |
koder aka kdanilov | a94dfe1 | 2015-08-19 13:04:51 +0300 | [diff] [blame] | 71 | |
koder aka kdanilov | bbbe1dc | 2016-12-20 01:19:56 +0200 | [diff] [blame] | 72 | self.file_size = list(sizes)[0] |
koder aka kdanilov | 108ac36 | 2017-01-19 20:17:16 +0200 | [diff] [blame] | 73 | logger.info("Detected test file size is %sB", b2ssize(self.file_size)) |
koder aka kdanilov | a732a60 | 2017-02-01 20:29:56 +0200 | [diff] [blame] | 74 | if self.file_size % (4 * 1024 ** 2) != 0: |
| 75 | tail = self.file_size % (4 * 1024 ** 2) |
| 76 | logger.warning("File size is not proportional to 4M, %sb at the end will not be used for test", |
| 77 | str(tail // 1024) + "Kb" if tail > 1024 else str(tail) + "b") |
| 78 | self.file_size -= self.file_size % (4 * 1024 ** 2) |
koder aka kdanilov | bbbe1dc | 2016-12-20 01:19:56 +0200 | [diff] [blame] | 79 | self.load_params['FILESIZE'] = self.file_size |
| 80 | else: |
| 81 | self.file_size = ssize2b(self.load_params['FILESIZE']) |
koder aka kdanilov | 7022706 | 2016-11-26 23:23:21 +0200 | [diff] [blame] | 82 | |
koder aka kdanilov | f286517 | 2016-12-30 03:35:11 +0200 | [diff] [blame] | 83 | self.job_configs = list(fio_cfg_compile(self.load_profile, self.load_profile_path, |
koder aka kdanilov | bbbe1dc | 2016-12-20 01:19:56 +0200 | [diff] [blame] | 84 | cast(FioParams, self.load_params))) |
koder aka kdanilov | 7022706 | 2016-11-26 23:23:21 +0200 | [diff] [blame] | 85 | |
koder aka kdanilov | f286517 | 2016-12-30 03:35:11 +0200 | [diff] [blame] | 86 | if len(self.job_configs) == 0: |
koder aka kdanilov | bbbe1dc | 2016-12-20 01:19:56 +0200 | [diff] [blame] | 87 | logger.error("Empty fio config provided") |
| 88 | raise StopTestError() |
koder aka kdanilov | 7022706 | 2016-11-26 23:23:21 +0200 | [diff] [blame] | 89 | |
koder aka kdanilov | 108ac36 | 2017-01-19 20:17:16 +0200 | [diff] [blame] | 90 | self.exec_folder = self.suite.remote_dir |
koder aka kdanilov | bc2c898 | 2015-06-13 02:50:43 +0300 | [diff] [blame] | 91 | |
koder aka kdanilov | 7022706 | 2016-11-26 23:23:21 +0200 | [diff] [blame] | 92 | def config_node(self, node: IRPCNode) -> None: |
koder aka kdanilov | 23e6bdf | 2016-12-24 02:18:54 +0200 | [diff] [blame] | 93 | plugin_code = open(rpc_plugin.__file__.rsplit(".", 1)[0] + ".py", "rb").read() # type: bytes |
| 94 | node.upload_plugin("fio", plugin_code) |
koder aka kdanilov | bbbe1dc | 2016-12-20 01:19:56 +0200 | [diff] [blame] | 95 | |
koder aka kdanilov | bc2c898 | 2015-06-13 02:50:43 +0300 | [diff] [blame] | 96 | try: |
koder aka kdanilov | 108ac36 | 2017-01-19 20:17:16 +0200 | [diff] [blame] | 97 | node.conn.fs.rmtree(self.suite.remote_dir) |
koder aka kdanilov | bbbe1dc | 2016-12-20 01:19:56 +0200 | [diff] [blame] | 98 | except Exception: |
| 99 | pass |
| 100 | |
| 101 | try: |
koder aka kdanilov | 108ac36 | 2017-01-19 20:17:16 +0200 | [diff] [blame] | 102 | node.conn.fs.makedirs(self.suite.remote_dir) |
koder aka kdanilov | bbbe1dc | 2016-12-20 01:19:56 +0200 | [diff] [blame] | 103 | except Exception: |
koder aka kdanilov | 108ac36 | 2017-01-19 20:17:16 +0200 | [diff] [blame] | 104 | msg = "Failed to recreate folder {} on remote {}.".format(self.suite.remote_dir, node) |
koder aka kdanilov | 3b4da8b | 2016-10-17 00:17:53 +0300 | [diff] [blame] | 105 | logger.exception(msg) |
koder aka kdanilov | bbbe1dc | 2016-12-20 01:19:56 +0200 | [diff] [blame] | 106 | raise StopTestError() |
koder aka kdanilov | bc2c898 | 2015-06-13 02:50:43 +0300 | [diff] [blame] | 107 | |
koder aka kdanilov | 108ac36 | 2017-01-19 20:17:16 +0200 | [diff] [blame] | 108 | # TODO: check this during config validation |
| 109 | if self.file_size % (4 * (1024 ** 2)) != 0: |
| 110 | logger.error("Test file size must be proportional to 4MiB") |
| 111 | raise StopTestError() |
| 112 | |
koder aka kdanilov | 3b4da8b | 2016-10-17 00:17:53 +0300 | [diff] [blame] | 113 | self.install_utils(node) |
koder aka kdanilov | bbbe1dc | 2016-12-20 01:19:56 +0200 | [diff] [blame] | 114 | |
koder aka kdanilov | a732a60 | 2017-02-01 20:29:56 +0200 | [diff] [blame] | 115 | if self.skip_prefill: |
| 116 | logger.info("Prefill is skipped due to 'skip_prefill' set to true") |
| 117 | else: |
| 118 | mb = int(self.file_size / 1024 ** 2) |
| 119 | logger.info("Filling test file %s on node %s with %sMiB of random data", self.file_name, node.info, mb) |
| 120 | is_prefilled, fill_bw = node.conn.fio.fill_file(self.file_name, mb, |
| 121 | force=self.force_prefill, |
| 122 | fio_path=self.fio_path) |
| 123 | if not is_prefilled: |
| 124 | logger.info("Test file on node %s is already prefilled", node.info) |
| 125 | elif fill_bw is not None: |
| 126 | logger.info("Initial fio fill bw is %s MiBps for %s", fill_bw, node.info) |
koder aka kdanilov | bbbe1dc | 2016-12-20 01:19:56 +0200 | [diff] [blame] | 127 | |
koder aka kdanilov | 7022706 | 2016-11-26 23:23:21 +0200 | [diff] [blame] | 128 | def install_utils(self, node: IRPCNode) -> None: |
koder aka kdanilov | bbbe1dc | 2016-12-20 01:19:56 +0200 | [diff] [blame] | 129 | os_info = get_os(node) |
koder aka kdanilov | 6ab4d43 | 2015-06-22 00:26:28 +0300 | [diff] [blame] | 130 | if self.use_system_fio: |
koder aka kdanilov | bbbe1dc | 2016-12-20 01:19:56 +0200 | [diff] [blame] | 131 | if os_info.distro != 'ubuntu': |
| 132 | logger.error("Only ubuntu supported on test VM") |
| 133 | raise StopTestError() |
| 134 | node.conn.fio.install('fio', binary='fio') |
| 135 | else: |
| 136 | node.conn.fio.install('bzip2', binary='bzip2') |
koder aka kdanilov | 7022706 | 2016-11-26 23:23:21 +0200 | [diff] [blame] | 137 | fio_dir = os.path.dirname(os.path.dirname(wally.__file__)) # type: str |
| 138 | fio_dir = os.path.join(os.getcwd(), fio_dir) |
| 139 | fio_dir = os.path.join(fio_dir, 'fio_binaries') |
| 140 | fname = 'fio_{0.release}_{0.arch}.bz2'.format(os_info) |
| 141 | fio_path = os.path.join(fio_dir, fname) # type: str |
| 142 | |
| 143 | if not os.path.exists(fio_path): |
koder aka kdanilov | bbbe1dc | 2016-12-20 01:19:56 +0200 | [diff] [blame] | 144 | logger.error("No prebuild fio binary available for {0}".format(os_info)) |
| 145 | raise StopTestError() |
koder aka kdanilov | 7022706 | 2016-11-26 23:23:21 +0200 | [diff] [blame] | 146 | |
| 147 | bz_dest = self.join_remote('fio.bz2') # type: str |
koder aka kdanilov | 108ac36 | 2017-01-19 20:17:16 +0200 | [diff] [blame] | 148 | node.copy_file(fio_path, bz_dest, compress=False) |
koder aka kdanilov | bbbe1dc | 2016-12-20 01:19:56 +0200 | [diff] [blame] | 149 | node.run("bzip2 --decompress {} ; chmod a+x {}".format(bz_dest, self.join_remote("fio"))) |
koder aka kdanilov | 7022706 | 2016-11-26 23:23:21 +0200 | [diff] [blame] | 150 | |
koder aka kdanilov | f90de85 | 2017-01-20 18:12:27 +0200 | [diff] [blame] | 151 | def get_expected_runtime(self, job_config: JobConfig) -> int: |
koder aka kdanilov | f286517 | 2016-12-30 03:35:11 +0200 | [diff] [blame] | 152 | return execution_time(cast(FioJobConfig, job_config)) |
koder aka kdanilov | 7022706 | 2016-11-26 23:23:21 +0200 | [diff] [blame] | 153 | |
koder aka kdanilov | f90de85 | 2017-01-20 18:12:27 +0200 | [diff] [blame] | 154 | def prepare_iteration(self, node: IRPCNode, job: JobConfig) -> None: |
koder aka kdanilov | 108ac36 | 2017-01-19 20:17:16 +0200 | [diff] [blame] | 155 | node.put_to_file(self.remote_task_file, str(job).encode("utf8")) |
koder aka kdanilov | 23e6bdf | 2016-12-24 02:18:54 +0200 | [diff] [blame] | 156 | |
| 157 | # TODO: get a link to substorage as a parameter |
koder aka kdanilov | f90de85 | 2017-01-20 18:12:27 +0200 | [diff] [blame] | 158 | def run_iteration(self, node: IRPCNode, job: JobConfig) -> List[TimeSeries]: |
koder aka kdanilov | 108ac36 | 2017-01-19 20:17:16 +0200 | [diff] [blame] | 159 | exec_time = execution_time(cast(FioJobConfig, job)) |
| 160 | |
koder aka kdanilov | 23e6bdf | 2016-12-24 02:18:54 +0200 | [diff] [blame] | 161 | |
koder aka kdanilov | bbbe1dc | 2016-12-20 01:19:56 +0200 | [diff] [blame] | 162 | fio_cmd_templ = "cd {exec_folder}; " + \ |
| 163 | "{fio_path} --output-format=json --output={out_file} --alloc-size=262144 {job_file}" |
| 164 | |
koder aka kdanilov | bbbe1dc | 2016-12-20 01:19:56 +0200 | [diff] [blame] | 165 | cmd = fio_cmd_templ.format(exec_folder=self.exec_folder, |
| 166 | fio_path=self.fio_path, |
| 167 | out_file=self.remote_output_file, |
| 168 | job_file=self.remote_task_file) |
koder aka kdanilov | 23e6bdf | 2016-12-24 02:18:54 +0200 | [diff] [blame] | 169 | must_be_empty = node.run(cmd, timeout=exec_time + max(300, exec_time), check_timeout=1).strip() |
koder aka kdanilov | bbbe1dc | 2016-12-20 01:19:56 +0200 | [diff] [blame] | 170 | |
koder aka kdanilov | 23e6bdf | 2016-12-24 02:18:54 +0200 | [diff] [blame] | 171 | if must_be_empty: |
| 172 | logger.error("Unexpected fio output: %r", must_be_empty) |
koder aka kdanilov | bc2c898 | 2015-06-13 02:50:43 +0300 | [diff] [blame] | 173 | |
koder aka kdanilov | f286517 | 2016-12-30 03:35:11 +0200 | [diff] [blame] | 174 | # put fio output into storage |
| 175 | fio_out = node.get_file_content(self.remote_output_file) |
koder aka kdanilov | 108ac36 | 2017-01-19 20:17:16 +0200 | [diff] [blame] | 176 | |
| 177 | path = DataSource(suite_id=self.suite.storage_id, |
| 178 | job_id=job.storage_id, |
| 179 | node_id=node.node_id, |
koder aka kdanilov | a732a60 | 2017-02-01 20:29:56 +0200 | [diff] [blame] | 180 | sensor='fio', |
| 181 | dev=None, |
| 182 | metric='stdout', |
koder aka kdanilov | 108ac36 | 2017-01-19 20:17:16 +0200 | [diff] [blame] | 183 | tag='json') |
koder aka kdanilov | 108ac36 | 2017-01-19 20:17:16 +0200 | [diff] [blame] | 184 | self.storage.put_extra(fio_out, path) |
koder aka kdanilov | 23e6bdf | 2016-12-24 02:18:54 +0200 | [diff] [blame] | 185 | node.conn.fs.unlink(self.remote_output_file) |
| 186 | |
| 187 | files = [name for name in node.conn.fs.listdir(self.exec_folder)] |
koder aka kdanilov | 108ac36 | 2017-01-19 20:17:16 +0200 | [diff] [blame] | 188 | result = [] |
koder aka kdanilov | a732a60 | 2017-02-01 20:29:56 +0200 | [diff] [blame] | 189 | for name, file_path, units in get_log_files(cast(FioJobConfig, job)): |
koder aka kdanilov | 108ac36 | 2017-01-19 20:17:16 +0200 | [diff] [blame] | 190 | log_files = [fname for fname in files if fname.startswith(file_path)] |
koder aka kdanilov | 23e6bdf | 2016-12-24 02:18:54 +0200 | [diff] [blame] | 191 | if len(log_files) != 1: |
| 192 | logger.error("Found %s files, match log pattern %s(%s) - %s", |
koder aka kdanilov | 108ac36 | 2017-01-19 20:17:16 +0200 | [diff] [blame] | 193 | len(log_files), file_path, name, ",".join(log_files[10:])) |
koder aka kdanilov | 23e6bdf | 2016-12-24 02:18:54 +0200 | [diff] [blame] | 194 | raise StopTestError() |
| 195 | |
| 196 | fname = os.path.join(self.exec_folder, log_files[0]) |
| 197 | raw_result = node.get_file_content(fname) # type: bytes |
koder aka kdanilov | 23e6bdf | 2016-12-24 02:18:54 +0200 | [diff] [blame] | 198 | node.conn.fs.unlink(fname) |
| 199 | |
| 200 | try: |
| 201 | log_data = raw_result.decode("utf8").split("\n") |
| 202 | except UnicodeEncodeError: |
| 203 | logger.exception("Error during parse %s fio log file - can't decode usint UTF8", name) |
| 204 | raise StopTestError() |
| 205 | |
koder aka kdanilov | a732a60 | 2017-02-01 20:29:56 +0200 | [diff] [blame] | 206 | # TODO: fix units, need to get array type from stream |
| 207 | |
| 208 | parsed = [] # type: List[Union[List[int], int]] |
| 209 | times = [] |
koder aka kdanilov | 23e6bdf | 2016-12-24 02:18:54 +0200 | [diff] [blame] | 210 | |
koder aka kdanilov | 23e6bdf | 2016-12-24 02:18:54 +0200 | [diff] [blame] | 211 | for idx, line in enumerate(log_data): |
| 212 | line = line.strip() |
| 213 | if line: |
| 214 | try: |
| 215 | time_ms_s, val_s, _, *rest = line.split(",") |
koder aka kdanilov | f286517 | 2016-12-30 03:35:11 +0200 | [diff] [blame] | 216 | times.append(int(time_ms_s.strip())) |
koder aka kdanilov | ffaf48d | 2016-12-27 02:25:29 +0200 | [diff] [blame] | 217 | |
koder aka kdanilov | 23e6bdf | 2016-12-24 02:18:54 +0200 | [diff] [blame] | 218 | if name == 'lat': |
| 219 | vals = [int(i.strip()) for i in rest] |
| 220 | |
| 221 | if len(vals) != expected_lat_bins: |
| 222 | logger.error("Expect {} bins in latency histogram, but found {} at time {}" |
| 223 | .format(expected_lat_bins, len(vals), time_ms_s)) |
| 224 | raise StopTestError() |
| 225 | |
koder aka kdanilov | a732a60 | 2017-02-01 20:29:56 +0200 | [diff] [blame] | 226 | parsed.append(vals) |
koder aka kdanilov | 23e6bdf | 2016-12-24 02:18:54 +0200 | [diff] [blame] | 227 | else: |
| 228 | parsed.append(int(val_s.strip())) |
| 229 | except ValueError: |
| 230 | logger.exception("Error during parse %s fio log file in line %s: %r", name, idx, line) |
| 231 | raise StopTestError() |
koder aka kdanilov | ffaf48d | 2016-12-27 02:25:29 +0200 | [diff] [blame] | 232 | |
koder aka kdanilov | a732a60 | 2017-02-01 20:29:56 +0200 | [diff] [blame] | 233 | if not self.suite.keep_raw_files: |
| 234 | raw_result = None |
| 235 | |
koder aka kdanilov | 108ac36 | 2017-01-19 20:17:16 +0200 | [diff] [blame] | 236 | result.append(TimeSeries(name=name, |
| 237 | raw=raw_result, |
koder aka kdanilov | a732a60 | 2017-02-01 20:29:56 +0200 | [diff] [blame] | 238 | data=numpy.array(parsed, dtype='uint64'), |
| 239 | units=units, |
| 240 | times=numpy.array(times, dtype='uint64'), |
| 241 | time_units='ms', |
| 242 | source=path(metric=name, tag='csv'))) |
koder aka kdanilov | 108ac36 | 2017-01-19 20:17:16 +0200 | [diff] [blame] | 243 | return result |
koder aka kdanilov | 7f59d56 | 2016-12-26 01:34:23 +0200 | [diff] [blame] | 244 | |
| 245 | def format_for_console(self, data: Any) -> str: |
| 246 | raise NotImplementedError() |