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 executeJob(executableFile, proxy, taskID): ce = InProcessComputingElement("Task-" + str(taskID)) result = ce.submitJob(executableFile, proxy) return result
def executeJob( executableFile, proxy, taskID ): ce = InProcessComputingElement( "Task-" + str( taskID ) ) result = ce.submitJob( executableFile, proxy ) return result