Skip to content

Commit 99243e3

Browse files
ShenYuhanSteffy-zxf
authored andcommitted
modify serving&config help (#330)
1 parent f9254b9 commit 99243e3

File tree

3 files changed

+35
-26
lines changed

3 files changed

+35
-26
lines changed

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ $ hub serving start --config config.json
153153

154154
config.json文件包含待部署模型信息等,
155155

156-
关于PaddleHub Serving详细信息参考[PaddleHub Serving一键服务化部署](./tutorial/serving.md)
156+
关于PaddleHub Serving详细信息参见[PaddleHub Serving一键服务化部署](./tutorial/serving.md)
157157

158158
### 超参优化AutoDL Finetuner
159159

paddlehub/commands/config.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -90,12 +90,12 @@ def set_log_level(level):
9090
@staticmethod
9191
def show_help():
9292
str = "config <option>\n"
93-
str += "\tShow hub server config without any option.\n"
93+
str += "\tShow PaddleHub config without any option.\n"
9494
str += "option:\n"
9595
str += "reset\n"
9696
str += "\tReset config as default.\n"
9797
str += "server==[URL]\n"
98-
str += "\tSet hub server url as [URL].\n"
98+
str += "\tSet PaddleHub Server url as [URL].\n"
9999
str += "log==[LEVEL]\n"
100100
str += "\tSet log level as [LEVEL:NOLOG, DEBUG, INFO, WARNING, ERROR, CRITICAL].\n"
101101
print(str)

paddlehub/commands/serving.py

+32-23
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ class ServingCommand(BaseCommand):
8484
def __init__(self, name):
8585
super(ServingCommand, self).__init__(name)
8686
self.show_in_help = True
87-
self.description = "Start a service for online predicting by using PaddleHub."
87+
self.description = "Start Module Serving or Bert Service for online predicting."
8888
self.parser = argparse.ArgumentParser(
8989
description=self.__class__.__doc__,
9090
prog='%s %s [COMMAND]' % (ENTRY, name),
@@ -124,7 +124,7 @@ def load_pid_file(filepath, port=None):
124124
port = os.path.basename(filepath).split(".")[0].split("_")[1]
125125
if not os.path.exists(filepath):
126126
print(
127-
"PaddleHub-Serving config file is not exists, "
127+
"PaddleHub Serving config file is not exists, "
128128
"please confirm the port [%s] you specified is correct." % port)
129129
return False
130130
with open(filepath, "r") as fp:
@@ -143,9 +143,9 @@ def stop_serving(self, port):
143143
os.remove(filepath)
144144

145145
if not pid_is_exist(pid):
146-
print("PaddleHub-Serving has been stopped.")
146+
print("PaddleHub Serving has been stopped.")
147147
return
148-
print("PaddleHub-Serving will stop.")
148+
print("PaddleHub Serving will stop.")
149149
CacheUpdater(
150150
"hub_serving_stop",
151151
module=module,
@@ -160,7 +160,7 @@ def stop_serving(self, port):
160160
@staticmethod
161161
def start_bert_serving(args):
162162
if platform.system() != "Linux":
163-
print("Error. Bert-Service only support linux.")
163+
print("Error. Bert Service only support linux.")
164164
return False
165165

166166
if ServingCommand.is_port_occupied("127.0.0.1", args.port) is True:
@@ -213,7 +213,7 @@ def preinstall_modules(modules):
213213
"category": str(m.type).split("/")[0].upper()
214214
})
215215
except Exception as err:
216-
print(err, ", start Hub-Serving unsuccessfully.")
216+
print(err, ", start PaddleHub Serving unsuccessfully.")
217217
exit(1)
218218
return configs
219219

@@ -263,7 +263,7 @@ def start_multi_app_with_file(configs):
263263
options = {"bind": "0.0.0.0:%s" % port, "workers": workers}
264264
StandaloneApplication(
265265
app.create_app(init_flag=False, configs=configs), options).run()
266-
print("PaddleHub-Serving has been stopped.")
266+
print("PaddleHub Serving has been stopped.")
267267

268268
def start_app_with_args(self, workers):
269269
module = self.args.modules
@@ -330,7 +330,7 @@ def start_multi_app_with_args(self):
330330
StandaloneApplication(
331331
app.create_app(init_flag=False, configs=configs),
332332
options).run()
333-
print("PaddleHub-Serving has been stopped.")
333+
print("PaddleHub Serving has been stopped.")
334334
else:
335335
print("Lack of necessary parameters!")
336336

@@ -344,7 +344,7 @@ def start_serving(self):
344344
if platform.system() == "Windows":
345345
print(
346346
"Warning: Windows cannot use multiprocess working "
347-
"mode, Hub-Serving will switch to single process mode"
347+
"mode, PaddleHub Serving will switch to single process mode"
348348
)
349349
ServingCommand.start_single_app_with_file(configs)
350350
else:
@@ -358,8 +358,10 @@ def start_serving(self):
358358
print("config_file ", config_file, "not exists.")
359359
else:
360360
if platform.system() == "Windows":
361-
print("Warning: Windows cannot use multiprocess working "
362-
"mode, Hub-Serving will switch to single process mode")
361+
print(
362+
"Warning: Windows cannot use multiprocess working "
363+
"mode, PaddleHub Serving will switch to single process mode"
364+
)
363365
self.start_single_app_with_args()
364366
else:
365367
if self.args.use_multiprocess is True:
@@ -370,34 +372,41 @@ def start_serving(self):
370372
@staticmethod
371373
def show_help():
372374
str = "serving <option>\n"
373-
str += "\tManage PaddleHub-Serving.\n"
375+
str += "\tManage PaddleHub Serving.\n"
374376
str += "sub command:\n"
375377
str += "1. start\n"
376-
str += "\tStart PaddleHub-Serving if specifies this parameter.\n"
377-
str += "2. start bert_service\n"
378-
str += "\tStart Bert Service if specifies this parameter.\n"
378+
str += "\tStart PaddleHub Serving.\n"
379+
str += "2. stop\n"
380+
str += "\tStop PaddleHub Serving.\n"
381+
str += "3. start bert_service\n"
382+
str += "\tStart Bert Service.\n"
379383
str += "\n"
380384
str += "[start] option:\n"
381385
str += "--modules/-m [module1==version, module2==version...]\n"
382-
str += "\tPre-install modules via this parameter list.\n"
386+
str += "\tPre-install modules via the parameter list.\n"
383387
str += "--port/-p XXXX\n"
384388
str += "\tUse port XXXX for serving.\n"
385389
str += "--use_gpu\n"
386-
str += "\tUse gpu for predicting if specifies this parameter.\n"
390+
str += "\tUse gpu for predicting if you specify the parameter.\n"
387391
str += "--use_multiprocess\n"
388392
str += "\tChoose multoprocess mode, cannot be use on Windows.\n"
389393
str += "--config/-c file_path\n"
390-
str += "\tUse configs in file to starting paddlehub serving. "
391-
str += "Other parameter will be ignored if specifies this parameter.\n"
394+
str += "\tUse configs in file to start PaddleHub Serving. "
395+
str += "Other parameters will be ignored if you specify the parameter.\n"
396+
str += "\n"
397+
str += "[stop] option:\n"
398+
str += "--port/-p XXXX\n"
399+
str += "\tStop PaddleHub Serving on port XXXX safely.\n"
400+
str += "\n"
392401
str += "[start bert_service] option:\n"
393402
str += "--modules/-m\n"
394-
str += "\tPre-install modules via this parameter.\n"
403+
str += "\tPre-install modules via the parameter.\n"
395404
str += "--port/-p XXXX\n"
396405
str += "\tUse port XXXX for serving.\n"
397406
str += "--use_gpu\n"
398-
str += "\tUse gpu for predicting if specifies this parameter.\n"
407+
str += "\tUse gpu for predicting if specifies the parameter.\n"
399408
str += "--gpu\n"
400-
str += "\tSpecify the graphics card to use.\n"
409+
str += "\tSpecify the GPU devices to use.\n"
401410
print(str)
402411

403412
def execute(self, argv):
@@ -415,7 +424,7 @@ def execute(self, argv):
415424
ServingCommand.show_help()
416425
elif self.args.sub_command == "stop":
417426
if self.args.bert_service == "bert_service":
418-
print("Please stop bert_service by kill process by yourself")
427+
print("Please stop Bert Service by kill process by yourself")
419428
elif self.args.bert_service is None:
420429
self.stop_serving(port=self.args.port)
421430
else:

0 commit comments

Comments
 (0)