summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJürg Billeter <j@bitron.ch>2019-10-10 16:45:46 +0200
committerJürg Billeter <j@bitron.ch>2019-10-15 10:56:17 +0200
commitd0a06b0aadb365420ec6b6df8ac50f4851bd075b (patch)
treef83e00cb482c8839255c277e8dd7b59b0425ef2f
parent64a5f4a9cc0d3d7e2dac0a7cc48510687e02ee88 (diff)
downloadbuildstream-d0a06b0aadb365420ec6b6df8ac50f4851bd075b.tar.gz
_remote.py: Do not use subprocess to check remote
This is no longer required as gRPC connections are closed before fork.
-rw-r--r--src/buildstream/_remote.py43
1 files changed, 6 insertions, 37 deletions
diff --git a/src/buildstream/_remote.py b/src/buildstream/_remote.py
index 1daf2f26f..8527ca4cc 100644
--- a/src/buildstream/_remote.py
+++ b/src/buildstream/_remote.py
@@ -15,16 +15,12 @@
# License along with this library. If not, see <http://www.gnu.org/licenses/>.
#
-import multiprocessing
import os
-import signal
from collections import namedtuple
from urllib.parse import urlparse
import grpc
-from . import _signals
-from . import utils
from ._exceptions import LoadError, LoadErrorReason, ImplError, RemoteError
from .types import FastEnum
@@ -219,41 +215,14 @@ class BaseRemote():
# RemoteError: If the grpc call fails.
#
def check(self):
- queue = multiprocessing.Queue()
-
- def __check_remote():
- try:
- self.init()
- queue.put(self._check())
-
- except grpc.RpcError as e:
- # str(e) is too verbose for errors reported to the user
- queue.put(e.details())
-
- except Exception as e: # pylint: disable=broad-except
- # Whatever happens, we need to return it to the calling process
- #
- queue.put(str(e))
-
- process = multiprocessing.Process(target=__check_remote)
-
try:
- # Keep SIGINT blocked in the child process
- with _signals.blocked([signal.SIGINT], ignore=False):
- process.start()
-
- error = queue.get()
- process.join()
- except KeyboardInterrupt:
- utils._kill_process_tree(process.pid)
- raise
+ self.init()
+ self._check()
+ except grpc.RpcError as e:
+ # str(e) is too verbose for errors reported to the user
+ raise RemoteError(e.details())
finally:
- # Should not be necessary, but let's avoid keeping them
- # alive too long
- queue.close()
-
- if error:
- raise RemoteError(error)
+ self.close()
# _check():
#