def test_free_cores(self): # Given r = jobs.RemoteWorker( host='localhost', python=sys.executable, testing=True ) # Then. n = r.free_cores() self.assertTrue(n >= 0) self.assertTrue(n <= multiprocessing.cpu_count())
def test_remote_worker_does_not_copy_when_nfs_is_set(self): # Given r = jobs.RemoteWorker( host='localhost', python=sys.executable, testing=True, nfs=True ) # When j = jobs.Job( [sys.executable, '-c', 'import time; time.sleep(0.05); print(1)'], output_dir=self.root ) proxy = r.run(j) wait_until(lambda: proxy.status() != 'done') # Now set testing to False and check the copying r.testing = False ret = r.copy_output(proxy.job_id, '.') # Then self.assertEqual(ret, None)
def test_simple(self): # Given r = jobs.RemoteWorker(host='localhost', python=sys.executable, testing=True) # When j = jobs.Job( [sys.executable, '-c', 'import time; time.sleep(0.05); print(1)'], output_dir=self.root) proxy = r.run(j) # Then wait_until(lambda: proxy.status() != 'done') self.assertEqual(proxy.status(), 'done') self.assertEqual(proxy.get_stderr(), '') self.assertEqual(proxy.get_stdout().strip(), '1') info = proxy.get_info() self.assertEqual(info['status'], 'done') self.assertEqual(info['exitcode'], 0)