From: Joshua Watt <jpewhacker@gmail.com>
To: bitbake-devel@lists.openembedded.org
Cc: Joshua Watt <JPEWhacker@gmail.com>
Subject: [bitbake-devel][RFC 3/5] bitbake-hashclient: Add remove subcommand
Date: Thu, 28 Sep 2023 11:05:49 -0600 [thread overview]
Message-ID: <20230928170551.4193224-4-JPEWhacker@gmail.com> (raw)
In-Reply-To: <20230928170551.4193224-1-JPEWhacker@gmail.com>
Adds a subcommand to invoke the remove API on the server
[YOCTO #15064]
Signed-off-by: Joshua Watt <JPEWhacker@gmail.com>
---
bitbake/bin/bitbake-hashclient | 13 +++++++++++++
bitbake/lib/hashserv/server.py | 10 +++++++---
2 files changed, 20 insertions(+), 3 deletions(-)
diff --git a/bitbake/bin/bitbake-hashclient b/bitbake/bin/bitbake-hashclient
index 494f17592ac..d09104336ab 100755
--- a/bitbake/bin/bitbake-hashclient
+++ b/bitbake/bin/bitbake-hashclient
@@ -113,6 +113,14 @@ def main():
with lock:
pbar.update()
+ def handle_remove(args, client):
+ where = {k: v for k, v in args.where}
+ if where:
+ result = client.remove(where)
+ print("Removed %d row(s)" % (result["count"]))
+ else:
+ print("No query specified")
+
parser = argparse.ArgumentParser(description='Hash Equivalence Client')
parser.add_argument('--address', default=DEFAULT_ADDRESS, help='Server address (default "%(default)s")')
parser.add_argument('--log', default='WARNING', help='Set logging level')
@@ -137,6 +145,11 @@ def main():
help='Include string in outhash')
stress_parser.set_defaults(func=handle_stress)
+ remove_parser = subparsers.add_parser('remove', help="Remove hash entries")
+ remove_parser.add_argument("--where", "-w", metavar="KEY VALUE", nargs=2, action="append", default=[],
+ help="Remove entries from table where KEY == VALUE")
+ remove_parser.set_defaults(func=handle_remove)
+
args = parser.parse_args()
logger = logging.getLogger('hashserv')
diff --git a/bitbake/lib/hashserv/server.py b/bitbake/lib/hashserv/server.py
index 7e8aeefef30..99ba904b1f0 100644
--- a/bitbake/lib/hashserv/server.py
+++ b/bitbake/lib/hashserv/server.py
@@ -516,13 +516,17 @@ class ServerClient(bb.asyncrpc.AsyncServerConnection):
query = ('DELETE FROM %s WHERE ' % table_name) + ' AND '.join("%s=:%s" % (k, k) for k in where.keys())
print(query)
cursor.execute(query, where)
+ return cursor.rowcount
+ return 0
+
+ count = 0
with closing(self.db.cursor()) as cursor:
- do_remove(OUTHASH_TABLE_COLUMNS, "outhashes_v2", cursor)
- do_remove(UNIHASH_TABLE_COLUMNS, "unihashes_v2", cursor)
+ count += do_remove(OUTHASH_TABLE_COLUMNS, "outhashes_v2", cursor)
+ count += do_remove(UNIHASH_TABLE_COLUMNS, "unihashes_v2", cursor)
self.db.commit()
- self.write_message({})
+ self.write_message({"count": count})
def query_equivalent(self, cursor, method, taskhash):
# This is part of the inner loop and must be as fast as possible
--
2.34.1
next prev parent reply other threads:[~2023-09-28 17:06 UTC|newest]
Thread overview: 138+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-09-28 17:05 [bitbake-devel][RFC 0/5] Bitbake Hash Server WebSockets Implementation Joshua Watt
2023-09-28 17:05 ` [bitbake-devel][RFC 1/5] asyncrpc: Abstract client socket Joshua Watt
2023-09-28 17:05 ` [bitbake-devel][RFC 2/5] hashserv: Add remove API Joshua Watt
2023-09-28 17:05 ` Joshua Watt [this message]
2023-09-28 17:05 ` [bitbake-devel][RFC 4/5] hashserv: tests: Add external database tests Joshua Watt
2023-09-28 17:05 ` [bitbake-devel][RFC 5/5] hashserv: Add websocket connection implementation Joshua Watt
2023-09-29 6:33 ` [bitbake-devel][RFC 0/5] Bitbake Hash Server WebSockets Implementation Alexandre Belloni
2023-10-03 14:52 ` [bitbake-devel][RFC v2 00/12] Bitbake Hash Server WebSockets and Alternate Database Backend Joshua Watt
2023-10-03 14:52 ` [bitbake-devel][RFC v2 01/12] asyncrpc: Abstract sockets Joshua Watt
2023-10-03 14:52 ` [bitbake-devel][RFC v2 02/12] hashserv: Add remove API Joshua Watt
2023-10-03 14:52 ` [bitbake-devel][RFC v2 03/12] bitbake-hashclient: Add remove subcommand Joshua Watt
2023-10-03 14:52 ` [bitbake-devel][RFC v2 04/12] hashserv: Add websocket connection implementation Joshua Watt
2023-10-03 14:52 ` [bitbake-devel][RFC v2 05/12] asyncrpc: Add context manager API Joshua Watt
2023-10-03 14:52 ` [bitbake-devel][RFC v2 06/12] hashserv: tests: Add external database tests Joshua Watt
2023-10-03 14:52 ` [bitbake-devel][RFC v2 07/12] asyncrpc: Prefix log messages with client info Joshua Watt
2023-10-03 14:52 ` [bitbake-devel][RFC v2 08/12] bitbake-hashserv: Allow arguments from environment Joshua Watt
2023-10-03 14:52 ` [bitbake-devel][RFC v2 09/12] hashserv: Abstract database Joshua Watt
2023-10-03 14:52 ` [bitbake-devel][RFC v2 10/12] hashserv: Add SQLalchemy backend Joshua Watt
2023-10-03 14:52 ` [bitbake-devel][RFC v2 11/12] contrib: Update hashserv Dockerfile Joshua Watt
2023-10-03 14:52 ` [bitbake-devel][RFC v2 12/12] contrib: hashserv: Add docker-compose Joshua Watt
2023-10-12 22:16 ` [bitbake-devel][RFC v2 00/18] Bitbake Hash Server WebSockets, Alternate Database Backend, and User Management Joshua Watt
2023-10-12 22:16 ` [bitbake-devel][RFC v2 01/18] asyncrpc: Abstract sockets Joshua Watt
2023-10-17 9:06 ` [RFC v2 11/18] hashserv: Implement read-only version of "report" Karim Ben Houcine
2023-10-12 22:16 ` [bitbake-devel][RFC v2 02/18] hashserv: Add websocket connection implementation Joshua Watt
2023-10-12 22:16 ` [bitbake-devel][RFC v2 03/18] asyncrpc: Add context manager API Joshua Watt
2023-10-12 22:16 ` [bitbake-devel][RFC v2 04/18] hashserv: tests: Add external database tests Joshua Watt
2023-10-12 22:16 ` [bitbake-devel][RFC v2 05/18] asyncrpc: Prefix log messages with client info Joshua Watt
2023-10-12 22:16 ` [bitbake-devel][RFC v2 06/18] bitbake-hashserv: Allow arguments from environment Joshua Watt
2023-10-12 22:16 ` [bitbake-devel][RFC v2 07/18] hashserv: Abstract database Joshua Watt
2023-10-12 22:16 ` [bitbake-devel][RFC v2 08/18] hashserv: Add SQLalchemy backend Joshua Watt
2023-10-12 22:16 ` [bitbake-devel][RFC v2 09/18] contrib: Update hashserv Dockerfile Joshua Watt
2023-10-12 22:16 ` [bitbake-devel][RFC v2 10/18] contrib: hashserv: Add docker-compose Joshua Watt
2023-10-12 22:16 ` [bitbake-devel][RFC v2 11/18] hashserv: Implement read-only version of "report" RPC Joshua Watt
2023-10-12 22:16 ` [bitbake-devel][RFC v2 12/18] asyncrpc: Add InvokeError Joshua Watt
2023-10-12 22:16 ` [bitbake-devel][RFC v2 13/18] asyncrpc: client: Prevent double closing of loop Joshua Watt
2023-10-12 22:16 ` [bitbake-devel][RFC v2 14/18] asyncrpc: client: Add disconnect API Joshua Watt
2023-10-12 22:16 ` [bitbake-devel][RFC v2 15/18] hashserv: Add user permissions Joshua Watt
2023-10-12 22:16 ` [bitbake-devel][RFC v2 16/18] hashserv: Add become-user API Joshua Watt
2023-10-12 22:16 ` [bitbake-devel][RFC v2 17/18] hashserv: Add db-usage API Joshua Watt
2023-10-12 22:16 ` [bitbake-devel][RFC v2 18/18] hashserv: Add database column query API Joshua Watt
2023-10-30 19:17 ` [bitbake-devel][PATCH v3 00/22] Bitbake Hash Server WebSockets, Alternate Database Backend, and User Management Joshua Watt
2023-10-30 19:17 ` [bitbake-devel][PATCH v3 01/22] asyncrpc: Abstract sockets Joshua Watt
2023-10-30 19:17 ` [bitbake-devel][PATCH v3 02/22] hashserv: Add websocket connection implementation Joshua Watt
2023-10-30 19:17 ` [bitbake-devel][PATCH v3 03/22] asyncrpc: Add context manager API Joshua Watt
2023-10-30 19:17 ` [bitbake-devel][PATCH v3 04/22] hashserv: tests: Add external database tests Joshua Watt
2023-10-30 19:17 ` [bitbake-devel][PATCH v3 05/22] asyncrpc: Prefix log messages with client info Joshua Watt
2023-10-30 19:17 ` [bitbake-devel][PATCH v3 06/22] bitbake-hashserv: Allow arguments from environment Joshua Watt
2023-10-30 19:17 ` [bitbake-devel][PATCH v3 07/22] hashserv: Abstract database Joshua Watt
2023-10-30 19:17 ` [bitbake-devel][PATCH v3 08/22] hashserv: Add SQLalchemy backend Joshua Watt
2023-10-30 19:17 ` [bitbake-devel][PATCH v3 09/22] hashserv: Implement read-only version of "report" RPC Joshua Watt
2023-10-30 19:17 ` [bitbake-devel][PATCH v3 10/22] asyncrpc: Add InvokeError Joshua Watt
2023-10-30 19:17 ` [bitbake-devel][PATCH v3 11/22] asyncrpc: client: Prevent double closing of loop Joshua Watt
2023-10-30 19:17 ` [bitbake-devel][PATCH v3 12/22] asyncrpc: client: Add disconnect API Joshua Watt
2023-10-30 19:17 ` [bitbake-devel][PATCH v3 13/22] hashserv: Add user permissions Joshua Watt
2023-10-30 19:17 ` [bitbake-devel][PATCH v3 14/22] hashserv: Add become-user API Joshua Watt
2023-10-30 19:17 ` [bitbake-devel][PATCH v3 15/22] hashserv: Add db-usage API Joshua Watt
2023-10-30 19:17 ` [bitbake-devel][PATCH v3 16/22] hashserv: Add database column query API Joshua Watt
2023-10-30 19:17 ` [bitbake-devel][PATCH v3 17/22] hashserv: test: Add bitbake-hashclient tests Joshua Watt
2023-10-30 19:17 ` [bitbake-devel][PATCH v3 18/22] bitbake-hashclient: Output stats in JSON format Joshua Watt
2023-10-30 19:17 ` [bitbake-devel][PATCH v3 19/22] bitbake-hashserver: Allow anonymous permissions to be space separated Joshua Watt
2023-10-30 19:17 ` [bitbake-devel][PATCH v3 20/22] hashserv: tests: Allow authentication for external server tests Joshua Watt
2023-10-30 19:17 ` [bitbake-devel][PATCH v3 21/22] hashserv: Allow self-service deletion Joshua Watt
2023-10-30 19:17 ` [bitbake-devel][PATCH v3 22/22] hashserv: server: Add owner if user is logged in Joshua Watt
2023-10-31 17:21 ` [bitbake-devel][PATCH v4 00/22] Bitbake Hash Server WebSockets, Alternate Database Backend, and User Management Joshua Watt
2023-10-31 17:21 ` [bitbake-devel][PATCH v4 01/22] asyncrpc: Abstract sockets Joshua Watt
2023-10-31 17:21 ` [bitbake-devel][PATCH v4 02/22] hashserv: Add websocket connection implementation Joshua Watt
2023-10-31 17:21 ` [bitbake-devel][PATCH v4 03/22] asyncrpc: Add context manager API Joshua Watt
2023-10-31 17:21 ` [bitbake-devel][PATCH v4 04/22] hashserv: tests: Add external database tests Joshua Watt
2023-10-31 17:21 ` [bitbake-devel][PATCH v4 05/22] asyncrpc: Prefix log messages with client info Joshua Watt
2023-10-31 17:21 ` [bitbake-devel][PATCH v4 06/22] bitbake-hashserv: Allow arguments from environment Joshua Watt
2023-10-31 17:21 ` [bitbake-devel][PATCH v4 07/22] hashserv: Abstract database Joshua Watt
2023-10-31 17:21 ` [bitbake-devel][PATCH v4 08/22] hashserv: Add SQLalchemy backend Joshua Watt
2023-10-31 17:21 ` [bitbake-devel][PATCH v4 09/22] hashserv: Implement read-only version of "report" RPC Joshua Watt
2023-10-31 17:21 ` [bitbake-devel][PATCH v4 10/22] asyncrpc: Add InvokeError Joshua Watt
2023-10-31 17:21 ` [bitbake-devel][PATCH v4 11/22] asyncrpc: client: Prevent double closing of loop Joshua Watt
2023-10-31 17:21 ` [bitbake-devel][PATCH v4 12/22] asyncrpc: client: Add disconnect API Joshua Watt
2023-10-31 17:21 ` [bitbake-devel][PATCH v4 13/22] hashserv: Add user permissions Joshua Watt
2023-10-31 17:21 ` [bitbake-devel][PATCH v4 14/22] hashserv: Add become-user API Joshua Watt
2023-10-31 17:21 ` [bitbake-devel][PATCH v4 15/22] hashserv: Add db-usage API Joshua Watt
2023-10-31 17:21 ` [bitbake-devel][PATCH v4 16/22] hashserv: Add database column query API Joshua Watt
2023-10-31 17:21 ` [bitbake-devel][PATCH v4 17/22] hashserv: test: Add bitbake-hashclient tests Joshua Watt
2023-10-31 17:21 ` [bitbake-devel][PATCH v4 18/22] bitbake-hashclient: Output stats in JSON format Joshua Watt
2023-10-31 17:21 ` [bitbake-devel][PATCH v4 19/22] bitbake-hashserver: Allow anonymous permissions to be space separated Joshua Watt
2023-10-31 17:21 ` [bitbake-devel][PATCH v4 20/22] hashserv: tests: Allow authentication for external server tests Joshua Watt
2023-10-31 17:21 ` [bitbake-devel][PATCH v4 21/22] hashserv: Allow self-service deletion Joshua Watt
2023-10-31 17:21 ` [bitbake-devel][PATCH v4 22/22] hashserv: server: Add owner if user is logged in Joshua Watt
2023-11-01 13:17 ` [bitbake-devel][PATCH v4 00/22] Bitbake Hash Server WebSockets, Alternate Database Backend, and User Management Alexandre Belloni
2023-11-01 13:29 ` Alexandre Belloni
2023-11-01 15:41 ` [bitbake-devel][PATCH v5 " Joshua Watt
2023-11-01 15:41 ` [bitbake-devel][PATCH v5 01/22] asyncrpc: Abstract sockets Joshua Watt
2023-11-01 15:41 ` [bitbake-devel][PATCH v5 02/22] hashserv: Add websocket connection implementation Joshua Watt
2023-11-01 15:41 ` [bitbake-devel][PATCH v5 03/22] asyncrpc: Add context manager API Joshua Watt
2023-11-01 15:41 ` [bitbake-devel][PATCH v5 04/22] hashserv: tests: Add external database tests Joshua Watt
2023-11-01 15:41 ` [bitbake-devel][PATCH v5 05/22] asyncrpc: Prefix log messages with client info Joshua Watt
2023-11-01 15:42 ` [bitbake-devel][PATCH v5 06/22] bitbake-hashserv: Allow arguments from environment Joshua Watt
2023-11-01 15:42 ` [bitbake-devel][PATCH v5 07/22] hashserv: Abstract database Joshua Watt
2023-11-01 15:42 ` [bitbake-devel][PATCH v5 08/22] hashserv: Add SQLalchemy backend Joshua Watt
2023-11-01 15:42 ` [bitbake-devel][PATCH v5 09/22] hashserv: Implement read-only version of "report" RPC Joshua Watt
2023-11-01 15:42 ` [bitbake-devel][PATCH v5 10/22] asyncrpc: Add InvokeError Joshua Watt
2023-11-01 15:42 ` [bitbake-devel][PATCH v5 11/22] asyncrpc: client: Prevent double closing of loop Joshua Watt
2023-11-01 15:42 ` [bitbake-devel][PATCH v5 12/22] asyncrpc: client: Add disconnect API Joshua Watt
2023-11-01 15:42 ` [bitbake-devel][PATCH v5 13/22] hashserv: Add user permissions Joshua Watt
2023-11-01 15:42 ` [bitbake-devel][PATCH v5 14/22] hashserv: Add become-user API Joshua Watt
2023-11-01 15:42 ` [bitbake-devel][PATCH v5 15/22] hashserv: Add db-usage API Joshua Watt
2023-11-01 15:42 ` [bitbake-devel][PATCH v5 16/22] hashserv: Add database column query API Joshua Watt
2023-11-01 15:42 ` [bitbake-devel][PATCH v5 17/22] hashserv: test: Add bitbake-hashclient tests Joshua Watt
2023-11-01 15:42 ` [bitbake-devel][PATCH v5 18/22] bitbake-hashclient: Output stats in JSON format Joshua Watt
2023-11-01 15:42 ` [bitbake-devel][PATCH v5 19/22] bitbake-hashserver: Allow anonymous permissions to be space separated Joshua Watt
2023-11-01 15:42 ` [bitbake-devel][PATCH v5 20/22] hashserv: tests: Allow authentication for external server tests Joshua Watt
2023-11-01 15:42 ` [bitbake-devel][PATCH v5 21/22] hashserv: Allow self-service deletion Joshua Watt
2023-11-01 15:42 ` [bitbake-devel][PATCH v5 22/22] hashserv: server: Add owner if user is logged in Joshua Watt
2023-11-03 14:26 ` [bitbake-devel][PATCH v6 00/22] Bitbake Hash Server WebSockets, Alternate Database Backend, and User Management Joshua Watt
2023-11-03 14:26 ` [bitbake-devel][PATCH v6 01/22] asyncrpc: Abstract sockets Joshua Watt
2023-11-03 14:26 ` [bitbake-devel][PATCH v6 02/22] hashserv: Add websocket connection implementation Joshua Watt
2023-11-10 12:03 ` Matthias Schnelte
2023-11-10 14:11 ` Joshua Watt
2023-11-15 7:44 ` Matthias Schnelte
2023-11-03 14:26 ` [bitbake-devel][PATCH v6 03/22] asyncrpc: Add context manager API Joshua Watt
2023-11-03 14:26 ` [bitbake-devel][PATCH v6 04/22] hashserv: tests: Add external database tests Joshua Watt
2023-11-03 14:26 ` [bitbake-devel][PATCH v6 05/22] asyncrpc: Prefix log messages with client info Joshua Watt
2023-11-03 14:26 ` [bitbake-devel][PATCH v6 06/22] bitbake-hashserv: Allow arguments from environment Joshua Watt
2023-11-03 14:26 ` [bitbake-devel][PATCH v6 07/22] hashserv: Abstract database Joshua Watt
2023-11-03 14:26 ` [bitbake-devel][PATCH v6 08/22] hashserv: Add SQLalchemy backend Joshua Watt
2023-11-03 14:26 ` [bitbake-devel][PATCH v6 09/22] hashserv: Implement read-only version of "report" RPC Joshua Watt
2023-11-03 14:26 ` [bitbake-devel][PATCH v6 10/22] asyncrpc: Add InvokeError Joshua Watt
2023-11-03 14:26 ` [bitbake-devel][PATCH v6 11/22] asyncrpc: client: Prevent double closing of loop Joshua Watt
2023-11-03 14:26 ` [bitbake-devel][PATCH v6 12/22] asyncrpc: client: Add disconnect API Joshua Watt
2023-11-03 14:26 ` [bitbake-devel][PATCH v6 13/22] hashserv: Add user permissions Joshua Watt
2023-11-03 14:26 ` [bitbake-devel][PATCH v6 14/22] hashserv: Add become-user API Joshua Watt
2023-11-03 14:26 ` [bitbake-devel][PATCH v6 15/22] hashserv: Add db-usage API Joshua Watt
2023-11-03 14:26 ` [bitbake-devel][PATCH v6 16/22] hashserv: Add database column query API Joshua Watt
2023-11-03 14:26 ` [bitbake-devel][PATCH v6 17/22] hashserv: test: Add bitbake-hashclient tests Joshua Watt
2023-11-03 14:26 ` [bitbake-devel][PATCH v6 18/22] bitbake-hashclient: Output stats in JSON format Joshua Watt
2023-11-03 14:26 ` [bitbake-devel][PATCH v6 19/22] bitbake-hashserver: Allow anonymous permissions to be space separated Joshua Watt
2023-11-03 14:26 ` [bitbake-devel][PATCH v6 20/22] hashserv: tests: Allow authentication for external server tests Joshua Watt
2023-11-03 14:26 ` [bitbake-devel][PATCH v6 21/22] hashserv: Allow self-service deletion Joshua Watt
2023-11-03 14:26 ` [bitbake-devel][PATCH v6 22/22] hashserv: server: Add owner if user is logged in Joshua Watt
2023-11-09 10:23 ` [bitbake-devel][PATCH v6 00/22] Bitbake Hash Server WebSockets, Alternate Database Backend, and User Management Alexandre Belloni
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230928170551.4193224-4-JPEWhacker@gmail.com \
--to=jpewhacker@gmail.com \
--cc=bitbake-devel@lists.openembedded.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.