def retrieve_job_status(auth, config): """ Prints the status of the selected job. :Args: - auth (:class:`.Credentials`): instance of the Credentials class as returned by authentication() - config :class:`.Configuration`: instance of the Configuration class as returned by create_config() """ job_mgr = JobManager(auth, cfg=config) jobid = input("Please enter the job ID: ") try: job = job_mgr.get_job(jobid=jobid) print("Job '{0}' is {1}".format(job.name, job.status)) except RestCallException as e: print("Request failed: {0}".format(e))
def download_ouput(auth, config): """ Downloads final job output as to specified location. :Args: - auth (:class:`.Credentials`): instance of the Credentials class as returned by authentication() """ job_mgr = JobManager(auth, cfg=config) jobid = input("Please enter the job ID: ") try: job = job_mgr.get_job(jobid=jobid) print("Downloading output of {0} job called {1}".format( job.type, job.name)) output = job.get_output(DOWNLOAD_DIR, overwrite=True) print("Job output successfully downloaded to: {0}".format(output)) except RestCallException as exc: print("Download failed: {0}".format(exc.msg))
def update_job(auth, config): """ Updates the job and returns True or False depending on the success of the operation. :Args: - auth (:class:`.Credentials`): instance of the Credentials class as returned by authentication() - config (:class:`.Configuration`): instance of the Configuration class as returned by logging_mode() """ job_mgr = JobManager(auth, cfg=config) jobid = input("Please enter the job ID: ") try: job = job_mgr.get_job(jobid=jobid) job.update() print("Latest updates on job {0} retrieved.\nStatus: {1}\n" "Progress: {2}%".format(job.name, job.status, job.percentage)) except RestCallException as e: print("Update failed: {0}".format(e))