def test_save_jobs_to_disk(self): job_doc_list = job_list tmpdir = tempfile.mkdtemp() utils.save_jobs_to_disk(job_doc_list, tmpdir) file = '/'.join([tmpdir, "job_test.conf"]) self.assertTrue(os.path.exists(file)) shutil.rmtree(tmpdir)
def get_jobs(self): if self.client: job_doc_list = utils.get_active_jobs_from_api(self.client) try: utils.save_jobs_to_disk(job_doc_list, self.job_path) except Exception as e: LOG.error('Unable to save jobs to {0}. ' '{1}'.format(self.job_path, e)) return job_doc_list else: return utils.get_jobs_from_disk(self.job_path)
def get_jobs(self): if self.client: job_doc_list = utils.get_active_jobs_from_api(self.client) try: utils.save_jobs_to_disk(job_doc_list, self.job_path) except Exception as e: LOG.error('Unable to save jobs to {0}. ' '{1}'.format(self.job_path, e)) return job_doc_list else: return utils.get_jobs_from_disk(self.job_path)