76 def test_submit_and_monitor_job(self):
77 """
78 Test to submit and monitor a regular job
79 """
80
81 with tempfile.TemporaryDirectory() as td:
82
83
84 os.chdir(str(td))
85
86 drmaa_mock = MagicMock()
87 drmaa_mock.Session = (
88 self.SessionMock
89 )
90 drmaa_mock.JobState = self.SessionMock.JobState
91
92 sys.modules["drmaa"] = drmaa_mock
93
94
95
96 self.assertTrue(Cluster.is_supported())
97
98 job = Script(path="myscript1.py", package="test_package", log=None)
99
100 cc = Cluster()
101 cc.execute(job)
102
103
104 self.assertTrue(job.job_id)
105
106
107 self.assertFalse(cc.is_job_finished(job)[0])
108
109
110
111 self.SessionMock.jobStatusReturn = self.SessionMock.JobState.DONE
112
113 self.assertTrue(cc.is_job_finished(job)[0])
114
115 cc.terminate(job)
116
117