def kill(self): 'It kills all jobs' if 'popens' not in self._jobs: return for popen in self._jobs['popens']: #untill 2.6 subprocess.popen do not support kill if 'kill' in dir(popen): popen.kill() else: pid = popen.pid call(['kill', '-9', str(pid)])
def terminate(self): 'It kills all jobs' if 'popens' not in self._jobs: return for popen in self._jobs['popens']: #untill 2.6 subprocess.popen do not support terminate if 'terminate' in dir(popen): popen.terminate() else: pid = popen.pid call(['kill', '-6', str(pid)])
def test_run_condor_kill(): 'It test that we can kill a condor job' bin = create_test_binary() #a simple job cmd = [bin] cmd.extend(['-w']) popen = Popen(cmd, runner_conf={'transfer_executable':True}) pid = str(popen.pid) popen.kill() stdout = call(['condor_q', pid])[0] assert pid not in stdout os.remove(bin)