def test_control_terminate(self): """control/terminate works""" Session.control(self.jid, JobControlAction.TERMINATE) Session.synchronize(self.jid, Session.TIMEOUT_WAIT_FOREVER, False) try: Session.wait(self.jid, Session.TIMEOUT_WAIT_FOREVER) except Exception as e: assert e.args[0].startswith('code 24') # no rusage
def test_with_jt(): """'with' statement works with JobTemplate""" s = Session() s.initialize() with s.createJobTemplate() as jt: jt.remoteCommand = 'sleep' jt.args = ['10'] jid = s.runJob(jt) print(s.wait(jid)) s.exit()
def test_wait(self): """waiting for job completion""" jinfo = Session.wait(self.jid) eq_(jinfo.jobId, self.jid) assert hasattr(jinfo, 'hasExited') assert hasattr(jinfo, 'hasExited') and type(jinfo.hasExited) is bool assert hasattr(jinfo, 'hasSignal') and type(jinfo.hasSignal) is bool assert hasattr(jinfo, 'terminatedSignal') and type(jinfo.terminatedSignal) is str assert hasattr(jinfo, 'hasCoreDump') and type(jinfo.hasCoreDump) is bool assert hasattr(jinfo, 'wasAborted') and type(jinfo.wasAborted) is bool assert hasattr(jinfo, 'exitStatus') and type(jinfo.exitStatus) is int assert hasattr(jinfo, 'resourceUsage') and type(jinfo.resourceUsage) is dict
def test_environment(self): """environment variables are correctly passed to submitted jobs""" jinfo = Session.wait(self.jid) eq_(jinfo.jobId, self.jid) assert hasattr(jinfo, 'hasExited') assert hasattr(jinfo, 'exitStatus') and jinfo.exitStatus == 0
def xtest_tmp(self): self.test_scalar_attributes() self.jt.args = ['.colordb'] jid = Session.runJob(self.jt) jinfo = Session.wait(jid) print(jinfo)