import json
import argparse
import socket
import tempfile
from collections import defaultdict
import contextlib

# disable InsecureRequestWarning
import urllib3

sys.path.append(os.path.join(os.path.dirname(__file__), '..'))
from sdcm.results_analyze import BaseResultsAnalyzer  # pylint: disable=wrong-import-position
from sdcm.utils.log import setup_stdout_logger  # pylint: disable=wrong-import-position

urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)
setup_stdout_logger()

LOGGER = logging.getLogger("microbenchmarking")
LOGGER.setLevel(logging.DEBUG)


@contextlib.contextmanager
def chdir(dirname=None):
    curdir = os.getcwd()
    try:
        if dirname is not None:
            os.chdir(dirname)
        yield
    finally:
        os.chdir(curdir)
Пример #2
0
from sdcm.results_analyze import PerformanceResultsAnalyzer
from sdcm.sct_config import SCTConfiguration
from sdcm.utils.cloud_monitor import cloud_report
from sdcm.utils.common import (list_instances_aws, list_instances_gce, clean_cloud_instances,
                               AWS_REGIONS, get_scylla_ami_versions, get_s3_scylla_repos_mapping,
                               list_logs_by_test_id, get_branched_ami, gce_meta_to_dict,
                               aws_tags_to_dict, list_elastic_ips_aws, get_builder_by_test_id,
                               clean_aws_instances_according_post_behavior,
                               clean_gce_instances_according_post_behavior,
                               search_test_id_in_latest, get_testrun_dir)
from sdcm.utils.monitorstack import restore_monitor_stack
from sdcm.cluster import Setup
from sdcm.utils.log import setup_stdout_logger

LOGGER = setup_stdout_logger()

click_completion.init()


def sct_option(name, sct_name, **kwargs):
    sct_opt = SCTConfiguration.get_config_option(sct_name)
    multimple_use = kwargs.pop('multiple', False)
    sct_opt.update(kwargs)
    return click.option(name, type=sct_opt['type'], help=sct_opt['help'], multiple=multimple_use)


def install_callback(ctx, _, value):
    if not value or ctx.resilient_parsing:
        return value
    shell, path = click_completion.core.install()