Exemplo n.º 1
0
    def _run_stress(self, loader, loader_idx, cpu_idx):  # pylint: disable=unused-argument
        loader_node_logdir = Path(loader.logdir)
        if not loader_node_logdir.exists():
            loader_node_logdir.mkdir()

        worker_count = self.max_workers
        worker_id = loader_idx * self.stress_num + cpu_idx
        log_file_name = loader_node_logdir.joinpath(
            f'cdclogreader-l{loader_idx}-{worker_id}-{uuid.uuid4()}.log')
        LOGGER.debug('cdc-stressor local log: %s', log_file_name)

        self.build_stress_command(worker_id, worker_count)

        LOGGER.info(self.stress_cmd)
        docker = RemoteDocker(
            loader,
            CDCLOG_READER_IMAGE,
            extra_docker_opts=
            f'--network=host --label shell_marker={self.shell_marker}')

        # Update cdc-stressor with last changes.
        docker.run(cmd="go get -u github.com/piodul/cdc-stressor",
                   timeout=self.timeout,
                   ignore_status=True,
                   log_file=log_file_name,
                   verbose=True)

        node_cmd = f'STRESS_TEST_MARKER={self.shell_marker}; {self.stress_cmd}'

        CDCReaderStressEvent.start(node=loader,
                                   stress_cmd=self.stress_cmd).publish()

        try:
            result = docker.run(cmd=node_cmd,
                                timeout=self.timeout + self.shutdown_timeout,
                                ignore_status=True,
                                log_file=log_file_name,
                                verbose=True)
            if not result.ok:
                CDCReaderStressEvent.error(
                    node=loader,
                    stress_cmd=self.stress_cmd,
                    errors=result.stderr.split("\n")).publish()
            return result
        except Exception as exc:
            CDCReaderStressEvent.failure(node=loader,
                                         stress_cmd=self.stress_cmd,
                                         errors=[
                                             format_stress_cmd_error(exc),
                                         ]).publish()
        finally:
            CDCReaderStressEvent.finish(node=loader,
                                        stress_cmd=self.stress_cmd).publish()
Exemplo n.º 2
0
    def _run_stress(self, loader, loader_idx, cpu_idx):
        if not os.path.exists(loader.logdir):
            os.makedirs(loader.logdir, exist_ok=True)
        log_file_name = os.path.join(
            loader.logdir,
            f'ndbench-l{loader_idx}-c{cpu_idx}-{uuid.uuid4()}.log')
        LOGGER.debug('ndbench local log: %s', log_file_name)

        LOGGER.debug("running: %s", self.stress_cmd)

        if self.stress_num > 1:
            node_cmd = f'taskset -c {cpu_idx} bash -c "{self.stress_cmd}"'
        else:
            node_cmd = self.stress_cmd

        docker = RemoteDocker(
            loader,
            'scylladb/hydra-loaders:ndbench-jdk8-20210720',
            extra_docker_opts=
            f'--network=host --label shell_marker={self.shell_marker}')

        node_cmd = f'STRESS_TEST_MARKER={self.shell_marker}; {node_cmd}'

        NdBenchStressEvent.start(node=loader,
                                 stress_cmd=self.stress_cmd).publish()

        with NdBenchStatsPublisher(loader, loader_idx, ndbench_log_filename=log_file_name), \
                NdBenchStressEventsPublisher(node=loader, ndbench_log_filename=log_file_name):
            try:
                docker_run_result = docker.run(cmd=node_cmd,
                                               timeout=self.timeout +
                                               self.shutdown_timeout,
                                               ignore_status=True,
                                               log_file=log_file_name,
                                               verbose=True)
                return docker_run_result
            except Exception as exc:  # pylint: disable=broad-except
                NdBenchStressEvent.failure(node=str(loader),
                                           stress_cmd=self.stress_cmd,
                                           log_file_name=log_file_name,
                                           errors=[
                                               format_stress_cmd_error(exc),
                                           ]).publish()
            finally:
                NdBenchStressEvent.finish(
                    node=loader,
                    stress_cmd=self.stress_cmd,
                    log_file_name=log_file_name).publish()
        return None
Exemplo n.º 3
0
    def _run_stress(self, loader, loader_idx, cpu_idx):
        docker = RemoteDocker(
            loader,
            "scylladb/hydra-loaders:kcl-jdk8-20210215",
            extra_docker_opts=f'--label shell_marker={self.shell_marker}')
        stress_cmd = self.build_stress_cmd()

        if not os.path.exists(loader.logdir):
            os.makedirs(loader.logdir, exist_ok=True)
        log_file_name = os.path.join(
            loader.logdir,
            'kcl-l%s-c%s-%s.log' % (loader_idx, cpu_idx, uuid.uuid4()))
        LOGGER.debug('kcl-stress local log: %s', log_file_name)

        LOGGER.debug("'running: %s", stress_cmd)

        if self.stress_num > 1:
            node_cmd = 'taskset -c %s bash -c "%s"' % (cpu_idx, stress_cmd)
        else:
            node_cmd = stress_cmd

        node_cmd = 'cd /hydra-kcl && {}'.format(node_cmd)

        KclStressEvent.start(node=loader, stress_cmd=stress_cmd).publish()

        try:
            result = docker.run(
                cmd=node_cmd,
                timeout=self.timeout + self.shutdown_timeout,
                log_file=log_file_name,
            )

            return result

        except Exception as exc:  # pylint: disable=broad-except
            errors_str = format_stress_cmd_error(exc)
            KclStressEvent.failure(
                node=loader,
                stress_cmd=self.stress_cmd,
                log_file_name=log_file_name,
                errors=[
                    errors_str,
                ],
            ).publish()
            raise
        finally:
            KclStressEvent.finish(node=loader,
                                  stress_cmd=stress_cmd,
                                  log_file_name=log_file_name).publish()
Exemplo n.º 4
0
    def _run_stress(self, loader, loader_idx, cpu_idx):
        dns_options = ""
        if self.params.get('alternator_use_dns_routing'):
            dns = RemoteDocker(loader, "scylladb/hydra-loaders:alternator-dns-0.2",
                               command_line=f'python3 /dns_server.py {self.db_node_to_query(loader)} '
                                            f'{self.params.get("alternator_port")}',
                               extra_docker_opts=f'--label shell_marker={self.shell_marker}')
            dns_options += f'--dns {dns.internal_ip_address} --dns-option use-vc'
        docker = RemoteDocker(loader, "scylladb/hydra-loaders:kcl-jdk8-20201104",
                              extra_docker_opts=f'{dns_options} --label shell_marker={self.shell_marker}')
        stress_cmd = self.build_stress_cmd()

        if not os.path.exists(loader.logdir):
            os.makedirs(loader.logdir, exist_ok=True)
        log_file_name = os.path.join(loader.logdir, 'kcl-l%s-c%s-%s.log' %
                                     (loader_idx, cpu_idx, uuid.uuid4()))
        LOGGER.debug('kcl-stress local log: %s', log_file_name)

        LOGGER.debug("'running: %s", stress_cmd)

        if self.stress_num > 1:
            node_cmd = 'taskset -c %s bash -c "%s"' % (cpu_idx, stress_cmd)
        else:
            node_cmd = stress_cmd

        node_cmd = 'cd /hydra-kcl && {}'.format(node_cmd)

        KclStressEvent.start(node=loader, stress_cmd=stress_cmd).publish()

        try:
            result = docker.run(cmd=node_cmd,
                                timeout=self.timeout + self.shutdown_timeout,
                                log_file=log_file_name,
                                )

            return result

        except Exception as exc:  # pylint: disable=broad-except
            errors_str = format_stress_cmd_error(exc)
            KclStressEvent.failure(
                node=loader,
                stress_cmd=self.stress_cmd,
                log_file_name=log_file_name,
                errors=[errors_str, ],
            ).publish()
            raise
        finally:
            KclStressEvent.finish(node=loader, stress_cmd=stress_cmd, log_file_name=log_file_name).publish()
Exemplo n.º 5
0
    def _run_stress(self, loader, loader_idx, cpu_idx):
        dns_options = ""
        cpu_options = ""
        if self.params.get('alternator_use_dns_routing'):
            dns = RemoteDocker(
                loader,
                "scylladb/hydra-loaders:alternator-dns-0.2",
                command_line=
                f'python3 /dns_server.py {self.db_node_to_query(loader)} '
                f'{self.params.get("alternator_port")}',
                extra_docker_opts=f'--label shell_marker={self.shell_marker}')
            dns_options += f'--dns {dns.internal_ip_address} --dns-option use-vc'

        if self.stress_num > 1:
            cpu_options = '--cpuset-cpus="{cpu_idx}"'

        docker = RemoteDocker(
            loader,
            "scylladb/hydra-loaders:ycsb-jdk8-20211104",
            extra_docker_opts=
            f'{dns_options} {cpu_options} --label shell_marker={self.shell_marker}'
        )
        self.copy_template(docker)
        stress_cmd = self.build_stress_cmd()

        if not os.path.exists(loader.logdir):
            os.makedirs(loader.logdir, exist_ok=True)
        log_file_name = os.path.join(
            loader.logdir,
            'ycsb-l%s-c%s-%s.log' % (loader_idx, cpu_idx, uuid.uuid4()))
        LOGGER.debug('ycsb-stress local log: %s', log_file_name)

        def raise_event_callback(sentinel, line):  # pylint: disable=unused-argument
            if line:
                YcsbStressEvent.error(node=loader,
                                      stress_cmd=stress_cmd,
                                      errors=[
                                          line,
                                      ]).publish()

        LOGGER.debug("running: %s", stress_cmd)

        node_cmd = 'cd /YCSB && {}'.format(stress_cmd)

        YcsbStressEvent.start(node=loader, stress_cmd=stress_cmd).publish()

        with YcsbStatsPublisher(loader,
                                loader_idx,
                                ycsb_log_filename=log_file_name):
            try:
                result = docker.run(
                    cmd=node_cmd,
                    timeout=self.timeout + self.shutdown_timeout,
                    log_file=log_file_name,
                    watchers=[
                        FailuresWatcher(r'\sERROR|=UNEXPECTED_STATE|=ERROR',
                                        callback=raise_event_callback,
                                        raise_exception=False)
                    ])
                return self.parse_final_output(result)

            except Exception as exc:
                errors_str = format_stress_cmd_error(exc)
                YcsbStressEvent.failure(
                    node=loader,
                    stress_cmd=self.stress_cmd,
                    log_file_name=log_file_name,
                    errors=[
                        errors_str,
                    ],
                ).publish()
                raise
            finally:
                YcsbStressEvent.finish(node=loader,
                                       stress_cmd=stress_cmd,
                                       log_file_name=log_file_name).publish()
    def _run_stress(self, loader, loader_idx, cpu_idx):
        if not os.path.exists(loader.logdir):
            os.makedirs(loader.logdir, exist_ok=True)
        log_file_name = os.path.join(
            loader.logdir,
            f'ndbench-l{loader_idx}-c{cpu_idx}-{uuid.uuid4()}.log')
        LOGGER.debug('ndbench local log: %s', log_file_name)

        def raise_event_callback(sentinel, line):  # pylint: disable=unused-argument
            if line:
                NdbenchStressEvent.error(node=loader,
                                         stress_cmd=self.stress_cmd,
                                         errors=[
                                             str(line),
                                         ]).publish()

        LOGGER.debug("running: %s", self.stress_cmd)

        if self.stress_num > 1:
            node_cmd = f'taskset -c {cpu_idx} bash -c "{self.stress_cmd}"'
        else:
            node_cmd = self.stress_cmd

        docker = RemoteDocker(
            loader,
            'scylladb/hydra-loaders:ndbench-jdk8-20200209',
            extra_docker_opts=
            f'--network=host --label shell_marker={self.shell_marker}')

        node_cmd = f'STRESS_TEST_MARKER={self.shell_marker}; cd /ndbench && {node_cmd}'

        NdbenchStressEvent.start(node=loader,
                                 stress_cmd=self.stress_cmd).publish()

        with NdBenchStatsPublisher(loader,
                                   loader_idx,
                                   ndbench_log_filename=log_file_name):
            try:
                return docker.run(
                    cmd=node_cmd,
                    timeout=self.timeout + self.shutdown_timeout,
                    ignore_status=True,
                    log_file=log_file_name,
                    verbose=True,
                    watchers=[
                        FailuresWatcher(
                            r'\sERROR|\sFAILURE|\sFAILED|\sis\scorrupt',
                            callback=raise_event_callback,
                            raise_exception=False)
                    ])
            except Exception as exc:
                NdbenchStressEvent.failure(node=str(loader),
                                           stress_cmd=self.stress_cmd,
                                           log_file_name=log_file_name,
                                           errors=[
                                               format_stress_cmd_error(exc),
                                           ]).publish()
            finally:
                NdbenchStressEvent.finish(
                    node=loader,
                    stress_cmd=self.stress_cmd,
                    log_file_name=log_file_name).publish()