def run_notebook(args): params = process_params(args.p) if args.notebook.startswith("s3://"): input_path = args.notebook notebook = os.path.basename(args.notebook) else: input_path = None notebook = args.notebook try: job_name = run.invoke( image=args.image, input_path=input_path, output_prefix=args.output_prefix, notebook=notebook, parameters=params, role=args.role, instance_type=args.instance, extra_args=load_extra(args.extra), ) # except run.InvokeException as ie: # print(f"Error starting run: {str(ie)}") # return except FileNotFoundError as fe: print(str(fe)) return print(f"Started processing job {job_name}") if args.no_wait: return status, failure = run.wait_for_complete(job_name) print(f"Run finished with status {status}") if failure: print(failure) else: run.download_notebook(job_name, args.output_dir)
def download_notebook(args): if args.wait: status, failure = run.wait_for_complete(args.run_name) if status != "Completed": print(f"Run finished with status {status}") if failure: print(failure) return run.download_notebook(args.run_name, args.output_dir)