def test_get_jobs(): listener = mock.Mock() queue = SGEQueue(listener, "", "", "name", "workdir") jobs = queue.get_jobs_from_external_queue() popen_qstat_mock.assert_called_once_with(['qstat', '-xml'], stdout=subprocess.PIPE) assert len(jobs) == 1
def test_add_to_queue(): listener = mock.Mock() queue = SGEQueue(listener, "", "", "name", "workdir") queue.add_to_queue("/home/task", False, "/home/task/task.sh", "/home/task/stdout.txt", "/home/task/stderr.txt") qsub_popen_mock.assert_called_once_with([ "qsub", "-N", "task-name", "-V", "-b", "n", "-cwd", "-o", "/home/task/stdout.txt", "-e", "/home/task/stderr.txt", "/home/task/task.sh" ], stdout=subprocess.PIPE, cwd="workdir")
def test_kill(): listener = mock.Mock() queue = SGEQueue(listener, "", "", "name", "workdir") queue.kill([Task("task", "100", "running", "/home/task")]) qdel_popen_mock.assert_called_once_with(["qdel", "100"])