diff options
author | Scott Murray <scott.murray@konsulko.com> | 2021-08-19 12:51:55 -0400 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2021-08-23 08:30:55 +0100 |
commit | 3874ce6ee53e6dbb6f84ac3becb7c182e47def7a (patch) | |
tree | 0fa3df79ce9befb3d2091c6216a9cb139494a968 | |
parent | 9d88d1d095a60ba592fee6ec977dd40cdc74abc8 (diff) | |
download | poky-3874ce6ee53e6dbb6f84ac3becb7c182e47def7a.tar.gz |
prservice: remove connection caching
This patch is a follow on of the the PR server rework in bitbake to add
read-only support. The shift to using the bb.asyncrpc code in the PR
server and client brings issues with respect to reuse of the same
asyncio loop in different processes. This patch removes the PR service
connection caching to avoid one source of this problem. It is believed
that in practice this should have little impact on overall performance.
(From OE-Core rev: 0fc3055027e2a76ac863f1c0e0d52e95748066aa)
Signed-off-by: Scott Murray <scott.murray@konsulko.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r-- | meta/classes/package.bbclass | 5 | ||||
-rw-r--r-- | meta/lib/oe/prservice.py | 25 |
2 files changed, 14 insertions, 16 deletions
diff --git a/meta/classes/package.bbclass b/meta/classes/package.bbclass index e17f0c797e..c4c5515d5d 100644 --- a/meta/classes/package.bbclass +++ b/meta/classes/package.bbclass | |||
@@ -714,9 +714,7 @@ python package_get_auto_pr() { | |||
714 | return | 714 | return |
715 | 715 | ||
716 | try: | 716 | try: |
717 | conn = d.getVar("__PRSERV_CONN") | 717 | conn = oe.prservice.prserv_make_conn(d) |
718 | if conn is None: | ||
719 | conn = oe.prservice.prserv_make_conn(d) | ||
720 | if conn is not None: | 718 | if conn is not None: |
721 | if "AUTOINC" in pkgv: | 719 | if "AUTOINC" in pkgv: |
722 | srcpv = bb.fetch2.get_srcrev(d) | 720 | srcpv = bb.fetch2.get_srcrev(d) |
@@ -725,6 +723,7 @@ python package_get_auto_pr() { | |||
725 | d.setVar("PRSERV_PV_AUTOINC", str(value)) | 723 | d.setVar("PRSERV_PV_AUTOINC", str(value)) |
726 | 724 | ||
727 | auto_pr = conn.getPR(version, pkgarch, checksum) | 725 | auto_pr = conn.getPR(version, pkgarch, checksum) |
726 | conn.close() | ||
728 | except Exception as e: | 727 | except Exception as e: |
729 | bb.fatal("Can NOT get PRAUTO, exception %s" % str(e)) | 728 | bb.fatal("Can NOT get PRAUTO, exception %s" % str(e)) |
730 | if auto_pr is None: | 729 | if auto_pr is None: |
diff --git a/meta/lib/oe/prservice.py b/meta/lib/oe/prservice.py index 15ce060ff6..339f7aebca 100644 --- a/meta/lib/oe/prservice.py +++ b/meta/lib/oe/prservice.py | |||
@@ -11,7 +11,6 @@ def prserv_make_conn(d, check = False): | |||
11 | if check: | 11 | if check: |
12 | if not conn.ping(): | 12 | if not conn.ping(): |
13 | raise Exception('service not available') | 13 | raise Exception('service not available') |
14 | d.setVar("__PRSERV_CONN",conn) | ||
15 | except Exception as exc: | 14 | except Exception as exc: |
16 | bb.fatal("Connecting to PR service %s:%s failed: %s" % (host_params[0], host_params[1], str(exc))) | 15 | bb.fatal("Connecting to PR service %s:%s failed: %s" % (host_params[0], host_params[1], str(exc))) |
17 | 16 | ||
@@ -22,31 +21,29 @@ def prserv_dump_db(d): | |||
22 | bb.error("Not using network based PR service") | 21 | bb.error("Not using network based PR service") |
23 | return None | 22 | return None |
24 | 23 | ||
25 | conn = d.getVar("__PRSERV_CONN") | 24 | conn = prserv_make_conn(d) |
26 | if conn is None: | 25 | if conn is None: |
27 | conn = prserv_make_conn(d) | 26 | bb.error("Making connection failed to remote PR service") |
28 | if conn is None: | 27 | return None |
29 | bb.error("Making connection failed to remote PR service") | ||
30 | return None | ||
31 | 28 | ||
32 | #dump db | 29 | #dump db |
33 | opt_version = d.getVar('PRSERV_DUMPOPT_VERSION') | 30 | opt_version = d.getVar('PRSERV_DUMPOPT_VERSION') |
34 | opt_pkgarch = d.getVar('PRSERV_DUMPOPT_PKGARCH') | 31 | opt_pkgarch = d.getVar('PRSERV_DUMPOPT_PKGARCH') |
35 | opt_checksum = d.getVar('PRSERV_DUMPOPT_CHECKSUM') | 32 | opt_checksum = d.getVar('PRSERV_DUMPOPT_CHECKSUM') |
36 | opt_col = ("1" == d.getVar('PRSERV_DUMPOPT_COL')) | 33 | opt_col = ("1" == d.getVar('PRSERV_DUMPOPT_COL')) |
37 | return conn.export(opt_version, opt_pkgarch, opt_checksum, opt_col) | 34 | d = conn.export(opt_version, opt_pkgarch, opt_checksum, opt_col) |
35 | conn.close() | ||
36 | return d | ||
38 | 37 | ||
39 | def prserv_import_db(d, filter_version=None, filter_pkgarch=None, filter_checksum=None): | 38 | def prserv_import_db(d, filter_version=None, filter_pkgarch=None, filter_checksum=None): |
40 | if not d.getVar('PRSERV_HOST'): | 39 | if not d.getVar('PRSERV_HOST'): |
41 | bb.error("Not using network based PR service") | 40 | bb.error("Not using network based PR service") |
42 | return None | 41 | return None |
43 | 42 | ||
44 | conn = d.getVar("__PRSERV_CONN") | 43 | conn = prserv_make_conn(d) |
45 | if conn is None: | 44 | if conn is None: |
46 | conn = prserv_make_conn(d) | 45 | bb.error("Making connection failed to remote PR service") |
47 | if conn is None: | 46 | return None |
48 | bb.error("Making connection failed to remote PR service") | ||
49 | return None | ||
50 | #get the entry values | 47 | #get the entry values |
51 | imported = [] | 48 | imported = [] |
52 | prefix = "PRAUTO$" | 49 | prefix = "PRAUTO$" |
@@ -70,6 +67,7 @@ def prserv_import_db(d, filter_version=None, filter_pkgarch=None, filter_checksu | |||
70 | bb.error("importing(%s,%s,%s,%d) failed. DB may have larger value %d" % (version,pkgarch,checksum,value,ret)) | 67 | bb.error("importing(%s,%s,%s,%d) failed. DB may have larger value %d" % (version,pkgarch,checksum,value,ret)) |
71 | else: | 68 | else: |
72 | imported.append((version,pkgarch,checksum,value)) | 69 | imported.append((version,pkgarch,checksum,value)) |
70 | conn.close() | ||
73 | return imported | 71 | return imported |
74 | 72 | ||
75 | def prserv_export_tofile(d, metainfo, datainfo, lockdown, nomax=False): | 73 | def prserv_export_tofile(d, metainfo, datainfo, lockdown, nomax=False): |
@@ -125,4 +123,5 @@ def prserv_check_avail(d): | |||
125 | except TypeError: | 123 | except TypeError: |
126 | bb.fatal('Undefined/incorrect PRSERV_HOST value. Format: "host:port"') | 124 | bb.fatal('Undefined/incorrect PRSERV_HOST value. Format: "host:port"') |
127 | else: | 125 | else: |
128 | prserv_make_conn(d, True) | 126 | conn = prserv_make_conn(d, True) |
127 | conn.close() | ||