Make Qwen Image 2.1 the production image worker
This commit is contained in:
@@ -23,7 +23,7 @@ def item(profile, state="exited"):
|
||||
|
||||
|
||||
def image_item(state="exited"):
|
||||
return {"Id": "id-flux", "State": state,
|
||||
return {"Id": "id-qwen-image", "State": state,
|
||||
"Labels": {controller.IMAGE_LABEL_KEY: controller.IMAGE_WORKER}}
|
||||
|
||||
|
||||
@@ -32,9 +32,9 @@ def restore_item(state="exited"):
|
||||
"Labels": {controller.IMAGE_LABEL_KEY: controller.RESTORE_WORKER}}
|
||||
|
||||
|
||||
def qwen_image_test_item(state="exited"):
|
||||
return {"Id": "id-qwen-image-test", "State": state,
|
||||
"Labels": {controller.IMAGE_LABEL_KEY: controller.QWEN_IMAGE_TEST_WORKER}}
|
||||
def flux_standby_item(state="exited"):
|
||||
return {"Id": "id-flux-standby", "State": state,
|
||||
"Labels": {controller.IMAGE_LABEL_KEY: controller.FLUX_STANDBY_WORKER}}
|
||||
|
||||
|
||||
def tts_item(state="running"):
|
||||
@@ -97,7 +97,7 @@ class ProfileControllerTests(unittest.TestCase):
|
||||
self.assertEqual(result, {"music_worker": "acestep", "state": "running"})
|
||||
self.assertEqual(calls, [
|
||||
("POST", "/containers/id-ultra/stop?t=120"),
|
||||
("POST", "/containers/id-flux/stop?t=20"),
|
||||
("POST", "/containers/id-qwen-image/stop?t=20"),
|
||||
("POST", "/containers/id-tts/stop?t=30"),
|
||||
("POST", "/containers/id-music/start"),
|
||||
])
|
||||
@@ -158,10 +158,10 @@ class ProfileControllerTests(unittest.TestCase):
|
||||
self.assertEqual(calls, [
|
||||
("POST", "/containers/id-medium/stop?t=120"),
|
||||
("POST", "/containers/id-tts/stop?t=30"),
|
||||
("POST", "/containers/id-flux/start"),
|
||||
("POST", "/containers/id-qwen-image/start"),
|
||||
])
|
||||
|
||||
def test_restore_start_stops_flux_and_starts_restore(self):
|
||||
def test_restore_start_stops_qwen_image_and_starts_restore(self):
|
||||
profiles = {name: item(name) for name in controller.ALLOWED}
|
||||
calls = []
|
||||
|
||||
@@ -178,11 +178,11 @@ class ProfileControllerTests(unittest.TestCase):
|
||||
controller.set_image_worker(True, controller.RESTORE_WORKER)
|
||||
self.assertEqual(calls, [
|
||||
("POST", "/containers/id-tts/stop?t=30"),
|
||||
("POST", "/containers/id-flux/stop?t=20"),
|
||||
("POST", "/containers/id-qwen-image/stop?t=20"),
|
||||
("POST", "/containers/id-restore/start"),
|
||||
])
|
||||
|
||||
def test_qwen_image_test_is_allowlisted_and_exclusive(self):
|
||||
def test_flux_standby_is_allowlisted_and_exclusive(self):
|
||||
profiles = {name: item(name) for name in controller.ALLOWED}
|
||||
profiles["medium"] = item("medium", "running")
|
||||
calls = []
|
||||
@@ -192,21 +192,21 @@ class ProfileControllerTests(unittest.TestCase):
|
||||
return 204, b""
|
||||
|
||||
with patch.object(controller, "containers", return_value=profiles), \
|
||||
patch.object(controller, "image_container", return_value=qwen_image_test_item()), \
|
||||
patch.object(controller, "image_container", return_value=flux_standby_item()), \
|
||||
patch.object(controller, "image_containers", return_value=[
|
||||
image_item("running"), restore_item(), qwen_image_test_item()]), \
|
||||
image_item("running"), restore_item(), flux_standby_item()]), \
|
||||
patch.object(controller, "tts_container", return_value=tts_item()), \
|
||||
patch.object(controller, "docker_request", side_effect=request):
|
||||
result = controller.set_image_worker(
|
||||
True, controller.QWEN_IMAGE_TEST_WORKER)
|
||||
True, controller.FLUX_STANDBY_WORKER)
|
||||
|
||||
self.assertEqual(result, {
|
||||
"image_worker": "qwen-image-2.1-test", "state": "running"})
|
||||
"image_worker": "flux-standby", "state": "running"})
|
||||
self.assertEqual(calls, [
|
||||
("POST", "/containers/id-medium/stop?t=120"),
|
||||
("POST", "/containers/id-tts/stop?t=30"),
|
||||
("POST", "/containers/id-flux/stop?t=20"),
|
||||
("POST", "/containers/id-qwen-image-test/start"),
|
||||
("POST", "/containers/id-qwen-image/stop?t=20"),
|
||||
("POST", "/containers/id-flux-standby/start"),
|
||||
])
|
||||
|
||||
def test_profile_activation_stops_image_worker_first(self):
|
||||
@@ -224,7 +224,7 @@ class ProfileControllerTests(unittest.TestCase):
|
||||
patch.object(controller, "docker_request", side_effect=request):
|
||||
controller.activate("fast")
|
||||
self.assertEqual(calls, [
|
||||
("POST", "/containers/id-flux/stop?t=120"),
|
||||
("POST", "/containers/id-qwen-image/stop?t=120"),
|
||||
("POST", "/containers/id-fast/start"),
|
||||
])
|
||||
|
||||
|
||||
Reference in New Issue
Block a user