From cf6529bd8d23422927f695a1c3d34ee39df12657 Mon Sep 17 00:00:00 2001 From: Krzysztof Findeisen Date: Wed, 18 Dec 2024 17:11:00 -0800 Subject: [PATCH] Revert "DO NOT MERGE" This reverts commit 8705548c2f1b36a3208d7dffec89b26926d52b29. --- python/activator/middleware_interface.py | 4 ++-- tests/test_middleware_interface.py | 21 +++++++++------------ 2 files changed, 11 insertions(+), 14 deletions(-) diff --git a/python/activator/middleware_interface.py b/python/activator/middleware_interface.py index 10c88ad0..e71d6f6a 100644 --- a/python/activator/middleware_interface.py +++ b/python/activator/middleware_interface.py @@ -396,10 +396,10 @@ def _get_deployment(self): word characters and "-", but not guaranteed to be human-readable. """ # if-else chain is clumsy, but easiest to extend to more than 2 options - if "K_REVISIUN" in os.environ: + if "K_REVISION" in os.environ: # Defined by Knative in containers, guaranteed to be unique for # each deployment. Currently of the form prompt-proto-service-#####. - version = os.environ["K_REVISIUN"] + version = os.environ["K_REVISION"] elif "MANAGED_REVISION" in os.environ: # Passed in through config, guaranteed to be unique for each # deployment. Short hexadecimal sequence. diff --git a/tests/test_middleware_interface.py b/tests/test_middleware_interface.py index fe94a824..7c426972 100644 --- a/tests/test_middleware_interface.py +++ b/tests/test_middleware_interface.py @@ -214,7 +214,7 @@ def setUp(self): env_patcher = unittest.mock.patch.dict(os.environ, {"CONFIG_APDB": config_file.name, - "MANAGED_REVISION": "prompt-proto-service-042", + "K_REVISION": "prompt-proto-service-042", }) env_patcher.start() self.addCleanup(env_patcher.stop) @@ -354,7 +354,7 @@ def _check_imports(self, butler, group, detector, expected_shards, have_filter=T # Check that preloaded datasets have been generated date = datetime.datetime.now(datetime.timezone(datetime.timedelta(hours=-12))) preload_collection = f"{instname}/prompt/output-{date.year:04d}-{date.month:02d}-{date.day:02d}/" \ - "Preload/revision-prompt-proto-service-042" + "Preload/prompt-proto-service-042" self.assertTrue( butler.exists('promptPreload_metrics', instrument=instname, group=group, detector=detector, full_check=True, @@ -910,14 +910,11 @@ def test_get_output_run(self): out_chain = self.interface._get_output_chain(date) self.assertEqual(out_chain, f"{instname}/prompt/output-2023-01-22") preload_run = self.interface._get_preload_run(date) - self.assertEqual(preload_run, f"{instname}/prompt/output-2023-01-22/Preload/" - "revision-prompt-proto-service-042") + self.assertEqual(preload_run, f"{instname}/prompt/output-2023-01-22/Preload/prompt-proto-service-042") out_run = self.interface._get_output_run(filename, date) - self.assertEqual(out_run, f"{instname}/prompt/output-2023-01-22/ApPipe/" - "revision-prompt-proto-service-042") + self.assertEqual(out_run, f"{instname}/prompt/output-2023-01-22/ApPipe/prompt-proto-service-042") init_run = self.interface._get_init_output_run(filename, date) - self.assertEqual(init_run, f"{instname}/prompt/output-2023-01-22/ApPipe/" - "revision-prompt-proto-service-042") + self.assertEqual(init_run, f"{instname}/prompt/output-2023-01-22/ApPipe/prompt-proto-service-042") def test_get_template_types(self): template_types = self.interface._get_template_types() @@ -1248,7 +1245,7 @@ def setUp(self): env_patcher = unittest.mock.patch.dict(os.environ, {"CONFIG_APDB": config_file.name, - "MANAGED_REVISION": "prompt-proto-service-042", + "K_REVISION": "prompt-proto-service-042", }) env_patcher.start() self.addCleanup(env_patcher.stop) @@ -1308,9 +1305,9 @@ def setUp(self): date = datetime.datetime.now(datetime.timezone(datetime.timedelta(hours=-12))) self.output_chain = f"{instname}/prompt/output-{date.year:04d}-{date.month:02d}-{date.day:02d}" self.preprocessing_run = f"{instname}/prompt/output-{date.year:04d}-{date.month:02d}-{date.day:02d}" \ - "/Preprocess/revision-prompt-proto-service-042" + "/Preprocess/prompt-proto-service-042" self.output_run = f"{instname}/prompt/output-{date.year:04d}-{date.month:02d}-{date.day:02d}" \ - "/ApPipe/revision-prompt-proto-service-042" + "/ApPipe/prompt-proto-service-042" with unittest.mock.patch.object(self.interface.rawIngestTask, "extractMetadata") as mock: mock.return_value = file_data @@ -1378,7 +1375,7 @@ def test_flush_local_repo(self): # collections to avoid transferring inputs. date = datetime.datetime.now(datetime.timezone(datetime.timedelta(hours=-12))) run = f"{instname}/prompt/output-{date.year:04d}-{date.month:02d}-{date.day:02d}/" \ - "NoPipe/revision-prompt-proto-service-042" + "NoPipe/prompt-proto-service-042" dimension_config = central_butler.dimensions.dimensionConfig # Need to clean up the directory iff the method fails