Skip to main content

Project API Reference

Customer-hosted cloud features

note

Some features are only available on customer-hosted clouds. Reach out to support@anyscale.com for info.

Project CLI

anyscale project add-collaborators

Usage

anyscale project add-collaborators [OPTIONS]

Add collaborators to the project.

Options

  • --cloud/-c: Name of the cloud that the project belongs to.
  • --project/-p: Name of the project to add collaborators to.
  • --users-file: Path to a YAML file containing a list of users to add to the project.

Examples

$ anyscale project add-collaborators --cloud cloud_name --project project_name --users-file collaborators.yaml
(anyscale +1.3s) Successfully added 3 collaborators to project project_name.
$ cat collaborators.yaml
collaborators:
- email: "test1@anyscale.com"
permission_level: "write"
- email: "test2@anyscale.com"
permission_level: "readonly"
- email: "test3@anyscale.com"
permission_level: "owner"

Project SDK

anyscale.project.add_collaborators

Batch add collaborators to a project.

Arguments

  • cloud (str): The cloud that the project belongs to.
  • project (str): The project to add users to.
  • collaborators (List[CreateProjectCollaborator]): The list of collaborators to add to the project.

Returns: str

Examples

import anyscale
from anyscale.project.models import CreateProjectCollaborator, ProjectPermissionLevel

anyscale.project.add_collaborators(
cloud="cloud_name",
project="project_name",
collaborators=[
CreateProjectCollaborator(
email="test1@anyscale.com",
permission_level=ProjectPermissionLevel.OWNER,
),
CreateProjectCollaborator(
email="test2@anyscale.com",
permission_level=ProjectPermissionLevel.WRITE,
),
CreateProjectCollaborator(
email="test3@anyscale.com",
permission_level=ProjectPermissionLevel.READONLY,
),
],
)

Project Models

ProjectPermissionLevel

An enumeration.

Values

  • OWNER: Owner permission level for the project
  • WRITE: Write permission level for the project
  • READONLY: Readonly permission level for the project

CreateProjectCollaborator

User to be added as a collaborator to a project.

Fields

  • email (str): Email of the user to be added as a collaborator.
  • permission_level (ProjectPermissionLevel): Permission level the added user should have for the project(one of: OWNER,WRITE,READONLY

Python Methods

def to_dict(self) -> Dict[str, Any]
"""Return a dictionary representation of the model."""

Examples

import anyscale
from anyscale.project.models import ProjectPermissionLevel, CreateProjectCollaborator
create_project_collaborator = CreateProjectCollaborator(
# Email of the user to be added as a collaborator
email="test@anyscale.com",
# Permission level for the user to the project (ProjectPermissionLevel.OWNER, ProjectPermissionLevel.WRITE, ProjectPermissionLevel.READONLY)
permission_level=ProjectPermissionLevel.READONLY,
)

Project CLI Legacy

anyscale project create Legacy

Limited support

This command is not actively maintained. Use with caution.

Usage

anyscale project create [OPTIONS]

Create a new project.

Options

  • --name/-n: Project name.
  • --parent-cloud-id: Cloud id that this project is associated with. This argument is only relevant if cloud isolation is enabled.

anyscale project list Legacy

Limited support

This command is not actively maintained. Use with caution.

Usage

anyscale project list [OPTIONS]

List projects for which you have access. By default, only projects created by you are listed.

Options

  • --name/-n: List information for a particular project.
  • --json: Format output as JSON.
  • --any-creator/-a: [Deprecated] List projects created by any user.
  • --created-by-me: List projects created by me only.
  • --max-items: Max items to show in list.

Project SDK Legacy

The AnyscaleSDK class must be constructed in order to make calls to the SDK. This class allows you to create an authenticated client in which to use the SDK.

ParamTypeDescription
auth_tokenOptional StringAuthentication token used to verify you have permissions to access Anyscale. If not provided, permissions default to the credentials set for your current user. Credentials can be set by following the instructions on this page: https://console.anyscale.com/credentials

Example

from anyscale import AnyscaleSDK

sdk = AnyscaleSDK()

create_project Legacy

Limited support

This command is not actively maintained. Use with caution.

Creates a Project.

Parameters

NameTypeDescriptionNotes
create_projectCreateProject

Returns ProjectResponse

delete_project Legacy

Limited support

This command is not actively maintained. Use with caution.

Deletes a Project.

Parameters

NameTypeDescriptionNotes
project_idstrID of the Project to delete.Defaults to null

Returns void (empty response body)

get_default_project Legacy

Limited support

This command is not actively maintained. Use with caution.

Retrieves the default project.

Parameters

NameTypeDescriptionNotes
parent_cloud_idoptional strCloud to fetch this default project for. This is only required if cloud isolation is enabled.Defaults to null

Returns ProjectResponse

get_project Legacy

Limited support

This command is not actively maintained. Use with caution.

Retrieves a Project.

Parameters

NameTypeDescriptionNotes
project_idstrID of the Project to retrieve.Defaults to null

Returns ProjectResponse

search_projects Legacy

Limited support

This command is not actively maintained. Use with caution.

Searches for all Projects the user has access to that satisfies the query.

Parameters

NameTypeDescriptionNotes
projects_queryProjectsQuery

Returns ProjectListResponse

update_project Legacy

Limited support

This command is not actively maintained. Use with caution.

Updates a Project.

Parameters

NameTypeDescriptionNotes
project_idstrID of the Project to update.Defaults to null
update_projectUpdateProject

Returns ProjectResponse

Project Models Legacy

CreateProject Legacy

Model used to create a Project.

NameTypeDescriptionNotes
namestrName of the Project to be created.[default to null]
cluster_configstrCluster config associated with the Project. This can later be used to start a Session. Default will be used if not provided.[optional] [default to null]
descriptionstrDescription of Project.[optional] [default to null]
parent_cloud_idstrCloud that all resources in this project should be scoped to.[optional] [default to null]

Project Legacy

Model used to read a Project.

NameTypeDescriptionNotes
namestrName of the Project to be created.[default to null]
cluster_configstrCluster config associated with the Project. This can later be used to start a Session.[default to null]
descriptionstrDescription of Project.[optional] [default to null]
parent_cloud_idstrCloud that all resources in this project should be scoped to.[optional] [default to null]
idstrServer assigned unique identifier of the Project.[default to null]
creator_idstrIdentifier of user who created the Project.[optional] [default to null]
created_atdatetimeTime at which Project was created.[default to null]
organization_idstrOrganization that the Project is associated with.[default to null]
last_used_cloud_idstrID of the last cloud used in this project, or by the user if this is a new project.[optional] [default to null]
is_defaultboolTrue if this project is the default project for the organization.[default to null]
directory_namestrDirectory name of project to be used as working directory of clusters.[default to null]
active_sessionsintDEPRECATED. Number of active sessions for this project.[optional] [default to 0]
last_activity_atdatetimeDEPRECATED. The most recent activity for this project. This is based on the most recently created sessions[optional] [default to null]

ProjectListResponse Legacy

A list response form the API. Contains a field "results" which has the contents of the response.

NameTypeDescriptionNotes
resultsList[Project][default to null]
metadataListResponseMetadata[optional] [default to null]

ProjectResponse Legacy

A response from the API. Contains a field "result" which has the contents of the response.

NameTypeDescriptionNotes
resultProject[default to null]

ProjectsQuery Legacy

Query model used to filter Projects. It is used in the SDK.

NameTypeDescriptionNotes
nameTextQueryFilters Projects by name. If this field is absent, no filtering is done.[optional] [default to null]
creator_idTextQueryFilters Projects by creator_id. If this field is absent, no filtering is done.[optional] [default to null]
pagingPageQueryPagination information.[optional] [default to null]
parent_cloud_idTextQueryFilters Projects by parent_cloud_id. If this field is absent, no filtering is done.[optional] [default to null]
include_defaultsboolWhether to include default projects in the results.[optional] [default to true]

UpdateProject Legacy

Model for updating a Project. A field will not be updated if its value is absent.

NameTypeDescriptionNotes
cluster_configstrNew cluster config to apply to the Project on update action.[optional] [default to null]
descriptionstrNew description to update in the Project.[optional] [default to null]