# -------------------------------------------------------------------------
# This file is part of the MindStudio project.
# Copyright (c) 2025-2026 Huawei Technologies Co.,Ltd.
#
# MindStudio is licensed under Mulan PSL v2.
# You can use this software according to the terms and conditions of the Mulan PSL v2.
# You may obtain a copy of Mulan PSL v2 at:
#
# `http://license.coscl.org.cn/MulanPSL2`
#
# THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
# See the Mulan PSL v2 for more details.
# -------------------------------------------------------------------------
import logging
from test.st.executor.exec_command import CommandExecutor
class ExecParse(CommandExecutor):
def __init__(self):
super().__init__()
self.input_path = ""
self.output_path = ""
self.params = []
def set_input_path(self, input_path):
self.input_path = input_path
def set_output_path(self, output_path):
self.output_path = output_path
def add_param(self, *param_str):
self.params.extend(param_str)
def ready_go(self):
# 执行
self.execute(["python", "-m", "ms_service_profiler.parse",
"--input-path", self.input_path,
"--output-path", self.output_path] + self.params)
exit_code, _ = self.wait(timeout=600) # 等个10分钟,解析不完直接自杀
logging.info(f"wait result: {exit_code}")
return exit_code == 0