def create(ctx, name, owner, description, private, init): """Create a new project. Uses /docs/core/cli/#caching Example: \b $ polyaxon project create --name=cats-vs-dogs --description="Image Classification with DL" """ owner = owner or AuthConfigManager.get_value("username") if not owner: Printer.print_error( "Please login first or provide a valid owner --owner. " "`polyaxon login --help`") sys.exit(1) try: project_config = V1Project(name=name, description=description, is_public=not private) _project = ProjectClient(owner=owner).create(project_config) except (ApiException, HTTPError) as e: handle_cli_error(e, message="Could not create project `{}`.".format(name)) sys.exit(1) Printer.print_success("Project `{}` was created successfully.".format( _project.name)) if init: ctx.obj = {} ctx.invoke(init_project, project=name)
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 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))
def create(ctx, name, owner, description, tags, private, init): """Create a new project. Uses /docs/core/cli/#caching Example: \b $ polyaxon project create --name=cats-vs-dogs --description="Image Classification with DL" """ owner = owner or settings.AUTH_CONFIG.username or DEFAULT tags = validate_tags(tags) if not owner: Printer.print_error( "Please login first or provide a valid owner --owner. " "`polyaxon login --help`") sys.exit(1) try: project_config = V1Project(name=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=ProjectManager, config=config) except (ApiException, HTTPError) as e: handle_cli_error(e, message="Could not create project `{}`.".format(name)) sys.exit(1) Printer.print_success("Project `{}` was created successfully.".format( _project.name)) if init: ctx.obj = {} ctx.invoke(init_project, project=name)