Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: Load new model version should not reload loaded existing model version(s) #7527

Merged
merged 4 commits into from
Aug 20, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Expand test to cover load action with only version addition to policy
  • Loading branch information
kthui committed Aug 20, 2024
commit 3c6980501dd66ee3a575050987e56372d7f5d71a
27 changes: 27 additions & 0 deletions qa/L0_lifecycle/lifecycle_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -3593,6 +3593,33 @@ def test_load_new_model_version(self):
self.assertEqual(server_log.count("[PB model] Loading version 4"), 2)
self.assertEqual(server_log.count("successfully loaded 'identity_fp32'"), 4)

# update model config to load version 1 and 4
config_path = os.path.join("models", model_name, "config.pbtxt")
with open(config_path, mode="r+", encoding="utf-8", errors="strict") as f:
config = f.read()
config = config.replace(
"version_policy: { specific: { versions: [4] } }",
"version_policy: { specific: { versions: [1, 4] } }",
)
f.truncate(0)
f.seek(0)
f.write(config)
# reload the model
client.load_model(model_name)

# version 1 should be loaded and version 4 should not be reloaded
self.assertTrue(client.is_model_ready(model_name, "1"))
self.assertFalse(client.is_model_ready(model_name, "2"))
self.assertFalse(client.is_model_ready(model_name, "3"))
self.assertTrue(client.is_model_ready(model_name, "4"))
with open(os.environ["SERVER_LOG"]) as f:
server_log = f.read()
self.assertEqual(server_log.count("[PB model] Loading version 1"), 3)
self.assertEqual(server_log.count("[PB model] Loading version 2"), 3)
self.assertEqual(server_log.count("[PB model] Loading version 3"), 2)
self.assertEqual(server_log.count("[PB model] Loading version 4"), 2)
self.assertEqual(server_log.count("successfully loaded 'identity_fp32'"), 5)


if __name__ == "__main__":
unittest.main()
Loading