Avoid unnecessary CPU offload and expose full GPU profile mode

This commit is contained in:
Mikei386 committed 2026-09-28 21:18:54 +02:00
1 parent 13ed059aaf
commit f99cd26b1d
8 files changed
+39 -11

No files matched your search

+5
View File
@@ -46,6 +46,11 @@ class WorkerTests(unittest.TestCase):
with self.patches(),patch('inference.probe',return_value=self.gpus),patch('inference.cgroup_headroom',return_value=32*1024**3),patch.object(self.worker,'_fit_command',return_value='CUDA0 50000 1000 1000\nCUDA1 2000 1000 1000\nHost 512 0 256\n') as fit,patch('inference.subprocess.Popen') as launch:
with self.assertRaises(InferenceError):self.worker.ensure(self.profile)
launch.assert_not_called();self.assertLessEqual(fit.call_count,11)
def test_full_gpu_refuses_cpu_fallback(self):
self.profile['parameters']['gpu_offload']='full'
with self.patches(),patch('inference.probe',return_value=self.gpus),patch('inference.cgroup_headroom',return_value=32*1024**3),patch.object(self.worker,'_fit_command',return_value='CUDA0 50000 1000 1000\nCUDA1 2000 1000 1000\nHost 512 0 256\n') as fit,patch('inference.subprocess.Popen') as launch:
with self.assertRaisesRegex(InferenceError,'Vollständige GPU'):self.worker.ensure(self.profile)
launch.assert_not_called();self.assertEqual(fit.call_count,1)
def test_build_symlink_cannot_escape_deck_state(self):
self.runtime.status=lambda:dict(active='outside',builds=[dict(id='outside',backend='CUDA',fit_tool=True)])
(self.root/'runtime'/'outside').symlink_to('/usr')