def testGetDefaultConcurrencyExplicit(self, cpuCountMock, phymemUsageMock, *_args): """Concurrency when it is explicitly specified.""" self.assertEqual(model_scheduler_service._getDefaultConcurrency(7), 7) self.assertFalse(cpuCountMock.called) self.assertFalse(phymemUsageMock.called)
def testGetDefaultConcurrencyMinimalMemory1(self, cpuCountMock, phymemUsageMock, *_args): """Default concurrency when there is minimal memory after base memory.""" self.assertEqual(model_scheduler_service._getDefaultConcurrency(), 2) cpuCountMock.assert_called_once_with() phymemUsageMock.assert_called_once_with()
def testGetDefaultConcurrencyMinimalMemory2(self, cpuCountMock, phymemUsageMock, *_args): """Default concurrency when there is less memory than base allocation.""" self.assertEqual(model_scheduler_service._getDefaultConcurrency(), 2) cpuCountMock.assert_called_once_with() phymemUsageMock.assert_called_once_with()
def testGetDefaultConcurrencyOneCpu(self, cpuCountMock, phymemUsageMock, *_args): """Default concurrency with one CPU.""" self.assertEqual(model_scheduler_service._getDefaultConcurrency(), 2) cpuCountMock.assert_called_once_with() phymemUsageMock.assert_called_once_with()
def testGetDefaultConcurrencyMemoryBound(self, cpuCountMock, phymemUsageMock, *_args): """Default concurrency when memory bound.""" self.assertEqual(model_scheduler_service._getDefaultConcurrency(), 2) cpuCountMock.assert_called_once_with() phymemUsageMock.assert_called_once_with()