Allow concurrency 0 to pause a terminal
A paused terminal gets no new runs and is not probed; in-flight runs still finish.
This commit is contained in:
+1
-1
@@ -53,7 +53,7 @@
|
|||||||
"repo": {"type": "string"},
|
"repo": {"type": "string"},
|
||||||
"plane_user": {"type": "string"},
|
"plane_user": {"type": "string"},
|
||||||
"token_key": {"type": "string"},
|
"token_key": {"type": "string"},
|
||||||
"concurrency": {"type": "integer", "minimum": 1},
|
"concurrency": {"type": "integer", "minimum": 0},
|
||||||
"capabilities": {"$ref": "#/definitions/strings"},
|
"capabilities": {"$ref": "#/definitions/strings"},
|
||||||
"executors": {"type": "array", "items": {"type": "string"}, "minItems": 1},
|
"executors": {"type": "array", "items": {"type": "string"}, "minItems": 1},
|
||||||
"bins": {"type": "object", "additionalProperties": {"type": "string"}},
|
"bins": {"type": "object", "additionalProperties": {"type": "string"}},
|
||||||
|
|||||||
@@ -45,6 +45,12 @@ class ConfigTest(unittest.TestCase):
|
|||||||
d["terminals"]["oregon"]["concurrency"] = "two"
|
d["terminals"]["oregon"]["concurrency"] = "two"
|
||||||
self.check_both(d, "concurrency")
|
self.check_both(d, "concurrency")
|
||||||
|
|
||||||
|
def test_concurrency_zero_is_valid(self): # 0 = terminal paused (nothing new is dispatched)
|
||||||
|
d = config_data()
|
||||||
|
d["terminals"]["win10"]["concurrency"] = 0
|
||||||
|
self.assertEqual(config.validate(d), [])
|
||||||
|
self.assertEqual(config.mini_validate(d, SCHEMA), [])
|
||||||
|
|
||||||
def test_semantic_routing_to_unknown_terminal(self):
|
def test_semantic_routing_to_unknown_terminal(self):
|
||||||
d = config_data()
|
d = config_data()
|
||||||
d["projects"]["GWENT"]["routing"]["by_assignee"]["mac"] = "mac"
|
d["projects"]["GWENT"]["routing"]["by_assignee"]["mac"] = "mac"
|
||||||
|
|||||||
@@ -160,6 +160,14 @@ class CoreTest(unittest.TestCase):
|
|||||||
self.assertEqual(started, ["GW-1-1", "GW-3-1"]) # 2 slots; GW-2 waits for the game group
|
self.assertEqual(started, ["GW-1-1", "GW-3-1"]) # 2 slots; GW-2 waits for the game group
|
||||||
self.assertEqual([self.p.state_of(x) for x in (a, b, c, d)], ["In Progress", "Todo", "In Progress", "Todo"])
|
self.assertEqual([self.p.state_of(x) for x in (a, b, c, d)], ["In Progress", "Todo", "In Progress", "Todo"])
|
||||||
|
|
||||||
|
def test_concurrency_zero_pauses_terminal(self):
|
||||||
|
self.h.cfg.terminals["win10"]["concurrency"] = 0
|
||||||
|
w = self.p.add_issue(1)
|
||||||
|
o = self.p.add_issue(2, assignee="oregon")
|
||||||
|
self.h.tick()
|
||||||
|
self.assertNotIn(("win10", "codex"), self.h.execs) # not even probed (busy_processes)
|
||||||
|
self.assertEqual((self.p.state_of(w), self.p.state_of(o)), ("Todo", "In Progress"))
|
||||||
|
|
||||||
def test_label_routing(self):
|
def test_label_routing(self):
|
||||||
self.p.add_issue(1, labels=["model:astra"])
|
self.p.add_issue(1, labels=["model:astra"])
|
||||||
self.p.add_issue(2, assignee="oregon", labels=["cap:gpu"]) # oregon lacks the capability
|
self.p.add_issue(2, assignee="oregon", labels=["cap:gpu"]) # oregon lacks the capability
|
||||||
|
|||||||
Reference in New Issue
Block a user