diff options
author | Jürg Billeter <j@bitron.ch> | 2017-07-18 15:48:43 +0200 |
---|---|---|
committer | Jürg Billeter <j@bitron.ch> | 2017-07-20 07:24:56 +0200 |
commit | 21f546fa35eaefef2048918afa83b1f222d6839c (patch) | |
tree | bbb9d51247b54e1a999e026dfe5409b98e277865 | |
parent | 33a337c4b7006d8d7e653c504bb42a45febaa65c (diff) | |
download | buildstream-21f546fa35eaefef2048918afa83b1f222d6839c.tar.gz |
_artifactcache: Use subprocess to fetch summary
OSTree fetch operations in subprocesses hang if OSTree fetch operations
have been used in the main process.
-rw-r--r-- | buildstream/_artifactcache/artifactcache.py | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/buildstream/_artifactcache/artifactcache.py b/buildstream/_artifactcache/artifactcache.py index 6f95586fc..81d3adc4a 100644 --- a/buildstream/_artifactcache/artifactcache.py +++ b/buildstream/_artifactcache/artifactcache.py @@ -18,7 +18,9 @@ # Authors: # Jürg Billeter <juerg.billeter@codethink.co.uk> +import multiprocessing import os +import sys import tempfile from .. import _ostree, utils @@ -250,7 +252,22 @@ class ArtifactCache(): else: raise _ArtifactError("Attempt to fetch remote refs without any pull URL") - self.__remote_refs = _ostree.list_remote_refs(self.repo, remote=remote) + def child_action(repo, remote, q): + try: + q.put((True, _ostree.list_remote_refs(self.repo, remote=remote))) + except OSTreeError as e: + q.put((False, e)) + + q = multiprocessing.Queue() + p = multiprocessing.Process(target=child_action, args=(self.repo, remote, q)) + p.start() + ret, res = q.get() + p.join() + + if ret: + self.__remote_refs = res + else: + raise _ArtifactError("Failed to fetch remote refs") from res # can_push(): # |