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: logging.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 do_job_upload(client, args): for job_doc in utils.get_jobs_from_disk(args.jobs_dir): job_id = client.jobs.create(job_doc) print("Uploaded job {0}".format(job_id))