Skip to content

Commit

Permalink
Merge branch 'develop' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
bjjwwang authored Nov 8, 2021
2 parents a3ab610 + 0376fd4 commit 433ff7f
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 11 deletions.
23 changes: 13 additions & 10 deletions python/paddle_serving_server/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,16 +59,19 @@ def kill_stop_process_by_pid(command : str, pid : int):
if not pid_is_exist(pid):
print("Process [%s] has been stopped."%pid)
return
try:
if command == "stop":
os.killpg(pid, signal.SIGINT)
elif command == "kill":
os.killpg(pid, signal.SIGKILL)
except ProcessLookupError:
if command == "stop":
os.kill(pid, signal.SIGINT)
elif command == "kill":
os.kill(pid, signal.SIGKILL)
if platform.system() == "Windows":
os.kill(pid, signal.SIGINT)
else:
try:
if command == "stop":
os.killpg(pid, signal.SIGINT)
elif command == "kill":
os.killpg(pid, signal.SIGKILL)
except ProcessLookupError:
if command == "stop":
os.kill(pid, signal.SIGINT)
elif command == "kill":
os.kill(pid, signal.SIGKILL)

def dump_pid_file(portList, model):
'''
Expand Down
5 changes: 4 additions & 1 deletion python/paddle_serving_server/web_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
from paddle_serving_server import pipeline
from paddle_serving_server.pipeline import Op
from paddle_serving_server.serve import format_gpu_to_strlist
from paddle_serving_server.util import dump_pid_file


def port_is_available(port):
Expand Down Expand Up @@ -260,7 +261,9 @@ def prepare_server(self,
self.gpu_multi_stream = gpu_multi_stream
self.op_num = op_num
self.op_max_batch = op_max_batch


# record port and pid info for stopping process
dump_pid_file([self.port], "web_service")
# if gpuid != None, we will use gpuid first.
# otherwise, keep the self.gpus unchanged.
# maybe self.gpus is set by the Function set_gpus.
Expand Down

0 comments on commit 433ff7f

Please sign in to comment.