def test_submit_and_shutdown(createAndDelete): time.sleep(0.5) ceParameters = {"WholeNode": True, "NumberOfProcessors": 4} ce = PoolComputingElement("TestPoolCE") ce.setParameters(ceParameters) result = ce.submitJob("testPoolCEJob_0.py", None) assert result["OK"] is True result = ce.shutdown() assert result["OK"] is True assert isinstance(result["Value"], dict) assert list(result["Value"].values())[0]["OK"] is True
def test_executeJob_wholeNode8(createAndDelete): time.sleep(0.5) ceParameters = {"WholeNode": True, "NumberOfProcessors": 8} ce = PoolComputingElement("TestPoolCE") ce.setParameters(ceParameters) jobParams = {"mpTag": True, "numberOfProcessors": 2, "maxNumberOfProcessors": 2} result = ce.submitJob("testPoolCEJob_2.py", None, **jobParams) assert result["OK"] is True result = ce.getCEStatus() assert result["UsedProcessors"] == 2 jobParams = {"mpTag": True, "numberOfProcessors": 1, "maxNumberOfProcessors": 3} result = ce.submitJob("testPoolCEJob_3.py", None, **jobParams) assert result["OK"] is True result = ce.getCEStatus() assert result["UsedProcessors"] == 5 jobParams = {"numberOfProcessors": 2} # This is same as asking for SP result = ce.submitJob("testPoolCEJob_4.py", None, **jobParams) assert result["OK"] is True result = ce.getCEStatus() assert result["UsedProcessors"] == 6 # now trying again would fail jobParams = {"mpTag": True, "numberOfProcessors": 3} result = ce.submitJob("testPoolCEJob_5.py", None, **jobParams) assert result["OK"] is False assert "Not enough processors" in result["Message"] # waiting 40 seconds and then submit again time.sleep(40) jobParams = {"mpTag": True, "numberOfProcessors": 3} result = ce.submitJob("testPoolCEJob_5.py", None, **jobParams) assert result["OK"] is True time.sleep(10) result = ce.shutdown() assert result["OK"] is True assert isinstance(result["Value"], dict) assert len(result["Value"]) == 4