def test_14_job_cancel_invalid_args(self): with self.assertRaises(ValueError): job.kill(self.fh, "abc") with self.assertRaises(ValueError): job.cancel(self.fh, "abc") with self.assertRaises(OSError): job.kill(self.fh, 123) with self.assertRaises(OSError): job.cancel(self.fh, 123)
def test_16_job_kill(self): self.sleep_jobspec = JobspecV1.from_command(["sleep", "1000"]) jobid = job.submit(self.fh, self.sleep_jobspec, waitable=True) # Wait for shell to fully start to avoid delay in signal job.event_wait(self.fh, jobid, name="start") job.event_wait( self.fh, jobid, name="shell.start", eventlog="guest.exec.eventlog" ) job.kill(self.fh, jobid, signum=signal.SIGKILL) fut = job.wait_async(self.fh, jobid=jobid).wait_for(5.0) return_id, success, errmsg = fut.get_status() self.assertEqual(return_id, jobid) self.assertFalse(success)