def stop(ctx, yes): """Stop run. Uses [Caching](/references/polyaxon-cli/#caching) Examples: \b ```bash $ polyaxon runs stop ``` \b ```bash $ polyaxon runs --uid=8aac02e3a62a4f0aaa257c59da5eab80 stop ``` """ owner, project_name, run_uuid = get_project_run_or_local( ctx.obj.get("project"), ctx.obj.get("run_uuid")) if not yes and not click.confirm("Are sure you want to stop " "run `{}`".format(run_uuid)): click.echo("Existing without stopping run.") sys.exit(0) try: polyaxon_client = PolyaxonClient() polyaxon_client.runs_v1.stop_run(owner, project_name, run_uuid) except (ApiException, HTTPError) as e: handle_cli_error(e, message="Could not stop run `{}`.".format(run_uuid)) sys.exit(1) Printer.print_success("Run is being stopped.")
def resume(ctx, polyaxonfile, u): """Resume run. Uses [Caching](/references/polyaxon-cli/#caching) Examples: \b ```bash $ polyaxon runs --uid=8aac02e3a62a4f0aaa257c59da5eab80 resume ``` """ content = None if polyaxonfile: content = "{}".format(reader.read(polyaxonfile)) # Check if we need to upload if u: ctx.invoke(upload, sync=False) owner, project_name, run_uuid = get_project_run_or_local( ctx.obj.get("project"), ctx.obj.get("run_uuid")) try: polyaxon_client = PolyaxonClient() body = V1Run(content=content) response = polyaxon_client.runs_v1.resume_run(owner, project_name, run_uuid, body) Printer.print_success("Run was resumed with uid {}".format( response.uuid)) except (ApiException, HTTPError) as e: handle_cli_error(e, message="Could not resume run `{}`.".format(run_uuid)) sys.exit(1)
def get_compatibility(key: str, service: str, version: str, is_cli=True): if not key: key = uuid.uuid4().hex try: version = version.lstrip("v").replace(".", "-")[:5] except Exception as e: CliConfigManager.reset(last_check=now()) if is_cli: handle_cli_error( e, message="Could parse the version {}.".format(version), ) polyaxon_client = PolyaxonClient(config=ClientConfig(), token=NO_AUTH) try: return polyaxon_client.versions_v1.get_compatibility(uuid=key, service=service, version=version) except ApiException as e: if e.status == 403: session_expired() CliConfigManager.reset(last_check=now()) if is_cli: handle_cli_error( e, message="Could not reach the compatibility API.", ) except HTTPError: CliConfigManager.reset(last_check=now()) if is_cli: Printer.print_error( "Could not connect to remote server to fetch compatibility versions.", )
def artifacts(ctx, project, uid, path, path_to, no_untar): """Download outputs/artifacts for run. Uses /docs/core/cli/#caching Examples: \b $ polyaxon ops artifacts -uid=8aac02e3a62a4f0aaa257c59da5eab80 \b $ polyaxon ops artifacts -uid=8aac02e3a62a4f0aaa257c59da5eab80 path="events/only" \b $ polyaxon ops artifacts -uid=8aac02e3a62a4f0aaa257c59da5eab80 path_to="this/path" """ owner, project_name, run_uuid = get_project_run_or_local( project or ctx.obj.get("project"), uid or ctx.obj.get("run_uuid"), is_cli=True, ) try: client = RunClient(owner=owner, project=project_name, run_uuid=run_uuid) download_path = client.download_artifacts(path=path or "", path_to=path_to, untar=not no_untar) except (ApiException, HTTPError) as e: handle_cli_error( e, message="Could not download outputs for run `{}`.".format( run_uuid)) sys.exit(1) Printer.print_success("Files downloaded: path: {}".format(download_path))
def create_run(): click.echo("Creating a run.") try: compiled_operation = OperationSpecification.compile_operation( op_spec) run_name = compiled_operation.name or name resource = compiler.make( owner_name=owner, project_name=project_name, project_uuid=project_name, run_uuid=run_name, run_name=name, run_path=run_name, compiled_operation=compiled_operation, params=op_spec.params, ) Spawner(namespace=settings.AGENT_CONFIG.namespace).create( run_uuid=run_name, run_kind=compiled_operation.get_run_kind(), resource=resource, ) # cache.cache(config_manager=RunManager, response=response) run_job_uid = get_resource_name(run_name) Printer.print_success( "A new run `{}` was created".format(run_job_uid)) except (PolyaxonCompilerError, PolyaxonK8SError, PolypodException) as e: handle_cli_error(e, message="Could not create a run.") sys.exit(1)
def resume(ctx, project, uid, polyaxonfile): """Resume run. Uses /docs/core/cli/#caching Examples: \b $ polyaxon ops resume --uid=8aac02e3a62a4f0aaa257c59da5eab80 """ content = None if polyaxonfile: content = OperationSpecification.read( polyaxonfile, is_preset=True).to_dict(dump=True) owner, project_name, run_uuid = get_project_run_or_local( project or ctx.obj.get("project"), uid or ctx.obj.get("run_uuid"), is_cli=True, ) try: polyaxon_client = RunClient(owner=owner, project=project_name, run_uuid=run_uuid) response = polyaxon_client.resume(override_config=content) Printer.print_success("Run was resumed with uid {}".format( response.uuid)) except (ApiException, HTTPError) as e: handle_cli_error(e, message="Could not resume run `{}`.".format(run_uuid)) sys.exit(1)
def approve(ctx, project, uid): """Approve a run waiting for human validation. Uses /docs/core/cli/#caching Examples: \b $ polyaxon ops approve \b $ polyaxon ops approve --uid=8aac02e3a62a4f0aaa257c59da5eab80 """ owner, project_name, run_uuid = get_project_run_or_local( project or ctx.obj.get("project"), uid or ctx.obj.get("run_uuid"), is_cli=True, ) try: polyaxon_client = RunClient(owner=owner, project=project_name, run_uuid=run_uuid) polyaxon_client.approve() except (ApiException, HTTPError) as e: handle_cli_error( e, message="Could not approve run `{}`.".format(run_uuid)) sys.exit(1) Printer.print_success("Run is approved.")
def upgrade(config_file, manager_path, check, dry_run): """Upgrade a Polyaxon deployment.""" config = read_deployment_config(config_file) manager = DeployManager(config=config, filepath=config_file, manager_path=manager_path, dry_run=dry_run) exception = None if config: Printer.print_success("Polyaxon `{}` deployment file is valid.".format( config.deployment_chart)) if check: try: manager.check() except Exception as e: handle_cli_error(e, message="Polyaxon deployment manager error.", sys_exit=True) else: try: manager.upgrade() except Exception as e: Printer.print_error("Polyaxon could not upgrade the deployment.") exception = e if exception: Printer.print_error("Error message: {}.".format(exception))
def restart(ctx, copy, polyaxonfile): """Restart run. Uses /docs/core/cli/#caching Examples: \b $ polyaxon run --uid=8aac02e3a62a4f0aaa257c59da5eab80 restart """ content = None if polyaxonfile: content = "{}".format(ConfigSpec.read_from(polyaxonfile)) owner, project_name, run_uuid = get_project_run_or_local( ctx.obj.get("project"), ctx.obj.get("run_uuid"), is_cli=True, ) try: polyaxon_client = RunClient(owner=owner, project=project_name, run_uuid=run_uuid) response = polyaxon_client.restart(override_config=content, copy=copy) Printer.print_success("Run was {} with uid {}".format( "copied" if copy else "restarted", response.uuid)) except (ApiException, HTTPError) as e: handle_cli_error( e, message="Could not restart run `{}`.".format(run_uuid)) sys.exit(1)
def logs(ctx, project, uid, follow, hide_time, all_containers, all_info): """Get run or run job logs. Uses /docs/core/cli/#caching Examples for getting run logs: \b $ polyaxon run logs \b $ polyaxon ops logs -uid=8aac02e3a62a4f0aaa257c59da5eab80 -p mnist """ owner, project_name, run_uuid = get_project_run_or_local( project or ctx.obj.get("project"), uid or ctx.obj.get("run_uuid"), is_cli=True, ) client = RunClient(owner=owner, project=project_name, run_uuid=run_uuid) try: get_run_logs( client=client, hide_time=hide_time, all_containers=all_containers, all_info=all_info, follow=follow, ) except (ApiException, HTTPError, PolyaxonClientException) as e: handle_cli_error( e, message="Could not get logs for run `{}`.".format(client.run_uuid), ) sys.exit(1)
def check_polyaxonfile(polyaxonfile, params=None, profile=None, nocache=None, log=True): if not polyaxonfile: polyaxonfile = PolyaxonFile.check_default_path(path=".") if not polyaxonfile: polyaxonfile = "" polyaxonfile = to_list(polyaxonfile) exists = [os.path.isfile(f) for f in polyaxonfile] parsed_params = None if params: parsed_params = parse_params(params) if not any(exists): Printer.print_error("Polyaxonfile is not present, " "please run {}".format(constants.INIT_COMMAND)) sys.exit(1) try: plx_file = PolyaxonFile(polyaxonfile) plx_file = plx_file.get_op_specification(params=parsed_params, profile=profile, nocache=nocache) if log: Printer.print_success("Polyaxonfile valid") return plx_file except Exception as e: handle_cli_error(e, message="Polyaxonfile is not valid.") sys.exit(1)
def invalidate_run(ctx): """Invalidate runs' cache inside this project. Uses [Caching](/references/polyaxon-cli/#caching) Examples: \b ```bash $ polyaxon invalidate_builds ``` """ owner, project_name, run_uuid = get_project_run_or_local( ctx.obj.get("project"), ctx.obj.get("run_uuid"), is_cli=True) try: polyaxon_client = RunClient(owner=owner, project=project_name, run_uuid=run_uuid) response = polyaxon_client.invalidate() Printer.print_success("Run was invalidated with uid {}".format( response.uuid)) except (ApiException, HTTPError) as e: handle_cli_error( e, message="Could not invalidate run `{}`.".format(run_uuid)) sys.exit(1)
def create_run(is_managed: bool = True, meta_info: Dict = None): is_approved = False if upload else None try: response = polyaxon_client.create( name=name, description=description, tags=tags, content=op_spec, is_managed=is_managed, is_approved=is_approved, meta_info=meta_info, ) Printer.print_success("A new run `{}` was created".format( response.uuid)) if not eager: cache_run(response) click.echo("You can view this run on Polyaxon UI: {}".format( get_dashboard_url(subpath="{}/{}/runs/{}".format( owner, project_name, response.uuid)))) return response.uuid except (ApiException, HTTPError) as e: handle_cli_error( e, message="Could not create a run.", http_messages_mapping={ 404: "Make sure you have a project initialized in your current workdir, " "otherwise you need to pass a project with `-p/--project`. " "The project {}/{} does not exist.".format( owner, project_name) }, ) sys.exit(1)
def artifacts(ctx): """Download outputs/artifacts for run. Uses /docs/core/cli/#caching Examples: \b $ polyaxon ops -uid=8aac02e3a62a4f0aaa257c59da5eab80 artifacts """ owner, project_name, run_uuid = get_project_run_or_local( ctx.obj.get("project"), ctx.obj.get("run_uuid"), is_cli=True, ) try: client = RunClient(owner=owner, project=project_name, run_uuid=run_uuid) client.download_artifacts() except (ApiException, HTTPError) as e: handle_cli_error( e, message="Could not download outputs for run `{}`.".format( run_uuid)) sys.exit(1) Printer.print_success("Files downloaded.")
def deploy(config_file, manager_path, check, dry_run): """Deploy polyaxon.""" config = read_deployment_config(config_file) manager = DeployManager(config=config, filepath=config_file, manager_path=manager_path, dry_run=dry_run) exception = None if check: try: manager.check() except Exception as e: handle_cli_error(e, message="Polyaxon deployment file is not valid.") sys.exit(1) Printer.print_success("Polyaxon deployment file is valid.") else: try: manager.install() except Exception as e: Printer.print_error("Polyaxon could not be installed.") exception = e if exception: Printer.print_error("Error message: {}.".format(exception))
def resume(ctx, polyaxonfile, u): """Resume run. Uses /docs/core/cli/#caching Examples: \b $ polyaxon ops --uid=8aac02e3a62a4f0aaa257c59da5eab80 resume """ content = None if polyaxonfile: content = "{}".format(ConfigSpec.read_from(polyaxonfile)) # Check if we need to upload if u: ctx.invoke(upload, sync=False) owner, project_name, run_uuid = get_project_run_or_local( ctx.obj.get("project"), ctx.obj.get("run_uuid"), is_cli=True, ) try: polyaxon_client = RunClient(owner=owner, project=project_name, run_uuid=run_uuid) response = polyaxon_client.resume(override_config=content) Printer.print_success("Run was resumed with uid {}".format( response.uuid)) except (ApiException, HTTPError) as e: handle_cli_error(e, message="Could not resume run `{}`.".format(run_uuid)) sys.exit(1)
def invalidate(ctx): """Invalidate the run's cache state. Uses /docs/core/cli/#caching Examples: \b $ polyaxon ops invalidate """ owner, project_name, run_uuid = get_project_run_or_local( ctx.obj.get("project"), ctx.obj.get("run_uuid"), is_cli=True, ) try: polyaxon_client = RunClient(owner=owner, project=project_name, run_uuid=run_uuid) response = polyaxon_client.invalidate() Printer.print_success("Run was invalidated with uid {}".format( response.uuid)) except (ApiException, HTTPError) as e: handle_cli_error( e, message="Could not invalidate run `{}`.".format(run_uuid)) sys.exit(1)
def delete(ctx, _project): """Delete project. Uses /docs/core/cli/#caching """ owner, project_name = get_project_or_local(_project or ctx.obj.get("project"), is_cli=True) if not click.confirm("Are sure you want to delete project `{}/{}`".format( owner, project_name)): click.echo("Existing without deleting project.") sys.exit(1) try: polyaxon_client = ProjectClient(owner=owner, project=project_name) polyaxon_client.delete() local_project = get_local_project() if local_project and (owner, project_name) == ( local_project.owner, local_project.name, ): # Purge caching ProjectConfigManager.purge() except (ApiException, HTTPError) as e: handle_cli_error(e, message="Could not delete project `{}/{}`.".format( owner, project_name)) sys.exit(1) Printer.print_success("Project `{}/{}` was delete successfully".format( owner, project_name))
def stop(ctx, yes): """Stop run. Uses /docs/core/cli/#caching Examples: \b $ polyaxon ops stop \b $ polyaxon ops --uid=8aac02e3a62a4f0aaa257c59da5eab80 stop """ owner, project_name, run_uuid = get_project_run_or_local( ctx.obj.get("project"), ctx.obj.get("run_uuid"), is_cli=True, ) if not yes and not click.confirm("Are sure you want to stop " "run `{}`".format(run_uuid)): click.echo("Existing without stopping run.") sys.exit(0) try: polyaxon_client = RunClient(owner=owner, project=project_name, run_uuid=run_uuid) polyaxon_client.stop() except (ApiException, HTTPError) as e: handle_cli_error(e, message="Could not stop run `{}`.".format(run_uuid)) sys.exit(1) Printer.print_success("Run is being stopped.")
def unbookmark(ctx): """Unbookmark run. Uses [Caching](/references/polyaxon-cli/#caching) Examples: \b ```bash $ polyaxon runs unbookmark ``` \b ```bash $ polyaxon runs -uid=8aac02e3a62a4f0aaa257c59da5eab80 unbookmark ``` """ owner, project_name, run_uuid = get_project_run_or_local( ctx.obj.get("project"), ctx.obj.get("run_uuid")) try: polyaxon_client = PolyaxonClient() polyaxon_client.runs_v1.unbookmark_run(owner, project_name, run_uuid) except (ApiException, HTTPError) as e: handle_cli_error( e, message="Could not unbookmark run `{}`.".format(run_uuid)) sys.exit(1) Printer.print_success("Run is unbookmarked.")
def restart(ctx, copy, polyaxonfile, u): """Restart run. Uses [Caching](/references/polyaxon-cli/#caching) Examples: \b ```bash $ polyaxon run --uid=8aac02e3a62a4f0aaa257c59da5eab80 restart ``` """ content = None if polyaxonfile: content = "{}".format(ConfigSpec.read_from(polyaxonfile)) # Check if we need to upload if u: ctx.invoke(upload, sync=False) owner, project_name, run_uuid = get_project_run_or_local( ctx.obj.get("project"), ctx.obj.get("run_uuid"), is_cli=True) try: polyaxon_client = RunClient(owner=owner, project=project_name, run_uuid=run_uuid) response = polyaxon_client.restart(override_config=content, copy=copy) Printer.print_success("Run was {} with uid {}".format( "copied" if copy else "restarted", response.uuid)) except (ApiException, HTTPError) as e: handle_cli_error( e, message="Could not restart run `{}`.".format(run_uuid)) sys.exit(1)
def set(**kwargs): # pylint:disable=redefined-builtin """Set the global config values. Example: \b $ polyaxon config set --host=localhost """ try: _config = ClientConfigManager.get_config_or_default() except Exception as e: handle_cli_error(e, message="Polyaxon load configuration.") Printer.print_header( "You can reset your config by running: polyaxon config purge") sys.exit(1) should_purge = False for key, value in kwargs.items(): if key == "host": should_purge = True if value is not None: setattr(_config, key, value) ClientConfigManager.set_config(_config) Printer.print_success("Config was updated.") # Reset cli config CliConfigManager.purge() if should_purge: AuthConfigManager.purge() UserConfigManager.purge()
def update(model, version, name, description, tags, private): """Update model registry. Uses /docs/core/cli/#caching Example: \b $ polyaxon registry update foobar --description="Image Classification with DL using TensorFlow" \b $ polyaxon registry update mike1/foobar --description="Image Classification with DL using TensorFlow" \b $ polyaxon registry update --tags="foo, bar" """ owner, model_registry, model_version, is_version = get_info(model, version) full_entity = ("{}/{}:{}".format(owner, model_registry, model_version) if is_version else "{}/{}".format(owner, model_registry)) update_dict = {} if name: update_dict["name"] = name if description: update_dict["description"] = description tags = validate_tags(tags) if tags: update_dict["tags"] = tags if private is not None: update_dict["is_public"] = not private if not update_dict: Printer.print_warning( "No argument was provided to update the model {}.".format( "version" if is_version else "registry")) sys.exit(1) try: polyaxon_client = PolyaxonClient() if is_version: response = polyaxon_client.model_registry_v1.patch_model_version( owner, model_registry, model_version, body=update_dict) Printer.print_success("Model version updated.") get_model_version_details(response) else: response = polyaxon_client.model_registry_v1.patch_model_registry( owner, model_registry, body=update_dict) Printer.print_success("Model updated.") get_entity_details(response, "Model registry") except (ApiException, HTTPError) as e: handle_cli_error( e, message="Could not update model {} `{}`.".format( "version" if is_version else "registry", full_entity), ) sys.exit(1)
def upload(ctx, project, uid, path_from, path_to, is_file, sync_failure): """Upload runs' artifacts. Uses /docs/core/cli/#caching Examples: \b $ polyaxon ops upload -uid=8aac02e3a62a4f0aaa257c59da5eab80 \b $ polyaxon ops upload -uid=8aac02e3a62a4f0aaa257c59da5eab80 path_from="path/to/upload" \b $ polyaxon ops upload -uid=8aac02e3a62a4f0aaa257c59da5eab80 path_to="path/to/upload/to" """ owner, project_name, run_uuid = get_project_run_or_local( project or ctx.obj.get("project"), uid or ctx.obj.get("run_uuid"), is_cli=True, ) try: client = RunClient(owner=owner, project=project_name, run_uuid=run_uuid) if is_file: response = client.upload_artifact(filepath=path_from, path=path_to or "", overwrite=True) else: files = IgnoreConfigManager.get_unignored_filepaths(path_from) response = client.upload_artifacts(files=files, path=path_to or "", overwrite=True, relative_to=path_from) except ( ApiException, HTTPError, PolyaxonHTTPError, PolyaxonShouldExitError, PolyaxonClientException, ) as e: handle_cli_error( e, message="Could not upload artifacts for run `{}`.".format( run_uuid)) sys.exit(1) if response.status_code == 200: Printer.print_success("Artifacts uploaded.") else: if sync_failure: client.log_failed(message="Operation failed uploading artifacts.") Printer.print_error( "Error uploading artifacts. " "Status: {}. Error: {}.".format(response.status_code, response.content), sys_exit=True, )
def get_run_tree(): try: return polyaxon_client.runs_v1.get_run_logs_tree( owner, project_name, run_uuid) except (ApiException, HTTPError) as e: handle_cli_error( e, message="Could not get logs for run `{}`.".format(run_uuid)) sys.exit(1)
def delete_run(): try: polyaxon_client.delete() except (ApiException, HTTPError) as e: handle_cli_error( e, message="The current eager operation does not exist anymore." ) sys.exit(1)
def create(ctx, name, description, tags, public, init): """Create a new project. Uses /docs/core/cli/#caching Example: \b $ polyaxon project create --name=cats-vs-dogs --description="Image Classification with DL" \b $ polyaxon project create --name=owner/name --description="Project Description" """ if not name: Printer.print_error( "Please provide a valid name to create a project.", command_help="project create", sys_exit=True, ) owner, project_name = resolve_entity_info(name or ctx.obj.get("project"), is_cli=True, entity_name="project") tags = validate_tags(tags) if not owner: Printer.print_error( "Please provide a valid name with an owner namespace: --name=owner/project." ) sys.exit(1) try: project_config = V1Project(name=project_name, description=description, tags=tags, is_public=public) polyaxon_client = ProjectClient(owner=owner) _project = polyaxon_client.create(project_config) config = polyaxon_client.client.sanitize_for_serialization(_project) cache.cache(config_manager=ProjectConfigManager, config=config) except (ApiException, HTTPError) as e: handle_cli_error( e, message="Could not create project `{}`.".format(project_name)) sys.exit(1) Printer.print_success("Project `{}` was created successfully.".format( _project.name)) click.echo("You can view this project on Polyaxon UI: {}".format( get_dashboard_url(subpath="{}/{}".format(owner, _project.name)))) if init: ctx.obj = {} ctx.invoke( init_project, project="{}/{}".format(owner, project_name), polyaxonignore=True, )
def statuses(ctx, watch): """Get run or run job statuses. Uses /docs/core/cli/#caching Examples getting run statuses: \b $ polyaxon ops statuses \b $ polyaxon ops -uid=8aac02e3a62a4f0aaa257c59da5eab80 statuses """ def _handle_run_statuses(): if not conditions: return Printer.print_header("Latest status:") latest_status = Printer.add_status_color( {"status": status}, status_key="status" ) click.echo("{}\n".format(latest_status["status"])) objects = list_dicts_to_tabulate( [ Printer.add_status_color(o.to_dict(), status_key="type") for o in conditions ] ) if objects: Printer.print_header("Conditions:") dict_tabulate(objects, is_list_dict=True) owner, project_name, run_uuid = get_project_run_or_local( ctx.obj.get("project"), ctx.obj.get("run_uuid"), is_cli=True, ) client = RunClient(owner=owner, project=project_name, run_uuid=run_uuid) if watch: try: for status, conditions in client.watch_statuses(): _handle_run_statuses() except (ApiException, HTTPError, PolyaxonClientException) as e: handle_cli_error( e, message="Could get status for run `{}`.".format(run_uuid) ) sys.exit(1) else: try: status, conditions = client.get_statuses() _handle_run_statuses() except (ApiException, HTTPError, PolyaxonClientException) as e: handle_cli_error( e, message="Could get status for run `{}`.".format(run_uuid) ) sys.exit(1)
def run(ctx, name, owner, project_name, description, tags, specification, log): try: _run(ctx, name, owner, project_name, description, tags, specification, log) except (PolyaxonHTTPError, PolyaxonShouldExitError, PolyaxonClientException) as e: handle_cli_error(e, message="Could start local run.") sys.exit(1) except Exception as e: Printer.print_error("Could start local run.") Printer.print_error("Unexpected Error: `{}`.".format(e)) sys.exit(1)
def create(ctx, name, description, tags, private, init): """Create a new project. Uses /docs/core/cli/#caching Example: \b $ polyaxon project create --project=cats-vs-dogs --description="Image Classification with DL" \b $ polyaxon project create --project=owner/name --description="Project Description" """ if not name: Printer.print_error( "Please login provide a name to create a project.", command_help="project create", sys_exit=True, ) owner, project_name = get_project_or_local(name or ctx.obj.get("project"), is_cli=True) owner = owner or settings.AUTH_CONFIG.username if not owner and (not settings.CLI_CONFIG or settings.CLI_CONFIG.is_ce): owner = DEFAULT tags = validate_tags(tags) if not owner: Printer.print_error( "Please login first or provide a valid name with owner --name=owner/project. " "`polyaxon login --help`") sys.exit(1) try: project_config = V1Project(name=project_name, description=description, tags=tags, is_public=not private) polyaxon_client = ProjectClient(owner=owner) _project = polyaxon_client.create(project_config) config = polyaxon_client.client.sanitize_for_serialization(_project) cache.cache(config_manager=ProjectConfigManager, config=config) except (ApiException, HTTPError) as e: handle_cli_error( e, message="Could not create project `{}`.".format(project_name)) sys.exit(1) Printer.print_success("Project `{}` was created successfully.".format( _project.name)) click.echo("You can view this project on Polyaxon UI: {}".format( get_dashboard_url(subpath="{}/{}".format(owner, _project.name)))) if init: ctx.obj = {} ctx.invoke(init_project, project="{}/{}".format(owner, project_name))