diff options
author | Joshua Watt <JPEWhacker@gmail.com> | 2024-05-30 09:41:26 -0600 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2024-05-31 16:56:25 +0100 |
commit | 247d08ae0765fdd73f80e7608f76e36983e2109d (patch) | |
tree | 69c1359556e1235276f10052cf3959c4748fc536 /bitbake/lib/hashserv/tests.py | |
parent | f618d1dfd7dd414cb458467d0e35b135d6e7cd32 (diff) | |
download | poky-247d08ae0765fdd73f80e7608f76e36983e2109d.tar.gz |
bitbake: asyncrpc: Remove ClientPool
Batching support on the client side has proven to be a much more
effective way of dealing with server latency than multiple client
connections and is also much nicer on the server, so drop the client
pool support from asyncrpc and the hash server
(Bitbake rev: 6f80560f1c7010d09fe5448fdde616aef8468102)
Signed-off-by: Joshua Watt <JPEWhacker@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/lib/hashserv/tests.py')
-rw-r--r-- | bitbake/lib/hashserv/tests.py | 82 |
1 files changed, 0 insertions, 82 deletions
diff --git a/bitbake/lib/hashserv/tests.py b/bitbake/lib/hashserv/tests.py index cf74d9de7e..13ccb20ebf 100644 --- a/bitbake/lib/hashserv/tests.py +++ b/bitbake/lib/hashserv/tests.py | |||
@@ -8,7 +8,6 @@ | |||
8 | from . import create_server, create_client | 8 | from . import create_server, create_client |
9 | from .server import DEFAULT_ANON_PERMS, ALL_PERMISSIONS | 9 | from .server import DEFAULT_ANON_PERMS, ALL_PERMISSIONS |
10 | from bb.asyncrpc import InvokeError | 10 | from bb.asyncrpc import InvokeError |
11 | from .client import ClientPool | ||
12 | import hashlib | 11 | import hashlib |
13 | import logging | 12 | import logging |
14 | import multiprocessing | 13 | import multiprocessing |
@@ -552,45 +551,6 @@ class HashEquivalenceCommonTests(object): | |||
552 | # shares a taskhash with Task 2 | 551 | # shares a taskhash with Task 2 |
553 | self.assertClientGetHash(self.client, taskhash2, unihash2) | 552 | self.assertClientGetHash(self.client, taskhash2, unihash2) |
554 | 553 | ||
555 | |||
556 | def test_client_pool_get_unihashes(self): | ||
557 | TEST_INPUT = ( | ||
558 | # taskhash outhash unihash | ||
559 | ('8aa96fcffb5831b3c2c0cb75f0431e3f8b20554a', 'afe240a439959ce86f5e322f8c208e1fedefea9e813f2140c81af866cc9edf7e','218e57509998197d570e2c98512d0105985dffc9'), | ||
560 | # Duplicated taskhash with multiple output hashes and unihashes. | ||
561 | ('8aa96fcffb5831b3c2c0cb75f0431e3f8b20554a', '0904a7fe3dc712d9fd8a74a616ddca2a825a8ee97adf0bd3fc86082c7639914d', 'ae9a7d252735f0dafcdb10e2e02561ca3a47314c'), | ||
562 | # Equivalent hash | ||
563 | ("044c2ec8aaf480685a00ff6ff49e6162e6ad34e1", '0904a7fe3dc712d9fd8a74a616ddca2a825a8ee97adf0bd3fc86082c7639914d', "def64766090d28f627e816454ed46894bb3aab36"), | ||
564 | ("e3da00593d6a7fb435c7e2114976c59c5fd6d561", "1cf8713e645f491eb9c959d20b5cae1c47133a292626dda9b10709857cbe688a", "3b5d3d83f07f259e9086fcb422c855286e18a57d"), | ||
565 | ('35788efcb8dfb0a02659d81cf2bfd695fb30faf9', '2765d4a5884be49b28601445c2760c5f21e7e5c0ee2b7e3fce98fd7e5970796f', 'f46d3fbb439bd9b921095da657a4de906510d2cd'), | ||
566 | ('35788efcb8dfb0a02659d81cf2bfd695fb30fafa', '2765d4a5884be49b28601445c2760c5f21e7e5c0ee2b7e3fce98fd7e5970796f', 'f46d3fbb439bd9b921095da657a4de906510d2ce'), | ||
567 | ('9d81d76242cc7cfaf7bf74b94b9cd2e29324ed74', '8470d56547eea6236d7c81a644ce74670ca0bbda998e13c629ef6bb3f0d60b69', '05d2a63c81e32f0a36542ca677e8ad852365c538'), | ||
568 | ) | ||
569 | EXTRA_QUERIES = ( | ||
570 | "6b6be7a84ab179b4240c4302518dc3f6", | ||
571 | ) | ||
572 | |||
573 | with ClientPool(self.server_address, 10) as client_pool: | ||
574 | for taskhash, outhash, unihash in TEST_INPUT: | ||
575 | self.client.report_unihash(taskhash, self.METHOD, outhash, unihash) | ||
576 | |||
577 | query = {idx: (self.METHOD, data[0]) for idx, data in enumerate(TEST_INPUT)} | ||
578 | for idx, taskhash in enumerate(EXTRA_QUERIES): | ||
579 | query[idx + len(TEST_INPUT)] = (self.METHOD, taskhash) | ||
580 | |||
581 | result = client_pool.get_unihashes(query) | ||
582 | |||
583 | self.assertDictEqual(result, { | ||
584 | 0: "218e57509998197d570e2c98512d0105985dffc9", | ||
585 | 1: "218e57509998197d570e2c98512d0105985dffc9", | ||
586 | 2: "218e57509998197d570e2c98512d0105985dffc9", | ||
587 | 3: "3b5d3d83f07f259e9086fcb422c855286e18a57d", | ||
588 | 4: "f46d3fbb439bd9b921095da657a4de906510d2cd", | ||
589 | 5: "f46d3fbb439bd9b921095da657a4de906510d2cd", | ||
590 | 6: "05d2a63c81e32f0a36542ca677e8ad852365c538", | ||
591 | 7: None, | ||
592 | }) | ||
593 | |||
594 | def test_get_unihash_batch(self): | 554 | def test_get_unihash_batch(self): |
595 | TEST_INPUT = ( | 555 | TEST_INPUT = ( |
596 | # taskhash outhash unihash | 556 | # taskhash outhash unihash |
@@ -628,48 +588,6 @@ class HashEquivalenceCommonTests(object): | |||
628 | None, | 588 | None, |
629 | ]) | 589 | ]) |
630 | 590 | ||
631 | def test_client_pool_unihash_exists(self): | ||
632 | TEST_INPUT = ( | ||
633 | # taskhash outhash unihash | ||
634 | ('8aa96fcffb5831b3c2c0cb75f0431e3f8b20554a', 'afe240a439959ce86f5e322f8c208e1fedefea9e813f2140c81af866cc9edf7e','218e57509998197d570e2c98512d0105985dffc9'), | ||
635 | # Duplicated taskhash with multiple output hashes and unihashes. | ||
636 | ('8aa96fcffb5831b3c2c0cb75f0431e3f8b20554a', '0904a7fe3dc712d9fd8a74a616ddca2a825a8ee97adf0bd3fc86082c7639914d', 'ae9a7d252735f0dafcdb10e2e02561ca3a47314c'), | ||
637 | # Equivalent hash | ||
638 | ("044c2ec8aaf480685a00ff6ff49e6162e6ad34e1", '0904a7fe3dc712d9fd8a74a616ddca2a825a8ee97adf0bd3fc86082c7639914d', "def64766090d28f627e816454ed46894bb3aab36"), | ||
639 | ("e3da00593d6a7fb435c7e2114976c59c5fd6d561", "1cf8713e645f491eb9c959d20b5cae1c47133a292626dda9b10709857cbe688a", "3b5d3d83f07f259e9086fcb422c855286e18a57d"), | ||
640 | ('35788efcb8dfb0a02659d81cf2bfd695fb30faf9', '2765d4a5884be49b28601445c2760c5f21e7e5c0ee2b7e3fce98fd7e5970796f', 'f46d3fbb439bd9b921095da657a4de906510d2cd'), | ||
641 | ('35788efcb8dfb0a02659d81cf2bfd695fb30fafa', '2765d4a5884be49b28601445c2760c5f21e7e5c0ee2b7e3fce98fd7e5970796f', 'f46d3fbb439bd9b921095da657a4de906510d2ce'), | ||
642 | ('9d81d76242cc7cfaf7bf74b94b9cd2e29324ed74', '8470d56547eea6236d7c81a644ce74670ca0bbda998e13c629ef6bb3f0d60b69', '05d2a63c81e32f0a36542ca677e8ad852365c538'), | ||
643 | ) | ||
644 | EXTRA_QUERIES = ( | ||
645 | "6b6be7a84ab179b4240c4302518dc3f6", | ||
646 | ) | ||
647 | |||
648 | result_unihashes = set() | ||
649 | |||
650 | |||
651 | with ClientPool(self.server_address, 10) as client_pool: | ||
652 | for taskhash, outhash, unihash in TEST_INPUT: | ||
653 | result = self.client.report_unihash(taskhash, self.METHOD, outhash, unihash) | ||
654 | result_unihashes.add(result["unihash"]) | ||
655 | |||
656 | query = {} | ||
657 | expected = {} | ||
658 | |||
659 | for _, _, unihash in TEST_INPUT: | ||
660 | idx = len(query) | ||
661 | query[idx] = unihash | ||
662 | expected[idx] = unihash in result_unihashes | ||
663 | |||
664 | |||
665 | for unihash in EXTRA_QUERIES: | ||
666 | idx = len(query) | ||
667 | query[idx] = unihash | ||
668 | expected[idx] = False | ||
669 | |||
670 | result = client_pool.unihashes_exist(query) | ||
671 | self.assertDictEqual(result, expected) | ||
672 | |||
673 | def test_unihash_exists_batch(self): | 591 | def test_unihash_exists_batch(self): |
674 | TEST_INPUT = ( | 592 | TEST_INPUT = ( |
675 | # taskhash outhash unihash | 593 | # taskhash outhash unihash |