Skip to content

Commit

Permalink
DO NOT MERGE
Browse files Browse the repository at this point in the history
Turn off K_REVISION.
  • Loading branch information
kfindeisen committed Dec 19, 2024
1 parent 2c1da48 commit 8705548
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 11 deletions.
4 changes: 2 additions & 2 deletions python/activator/middleware_interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -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_REVISION" in os.environ:
if "K_REVISIUN" 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_REVISION"]
version = os.environ["K_REVISIUN"]
elif "MANAGED_REVISION" in os.environ:
# Passed in through config, guaranteed to be unique for each
# deployment. Short hexadecimal sequence.
Expand Down
21 changes: 12 additions & 9 deletions tests/test_middleware_interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ def setUp(self):

env_patcher = unittest.mock.patch.dict(os.environ,
{"CONFIG_APDB": config_file.name,
"K_REVISION": "prompt-proto-service-042",
"MANAGED_REVISION": "prompt-proto-service-042",
})
env_patcher.start()
self.addCleanup(env_patcher.stop)
Expand Down Expand Up @@ -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/prompt-proto-service-042"
"Preload/revision-prompt-proto-service-042"
self.assertTrue(
butler.exists('promptPreload_metrics', instrument=instname, group=group, detector=detector,
full_check=True,
Expand Down Expand Up @@ -910,11 +910,14 @@ 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/prompt-proto-service-042")
self.assertEqual(preload_run, f"{instname}/prompt/output-2023-01-22/Preload/"
"revision-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/prompt-proto-service-042")
self.assertEqual(out_run, f"{instname}/prompt/output-2023-01-22/ApPipe/"
"revision-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/prompt-proto-service-042")
self.assertEqual(init_run, f"{instname}/prompt/output-2023-01-22/ApPipe/"
"revision-prompt-proto-service-042")

def test_get_template_types(self):
template_types = self.interface._get_template_types()
Expand Down Expand Up @@ -1245,7 +1248,7 @@ def setUp(self):

env_patcher = unittest.mock.patch.dict(os.environ,
{"CONFIG_APDB": config_file.name,
"K_REVISION": "prompt-proto-service-042",
"MANAGED_REVISION": "prompt-proto-service-042",
})
env_patcher.start()
self.addCleanup(env_patcher.stop)
Expand Down Expand Up @@ -1305,9 +1308,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/prompt-proto-service-042"
"/Preprocess/revision-prompt-proto-service-042"
self.output_run = f"{instname}/prompt/output-{date.year:04d}-{date.month:02d}-{date.day:02d}" \
"/ApPipe/prompt-proto-service-042"
"/ApPipe/revision-prompt-proto-service-042"

with unittest.mock.patch.object(self.interface.rawIngestTask, "extractMetadata") as mock:
mock.return_value = file_data
Expand Down Expand Up @@ -1375,7 +1378,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/prompt-proto-service-042"
"NoPipe/revision-prompt-proto-service-042"

dimension_config = central_butler.dimensions.dimensionConfig
# Need to clean up the directory iff the method fails
Expand Down

0 comments on commit 8705548

Please sign in to comment.