def __init__(self,
              label: str = "",
              file_name: str = None,
              ignore_first_line: bool = True,
              file_sep: str = "|",
              file_max_split: int = 2,
              file_field: int = 2,
              client_stat: ClientStatistic = None,
              **kwargs):
     self._logger = logging.getLogger(self.__class__.__name__)
     self._test_label = label
     self._client_stat = client_stat
     if not isinstance(self._client_stat, ClientStatistic):
         raise RuntimeError("Bad Statistic obj")
     random.seed()
     self._data_file = None
     self._file_start_pos = 0
     self._file_sep = file_sep if file_sep else "|"
     self._file_max_split = file_max_split
     self._file_field = file_field
     if file_name is not None:
         self._data_file = open(check_fs(is_dir=False, fs_name=file_name),
                                "rt")
         if ignore_first_line:
             self._data_file.readline()
             self._file_start_pos = self._data_file.tell()
     self._taa_text = None
     self._taa_version = None
     self._taa_mechanism = None
     self._taa_time = None
Esempio n. 2
0
    conf_vals = {}
    try:
        if extra:
            with open(extra[0], "r") as conf_file:
                conf_vals = yaml.load(conf_file)
    except Exception as ex:
        print("Config parse error", ex)
        conf_vals = {}

    dict_args.update(conf_vals)

    if not dict_args["seed"]:
        dict_args["seed"].append("000000000000000000000000Trustee1")

    dict_args["genesis_path"] = check_fs(False, dict_args["genesis_path"])
    dict_args["out_dir"] = check_fs(True, dict_args["out_dir"])

    # Prepare output directory
    out_dir = dict_args["out_dir"]
    test_name = "load_test_{}".format(datetime.now().strftime("%Y%m%d_%H%M%S"))
    out_dir = os.path.expanduser(os.path.join(out_dir, test_name))
    if not os.path.exists(out_dir):
        os.makedirs(out_dir)

    # Initialize logger
    log_lvl = dict_args["log_lvl"]
    logger_init(out_dir, "{}.log".format(test_name), log_lvl)

    check_genesis(dict_args["genesis_path"])