提交 7cdfbf5b 编写于 作者: F felixhjh

modify env_check help command

上级 011ea89a
...@@ -3,6 +3,7 @@ import argparse ...@@ -3,6 +3,7 @@ import argparse
import base64 import base64
import subprocess import subprocess
import numpy as np import numpy as np
import sys
class ServingTest(object): class ServingTest(object):
def __init__(self, data_path: str, example_path: str, model_dir: str, client_dir: str): def __init__(self, data_path: str, example_path: str, model_dir: str, client_dir: str):
...@@ -15,7 +16,9 @@ class ServingTest(object): ...@@ -15,7 +16,9 @@ class ServingTest(object):
code_path = os.path.dirname(os.path.realpath(__file__)) code_path = os.path.dirname(os.path.realpath(__file__))
self.data_path = f"{code_path}/{data_path}/" self.data_path = f"{code_path}/{data_path}/"
self.example_path = f"{code_path}/{example_path}/" self.example_path = f"{code_path}/{example_path}/"
self.py_version = os.environ.get("PYTHON_EXECUTABLE") self.py_version = sys.executable
if 'PYTHON_EXECUTABLE' in os.environ:
self.py_version = os.environ.get("PYTHON_EXECUTABLE")
self.model_dir = model_dir self.model_dir = model_dir
self.client_config = f"{client_dir}/serving_client_conf.prototxt" self.client_config = f"{client_dir}/serving_client_conf.prototxt"
......
...@@ -473,31 +473,39 @@ def stop_serving(command: str, port: int=None): ...@@ -473,31 +473,39 @@ def stop_serving(command: str, port: int=None):
return True return True
class Check_Env_Shell(cmd.Cmd): class Check_Env_Shell(cmd.Cmd):
intro = 'Welcome to the check env shell.Type help or ? to list commands.\n' intro = "Welcome to the check env shell.Type help to list commands.\n"
#prompt = '(check) '
# ----- basic commands ----- # ----- basic commands -----
def do_help(self, arg):
print("\nCommand list\n"\
"check_all\tCheck Environment of Paddle Inference, Pipeline Serving, C++ Serving\n"\
"check_pipeline\tCheck Environment of Pipeline Serving\n"\
"check_cpp\tCheck Environment of C++ Serving\n"\
"check_inference\tCheck Environment of Paddle Inference\n"\
"debug\tOpen pytest log to debug\n"\
"exit\tExit Check Env Shell\n")
def do_check_all(self, arg): def do_check_all(self, arg):
'Check Environment of Paddle Inference, Pipeline Serving, C++ Serving' "Check Environment of Paddle Inference, Pipeline Serving, C++ Serving"
check_env("all") check_env("all")
def do_check_pipeline(self, arg): def do_check_pipeline(self, arg):
'Check Environment of Pipeline Serving' "Check Environment of Pipeline Serving"
check_env("pipeline") check_env("pipeline")
def do_check_cpp(self, arg): def do_check_cpp(self, arg):
'Check Environment of C++ Serving' "Check Environment of C++ Serving"
check_env("cpp") check_env("cpp")
def do_check_inference(self, arg): def do_check_inference(self, arg):
'Check Environment of Paddle Inference' "Check Environment of Paddle Inference"
check_env("inference") check_env("inference")
def do_debug(self, arg): def do_debug(self, arg):
'Open pytest log to debug' "Open pytest log to debug"
check_env("debug") check_env("debug")
def do_exit(self, arg): def do_exit(self, arg):
'Exit Check Env Shell' "Exit Check Env Shell"
print('Check Environment Shell Exit') print('Check Environment Shell Exit')
os._exit(0) os._exit(0)
return True return True
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册