def test_MPfromBoth(self): # Env should have priority os.environ["ATHENA_PROC_NUMBER"] = "4" argdict = { 'movealong': argList('nothing to see here'), 'athenaopts': argSubstepList(['--nprocs=2', 'random', 'values']) } self.assertEqual(detectAthenaMPProcs(argdict), 4)
def testEnvUp(self): from PyJobTransforms.trfArgClasses import argSubstepList, argSubstepBool envUp = environmentUpdate() argDict = {'env': argSubstepList(["KEY1=VALUE1","KEY2=VALUE2","KEY3=VALUE3"]), 'imf': argSubstepBool('True')} envUp.setStandardEnvironment(argDict) print(envUp.values) print(envUp._envdict) self.assertTrue("KEY1" in envUp._envdict) self.assertTrue("LD_PRELOAD" in envUp._envdict)
def test_MPfromArgdictBad(self): argdict = { 'movealong': argList('nothing to see here'), 'athenaopts': argSubstepList(['--nprocs=-4', 'random', 'values']) } self.assertRaises(trfExceptions.TransformExecutionException, detectAthenaMPProcs, argdict) argdict = { 'movealong': argList('nothing to see here'), 'athenaopts': argSubstepList(['--nprocs=notAnInt', 'random', 'values']) } self.assertRaises(trfExceptions.TransformExecutionException, detectAthenaMPProcs, argdict) argdict = { 'movealong': argList('nothing to see here'), 'athenaopts': argSubstepList(['--nprocs=4', '--nprocs=8', 'values']) } self.assertRaises(trfExceptions.TransformExecutionException, detectAthenaMPProcs, argdict)
def test_MPfromArgdictEmpty(self): argdict = { 'movealong': argList('nothing to see here'), 'athenaopts': argSubstepList(['--nprocs=0', 'random', 'values']) } self.assertEqual(detectAthenaMPProcs(argdict), 0)
def test_noMPwithArgdict(self): argdict = { 'movealong': argList('nothing to see here'), 'athenaopts': argSubstepList(['some', 'random', 'values']) } self.assertEqual(detectAthenaMPProcs(argdict), 0)