summaryrefslogtreecommitdiffstats
path: root/bitbake/lib/hashserv/client.py
diff options
context:
space:
mode:
authorJoshua Watt <JPEWhacker@gmail.com>2020-11-10 08:59:56 -0600
committerRichard Purdie <richard.purdie@linuxfoundation.org>2020-11-24 15:26:12 +0000
commit96b548a79d87120655da3ac5501b8ad4726cf1a4 (patch)
tree06938cfe533173ad02664dc2f187867a165c5871 /bitbake/lib/hashserv/client.py
parent859f43e176dcaaa652e24a2289abd75e18c077cf (diff)
downloadpoky-96b548a79d87120655da3ac5501b8ad4726cf1a4.tar.gz
bitbake: bitbake: hashserve: Add support for readonly upstream
Adds support for an upstream server to be specified. The upstream server will be queried for equivalent hashes whenever a miss is found in the local server. If the server returns a match, it is merged into the local database. In order to keep the get stream queries as fast as possible since they are the critical path when bitbake is preparing the run queue, missing tasks provided by the server are not immediately pulled from the upstream server, but instead are put into a queue to be backfilled by a worker task later. (Bitbake rev: e6d6c0b39393e9bdf378c1eba141f815e26b724b) Signed-off-by: Joshua Watt <JPEWhacker@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/lib/hashserv/client.py')
-rw-r--r--bitbake/lib/hashserv/client.py19
1 files changed, 12 insertions, 7 deletions
diff --git a/bitbake/lib/hashserv/client.py b/bitbake/lib/hashserv/client.py
index d0b3cf3863..ae5875d1b3 100644
--- a/bitbake/lib/hashserv/client.py
+++ b/bitbake/lib/hashserv/client.py
@@ -178,18 +178,16 @@ class AsyncClient(object):
178 await self._set_mode(self.MODE_NORMAL) 178 await self._set_mode(self.MODE_NORMAL)
179 return await self.send_message({"reset-stats": None}) 179 return await self.send_message({"reset-stats": None})
180 180
181 async def backfill_wait(self):
182 await self._set_mode(self.MODE_NORMAL)
183 return (await self.send_message({"backfill-wait": None}))["tasks"]
184
181 185
182class Client(object): 186class Client(object):
183 def __init__(self): 187 def __init__(self):
184 self.client = AsyncClient() 188 self.client = AsyncClient()
185 self.loop = asyncio.new_event_loop() 189 self.loop = asyncio.new_event_loop()
186 190
187 def get_wrapper(self, downcall):
188 def wrapper(*args, **kwargs):
189 return self.loop.run_until_complete(downcall(*args, **kwargs))
190
191 return wrapper
192
193 for call in ( 191 for call in (
194 "connect_tcp", 192 "connect_tcp",
195 "connect_unix", 193 "connect_unix",
@@ -200,9 +198,16 @@ class Client(object):
200 "get_taskhash", 198 "get_taskhash",
201 "get_stats", 199 "get_stats",
202 "reset_stats", 200 "reset_stats",
201 "backfill_wait",
203 ): 202 ):
204 downcall = getattr(self.client, call) 203 downcall = getattr(self.client, call)
205 setattr(self, call, get_wrapper(self, downcall)) 204 setattr(self, call, self._get_downcall_wrapper(downcall))
205
206 def _get_downcall_wrapper(self, downcall):
207 def wrapper(*args, **kwargs):
208 return self.loop.run_until_complete(downcall(*args, **kwargs))
209
210 return wrapper
206 211
207 @property 212 @property
208 def max_chunk(self): 213 def max_chunk(self):