@@ -84,7 +84,7 @@ class ServingCommand(BaseCommand):
84
84
def __init__ (self , name ):
85
85
super (ServingCommand , self ).__init__ (name )
86
86
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 ."
88
88
self .parser = argparse .ArgumentParser (
89
89
description = self .__class__ .__doc__ ,
90
90
prog = '%s %s [COMMAND]' % (ENTRY , name ),
@@ -124,7 +124,7 @@ def load_pid_file(filepath, port=None):
124
124
port = os .path .basename (filepath ).split ("." )[0 ].split ("_" )[1 ]
125
125
if not os .path .exists (filepath ):
126
126
print (
127
- "PaddleHub- Serving config file is not exists, "
127
+ "PaddleHub Serving config file is not exists, "
128
128
"please confirm the port [%s] you specified is correct." % port )
129
129
return False
130
130
with open (filepath , "r" ) as fp :
@@ -143,9 +143,9 @@ def stop_serving(self, port):
143
143
os .remove (filepath )
144
144
145
145
if not pid_is_exist (pid ):
146
- print ("PaddleHub- Serving has been stopped." )
146
+ print ("PaddleHub Serving has been stopped." )
147
147
return
148
- print ("PaddleHub- Serving will stop." )
148
+ print ("PaddleHub Serving will stop." )
149
149
CacheUpdater (
150
150
"hub_serving_stop" ,
151
151
module = module ,
@@ -160,7 +160,7 @@ def stop_serving(self, port):
160
160
@staticmethod
161
161
def start_bert_serving (args ):
162
162
if platform .system () != "Linux" :
163
- print ("Error. Bert- Service only support linux." )
163
+ print ("Error. Bert Service only support linux." )
164
164
return False
165
165
166
166
if ServingCommand .is_port_occupied ("127.0.0.1" , args .port ) is True :
@@ -213,7 +213,7 @@ def preinstall_modules(modules):
213
213
"category" : str (m .type ).split ("/" )[0 ].upper ()
214
214
})
215
215
except Exception as err :
216
- print (err , ", start Hub- Serving unsuccessfully." )
216
+ print (err , ", start PaddleHub Serving unsuccessfully." )
217
217
exit (1 )
218
218
return configs
219
219
@@ -263,7 +263,7 @@ def start_multi_app_with_file(configs):
263
263
options = {"bind" : "0.0.0.0:%s" % port , "workers" : workers }
264
264
StandaloneApplication (
265
265
app .create_app (init_flag = False , configs = configs ), options ).run ()
266
- print ("PaddleHub- Serving has been stopped." )
266
+ print ("PaddleHub Serving has been stopped." )
267
267
268
268
def start_app_with_args (self , workers ):
269
269
module = self .args .modules
@@ -330,7 +330,7 @@ def start_multi_app_with_args(self):
330
330
StandaloneApplication (
331
331
app .create_app (init_flag = False , configs = configs ),
332
332
options ).run ()
333
- print ("PaddleHub- Serving has been stopped." )
333
+ print ("PaddleHub Serving has been stopped." )
334
334
else :
335
335
print ("Lack of necessary parameters!" )
336
336
@@ -344,7 +344,7 @@ def start_serving(self):
344
344
if platform .system () == "Windows" :
345
345
print (
346
346
"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"
348
348
)
349
349
ServingCommand .start_single_app_with_file (configs )
350
350
else :
@@ -358,8 +358,10 @@ def start_serving(self):
358
358
print ("config_file " , config_file , "not exists." )
359
359
else :
360
360
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
+ )
363
365
self .start_single_app_with_args ()
364
366
else :
365
367
if self .args .use_multiprocess is True :
@@ -370,34 +372,41 @@ def start_serving(self):
370
372
@staticmethod
371
373
def show_help ():
372
374
str = "serving <option>\n "
373
- str += "\t Manage PaddleHub- Serving.\n "
375
+ str += "\t Manage PaddleHub Serving.\n "
374
376
str += "sub command:\n "
375
377
str += "1. start\n "
376
- str += "\t Start PaddleHub-Serving if specifies this parameter.\n "
377
- str += "2. start bert_service\n "
378
- str += "\t Start Bert Service if specifies this parameter.\n "
378
+ str += "\t Start PaddleHub Serving.\n "
379
+ str += "2. stop\n "
380
+ str += "\t Stop PaddleHub Serving.\n "
381
+ str += "3. start bert_service\n "
382
+ str += "\t Start Bert Service.\n "
379
383
str += "\n "
380
384
str += "[start] option:\n "
381
385
str += "--modules/-m [module1==version, module2==version...]\n "
382
- str += "\t Pre-install modules via this parameter list.\n "
386
+ str += "\t Pre-install modules via the parameter list.\n "
383
387
str += "--port/-p XXXX\n "
384
388
str += "\t Use port XXXX for serving.\n "
385
389
str += "--use_gpu\n "
386
- str += "\t Use gpu for predicting if specifies this parameter.\n "
390
+ str += "\t Use gpu for predicting if you specify the parameter.\n "
387
391
str += "--use_multiprocess\n "
388
392
str += "\t Choose multoprocess mode, cannot be use on Windows.\n "
389
393
str += "--config/-c file_path\n "
390
- str += "\t Use configs in file to starting paddlehub serving. "
391
- str += "Other parameter will be ignored if specifies this parameter.\n "
394
+ str += "\t Use 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 += "\t Stop PaddleHub Serving on port XXXX safely.\n "
400
+ str += "\n "
392
401
str += "[start bert_service] option:\n "
393
402
str += "--modules/-m\n "
394
- str += "\t Pre-install modules via this parameter.\n "
403
+ str += "\t Pre-install modules via the parameter.\n "
395
404
str += "--port/-p XXXX\n "
396
405
str += "\t Use port XXXX for serving.\n "
397
406
str += "--use_gpu\n "
398
- str += "\t Use gpu for predicting if specifies this parameter.\n "
407
+ str += "\t Use gpu for predicting if specifies the parameter.\n "
399
408
str += "--gpu\n "
400
- str += "\t Specify the graphics card to use.\n "
409
+ str += "\t Specify the GPU devices to use.\n "
401
410
print (str )
402
411
403
412
def execute (self , argv ):
@@ -415,7 +424,7 @@ def execute(self, argv):
415
424
ServingCommand .show_help ()
416
425
elif self .args .sub_command == "stop" :
417
426
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" )
419
428
elif self .args .bert_service is None :
420
429
self .stop_serving (port = self .args .port )
421
430
else :
0 commit comments