def test_submitJob(): with open("testJob.py", "w") as execFile: execFile.write(jobScript % "1") os.chmod("testJob.py", 0o755) ce = InProcessComputingElement("InProcessCE") res = ce.submitJob("testJob.py", None) assert res["OK"] is True res = ce.getCEStatus() assert res["OK"] is True assert res["SubmittedJobs"] == 1 _stopJob(1) for ff in ["testJob.py", "stop_job_2", "job.info", "std.out"]: if os.path.isfile(ff): os.remove(ff) # # With a job wrapper and some MP parameters with open("testJob.py", "w") as execFile: execFile.write(jobScript % "2") os.chmod("testJob.py", 0o755) jobParams = {"JobType": "User", "Executable": "testJob.py"} resourceParams = {"GridCE": "some_CE"} optimizerParams = {} wrapperFile = createJobWrapper( 2, jobParams, resourceParams, optimizerParams, logLevel="DEBUG")["Value"][ 0] # This is not under test, assuming it works fine res = ce.submitJob( wrapperFile, proxy=None, numberOfProcessors=4, maxNumberOfProcessors=8, wholeNode=False, mpTag=True, jobDesc={ "jobParams": jobParams, "resourceParams": resourceParams, "optimizerParams": optimizerParams }, ) assert res["OK"] is True res = ce.getCEStatus() assert res["OK"] is True assert res["SubmittedJobs"] == 2 _stopJob(2) for ff in ["testJob.py", "stop_job_2", "job.info", "std.out"]: if os.path.isfile(ff): os.remove(ff) if os.path.isdir("job"): shutil.rmtree("job")
def test_submitJob(): with open('testJob.py', 'w') as execFile: execFile.write(jobScript % '1') os.chmod('testJob.py', 0o755) ce = InProcessComputingElement('InProcessCE') res = ce.submitJob('testJob.py', None) assert res['OK'] is True res = ce.getCEStatus() assert res['OK'] is True assert res['SubmittedJobs'] == 1 _stopJob(1) for ff in ['testJob.py', 'stop_job_2', 'job.info', 'std.out']: if os.path.isfile(ff): os.remove(ff) # # With a job wrapper and some MP parameters with open('testJob.py', 'w') as execFile: execFile.write(jobScript % '2') os.chmod('testJob.py', 0o755) jobParams = {'JobType': 'User', 'Executable': 'testJob.py'} resourceParams = {'GridCE': 'some_CE'} optimizerParams = {} wrapperFile = createJobWrapper( 2, jobParams, resourceParams, optimizerParams, logLevel='DEBUG')[ 'Value'] # This is not under test, assuming it works fine res = ce.submitJob(wrapperFile, proxy=None, numberOfProcessors=4, maxNumberOfProcessors=8, wholeNode=False, mpTag=True, jobDesc={ "jobParams": jobParams, "resourceParams": resourceParams, "optimizerParams": optimizerParams }) assert res['OK'] is True res = ce.getCEStatus() assert res['OK'] is True assert res['SubmittedJobs'] == 2 _stopJob(2) for ff in ['testJob.py', 'stop_job_2', 'job.info', 'std.out']: if os.path.isfile(ff): os.remove(ff) if os.path.isdir('job'): shutil.rmtree('job')
def test_submitJobWrapper(): with open("testJob.py", "w") as execFile: execFile.write(jobScript % "2") os.chmod("testJob.py", 0o755) jobParams = {"JobType": "User", "Executable": "testJob.py"} resourceParams = {"GridCE": "some_CE"} optimizerParams = {} wrapperFile = createJobWrapper( 2, jobParams, resourceParams, optimizerParams, logLevel="DEBUG")[ "Value"] # This is not under test, assuming it works fine shutil.copy(fj, os.curdir) ce = SingularityComputingElement("SingularityComputingElement") res = ce.submitJob( wrapperFile, proxy=None, numberOfProcessors=4, maxNumberOfProcessors=8, wholeNode=False, mpTag=True, jobDesc={ "jobParams": jobParams, "resourceParams": resourceParams, "optimizerParams": optimizerParams }, ) assert res["OK"] is False # This is False because the image can't be found assert res["ReschedulePayload"] is True res = ce.getCEStatus() assert res["OK"] is True if six.PY2: assert res["SubmittedJobs"] == 0 else: assert res["SubmittedJobs"] == 1 _stopJob(2) for ff in [ "testJob.py", "stop_job_2", "job.info", "std.out", "pilot.json" ]: if os.path.isfile(ff): os.remove(ff) if os.path.isdir("job"): shutil.rmtree("job")
def test_submitJob(): shutil.copy(fj, os.curdir) with open('testJob.py', 'w') as execFile: execFile.write(jobScript % '1') os.chmod('testJob.py', 0o755) ce = SingularityComputingElement('SingularityComputingElement') res = ce.submitJob('testJob.py', None) assert res['OK'] is False assert res['ReschedulePayload'] is True res = ce.getCEStatus() assert res['OK'] is True assert res['SubmittedJobs'] == 1 _stopJob(1) for ff in ['testJob.py', 'pilot.json']: if os.path.isfile(ff): os.remove(ff)
def test_submitJob(): shutil.copy(fj, os.curdir) shutil.copyfile(fc, os.path.join(os.curdir, "pilot.cfg")) with open("testJob.py", "w") as execFile: execFile.write(jobScript % "1") os.chmod("testJob.py", 0o755) ce = SingularityComputingElement("SingularityComputingElement") res = ce.submitJob("testJob.py", None) assert res["OK"] is False assert res["ReschedulePayload"] is True res = ce.getCEStatus() assert res["OK"] is True assert res["SubmittedJobs"] == 1 _stopJob(1) for ff in ["testJob.py", "pilot.json"]: if os.path.isfile(ff): os.remove(ff)
def test_submitJobWrapper(): with open('testJob.py', 'w') as execFile: execFile.write(jobScript % '2') os.chmod('testJob.py', 0o755) jobParams = {'JobType': 'User', 'Executable': 'testJob.py'} resourceParams = {'GridCE': 'some_CE'} optimizerParams = {} wrapperFile = createJobWrapper(2, jobParams, resourceParams, optimizerParams, logLevel='DEBUG')['Value'] # This is not under test, assuming it works fine shutil.copy(fj, os.curdir) ce = SingularityComputingElement('SingularityComputingElement') res = ce.submitJob(wrapperFile, proxy=None, numberOfProcessors=4, maxNumberOfProcessors=8, wholeNode=False, mpTag=True, jobDesc={"jobParams": jobParams, "resourceParams": resourceParams, "optimizerParams": optimizerParams}) assert res['OK'] is False # This is False because the image can't be found assert res['ReschedulePayload'] is True res = ce.getCEStatus() assert res['OK'] is True assert res['SubmittedJobs'] == 1 _stopJob(2) for ff in ['testJob.py', 'stop_job_2', 'job.info', 'std.out', 'pilot.json']: if os.path.isfile(ff): os.remove(ff) if os.path.isdir('job'): shutil.rmtree('job')