def executeJob(executableFile, proxy, taskID, **kwargs): """ wrapper around ce.submitJob: decides which CE to use (Sudo or InProcess) """ useSudo = kwargs.pop('UseSudo', False) if useSudo: ce = SudoComputingElement("Task-" + str(taskID)) payloadUser = kwargs.get('PayloadUser') if payloadUser: ce.setParameters({'PayloadUser': payloadUser}) else: ce = InProcessComputingElement("Task-" + str(taskID)) return ce.submitJob(executableFile, proxy)
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, **kwargs): """ wrapper around ce.submitJob: decides which CE to use (Sudo or InProcess) :param str executableFile: location of the executable file :param str proxy: proxy file location to be used for job submission :param int taskID: local task ID of the PoolCE :return: the result of the job submission """ useSudo = kwargs.pop('UseSudo', False) if useSudo: ce = SudoComputingElement("Task-" + str(taskID)) payloadUser = kwargs.get('PayloadUser') if payloadUser: ce.setParameters({'PayloadUser': payloadUser}) else: ce = InProcessComputingElement("Task-" + str(taskID)) return ce.submitJob(executableFile, proxy)
def executeJob(executableFile, proxy, taskID, inputs, **kwargs): """wrapper around ce.submitJob: decides which CE to use (Sudo or InProcess or Singularity) :param str executableFile: location of the executable file :param str proxy: proxy file location to be used for job submission :param int taskID: local task ID of the PoolCE :return: the result of the job submission (S_OK/S_ERROR) """ innerCESubmissionType = kwargs.pop("InnerCESubmissionType") if innerCESubmissionType == "Sudo": ce = SudoComputingElement("Task-" + str(taskID)) payloadUser = kwargs.get("PayloadUser") if payloadUser: ce.setParameters({"PayloadUser": payloadUser}) elif innerCESubmissionType == "Singularity": ce = SingularityComputingElement("Task-" + str(taskID)) else: ce = InProcessComputingElement("Task-" + str(taskID)) return ce.submitJob(executableFile, proxy, inputs=inputs)
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