Accept native false Params values in live model placement check

This commit is contained in:
firestar5683
2026-09-19 21:53:52 -07:00
parent b108b958bd
commit 31be93b22c
2 changed files with 3 additions and 1 deletions
+1 -1
View File
@@ -25,7 +25,7 @@ def identity(value):
def local_model_placement(metadata, active, loading):
return metadata.get("uses_external_gpu") is False and active in (b"0", "0") and loading in (b"0", "0")
return metadata.get("uses_external_gpu") is False and (active is False or active in (b"0", "0")) and (loading is False or loading in (b"0", "0"))
def evaluate(snapshot, record, now):
+2
View File
@@ -23,6 +23,8 @@ def authorization():
class Tests(unittest.TestCase):
def test_model_placement_requires_actual_runtime_flags(self):
self.assertTrue(local_model_placement({"uses_external_gpu":False},b"0",b"0"))
self.assertTrue(local_model_placement({"uses_external_gpu":False},False,False))
self.assertFalse(local_model_placement({"uses_external_gpu":False},None,False))
for active,loading in ((None,b"0"),(b"1",b"0"),(b"0",None),(b"0",b"1")):
self.assertFalse(local_model_placement({"uses_external_gpu":False},active,loading))
self.assertFalse(local_model_placement({},b"0",b"0"))