mirror of
https://github.com/kevinveenbirkenbach/computer-playbook.git
synced 2026-11-29 06:17:25 +00:00
feat(svc-ai-lmstudio): fetch every lacking model at once as async jobs
The model preload fetched one model after the other, so a node with several models waited for the sum of all downloads. When async is enabled, every model the store lacks now starts as its own async get_url job per source slot: the declared url first, then each mirror, a mirror only after the whole source round ended and only for the models still missing. Each slot round gets a budget of max(floor, bytes / minimum rate) with async retries inside it. A jobs file records the running jobs, so a later run waits out or drops the downloads of a killed run, and a download that still runs or reports no state past its lifetime stops the play. Partial downloads in staging are removed before every store read, and the final check fails closed with what each source answered. Debug runs keep fetching one model at a time through get_url_retry, which now takes its own retries argument. 🎯 Fix: 92 % 💥 Break: 4 % 💸 Tokens: 100 % ⏱️ Velocity: 100 % 🛡️ Security: 100 % 🏆 Score: 88 🚦 Gate: ✅ 90/5, tokens and velocity <= 100, security 100 % Created-with: https://s.veen.world/skills Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
9223522c43
commit
ff229ff51c
14 files changed
+1335
-274
No files matched your search
@@ -80,6 +80,53 @@ class TestGetUrlRetryActionPlugin(unittest.TestCase):
|
||||
self.assertEqual(sleep_mock.call_count, 2)
|
||||
sleep_mock.assert_called_with(1)
|
||||
|
||||
def test_run_takes_its_retry_count_from_its_own_argument(self):
|
||||
task = _FakeTask(
|
||||
args={"url": "http://example.invalid", "dest": "/tmp/file", "retries": "1"},
|
||||
ds={"delay": 1},
|
||||
delay=1,
|
||||
)
|
||||
action = _make_action(task)
|
||||
|
||||
with (
|
||||
patch(
|
||||
"plugins.action.get_url_retry.ActionModule._execute_module",
|
||||
side_effect=[
|
||||
{"failed": True, "msg": "attempt-1"},
|
||||
{"failed": True, "msg": "attempt-2"},
|
||||
{"failed": False, "dest": "/tmp/file"},
|
||||
],
|
||||
) as module_mock,
|
||||
patch("plugins.action.get_url_retry.time.sleep") as sleep_mock,
|
||||
):
|
||||
result = action.run(task_vars={})
|
||||
|
||||
self.assertTrue(result.get("failed"))
|
||||
self.assertEqual(result.get("attempts"), 2)
|
||||
self.assertEqual(module_mock.call_count, 2)
|
||||
sleep_mock.assert_called_once_with(1)
|
||||
for call in module_mock.call_args_list:
|
||||
self.assertEqual(
|
||||
call.kwargs["module_args"],
|
||||
{"url": "http://example.invalid", "dest": "/tmp/file"},
|
||||
)
|
||||
|
||||
def test_own_retry_argument_never_reaches_an_async_get_url(self):
|
||||
task = _FakeTask(
|
||||
args={"url": "http://example.invalid", "dest": "/tmp/file", "retries": 3},
|
||||
async_val=30,
|
||||
)
|
||||
action = _make_action(task)
|
||||
|
||||
with patch(
|
||||
"plugins.action.get_url_retry.ActionModule._execute_module",
|
||||
return_value={"failed": False, "dest": "/tmp/file"},
|
||||
) as module_mock:
|
||||
action.run(task_vars={})
|
||||
|
||||
self.assertEqual(module_mock.call_count, 1)
|
||||
self.assertNotIn("retries", module_mock.call_args.kwargs["module_args"])
|
||||
|
||||
def test_run_delegates_to_native_when_until_is_set(self):
|
||||
task = _FakeTask(
|
||||
args={"url": "http://example.invalid", "dest": "/tmp/file"},
|
||||
|
||||
Reference in new issue
Block a user