def execute(source_path, output_path, device_id): """ Execute the parser. Args: source_path (str): the source file path. output_path (str): the output file path. device_id (str): the device id. """ col_names = ["node_name", "start_time", "end_time", "queue_size"] minddata_aicpu_source_path = get_file_join_name( input_path=source_path, file_name='DATA_PREPROCESS.dev.AICPUMI') if not minddata_aicpu_source_path: minddata_aicpu_source_path = get_file_join_name( input_path=os.path.join(source_path, "data"), file_name='DATA_PREPROCESS.dev.AICPUMI') if not minddata_aicpu_source_path: return minddata_aicpu_output_path = os.path.join( output_path, "minddata_aicpu_" + device_id + ".txt") minddata_aicpu_data = MinddataParser.parse_minddata_aicpu_data( minddata_aicpu_source_path) if minddata_aicpu_data: fwrite_format(minddata_aicpu_output_path, tabulate(minddata_aicpu_data, col_names, tablefmt='simple'), is_start=True)
def get_source_file(self): """Get log file name, which was created by ada service.""" file_name = get_file_join_name(self._input_path, self._source_file_target) if not file_name: data_path = os.path.join(self._input_path, "data") file_name = get_file_join_name(data_path, self._source_file_target) return file_name
def _get_source_file(self): """Get hwts log file name, which was created by ada service.""" file_name = get_file_join_name(self._input_path, self._source_file_target) if not file_name: data_path = os.path.join(self._input_path, "data") file_name = get_file_join_name(data_path, self._source_file_target) if not file_name: msg = ("Fail to find hwts log file, under profiling directory") raise RuntimeError(msg) return file_name
def _get_source_file(self): """Get log file name, which was created by ada service.""" return get_file_join_name(self._input_path, _source_file_target)