Skip to content

Commit

Permalink
Stop propgagating signal to coordinator subprocess when launching loc…
Browse files Browse the repository at this point in the history
…ally (#190)
  • Loading branch information
lidongze0629 authored Mar 15, 2021
1 parent 6f98f82 commit f807eef
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
9 changes: 8 additions & 1 deletion coordinator/gscoordinator/coordinator.py
Original file line number Diff line number Diff line change
Expand Up @@ -944,8 +944,15 @@ def launch_graphscope():
logger.info("Coordinator server listen at 0.0.0.0:%d", args.port)

server.start()

# handle SIGTERM signal
def terminate(signum, frame):
del coordinator_service_servicer # noqa: F821

signal.signal(signal.SIGTERM, terminate)

try:
# Grpc has handled SIGINT/SIGTERM
# Grpc has handled SIGINT
server.wait_for_termination()
except KeyboardInterrupt:
del coordinator_service_servicer
Expand Down
3 changes: 3 additions & 0 deletions python/graphscope/client/session.py
Original file line number Diff line number Diff line change
Expand Up @@ -1109,8 +1109,11 @@ def _launch_coordinator_on_local(config_params):

env = os.environ.copy()
env["PYTHONUNBUFFERED"] = "TRUE"
# Param `start_new_session=True` is for putting child process to a new process group
# so it won't get the signals from parent.
process = subprocess.Popen(
cmd,
start_new_session=True,
cwd=COORDINATOR_HOME,
universal_newlines=True,
encoding="utf-8",
Expand Down

0 comments on commit f807eef

Please sign in to comment.