Skip to content

Commit

Permalink
Check server log for decreased resource limit
Browse files Browse the repository at this point in the history
  • Loading branch information
kthui committed Jun 9, 2023
1 parent 95c92f7 commit fbdf0ce
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion qa/L0_model_update/instance_update_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -404,10 +404,26 @@ def test_instance_resource_decrease(self):
# Decrease resource requirement
self.__update_instance_count(
1, 1,
"{\ncount: 1\nkind: KIND_CPU\nrate_limiter {\nresources [\n{\nname: \"R1\"\ncount: 2\n}\n]\n}\n}"
"{\ncount: 1\nkind: KIND_CPU\nrate_limiter {\nresources [\n{\nname: \"R1\"\ncount: 3\n}\n]\n}\n}"
)
# Unload model
self.__unload_model()
# The resource count of 3 is unique across this entire test, so check
# the server output to make sure it is printed, which ensures the
# max resource is actually decreased.
time.sleep(1) # make sure the log file is updated
log_path = os.path.join(
os.environ["MODEL_LOG_DIR"], "instance_update_test.rate_limit_" +
os.environ["RATE_LIMIT_MODE"] + ".server.log")
with open(log_path, mode="r", encoding="utf-8", errors="strict") as f:
if os.environ["RATE_LIMIT_MODE"] == "execution_count":
# Make sure the previous max resource limit of 4 is reduced to 3
# when no explicit limit is set.
self.assertIn("Resource: R1\t Count: 3", f.read())
else:
# Make sure the max resource limit is never set to 3 when
# explicit limit of 10 is set.
self.assertNotIn("Resource: R1\t Count: 3", f.read())

# Test for instance update on direct sequence scheduling
@unittest.skip("Sequence will not continue after update [FIXME: DLIS-4820]")
Expand Down

0 comments on commit fbdf0ce

Please sign in to comment.