Project API Reference
Customer-hosted cloud features
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
- CLI
$ 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
- Python
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 projectWRITE
: Write permission level for the projectREADONLY
: 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
- Python
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
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
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.
Param | Type | Description |
---|---|---|
auth_token | Optional String | Authentication 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
This command is not actively maintained. Use with caution.
Creates a Project.
Parameters
Name | Type | Description | Notes |
---|---|---|---|
create_project | CreateProject |
Returns ProjectResponse
delete_project
Legacy
This command is not actively maintained. Use with caution.
Deletes a Project.
Parameters
Name | Type | Description | Notes |
---|---|---|---|
project_id | str | ID of the Project to delete. | Defaults to null |
Returns void (empty response body)
get_default_project
Legacy
This command is not actively maintained. Use with caution.
Retrieves the default project.
Parameters
Name | Type | Description | Notes |
---|---|---|---|
parent_cloud_id | optional str | Cloud to fetch this default project for. This is only required if cloud isolation is enabled. | Defaults to null |
Returns ProjectResponse
get_project
Legacy
This command is not actively maintained. Use with caution.
Retrieves a Project.
Parameters
Name | Type | Description | Notes |
---|---|---|---|
project_id | str | ID of the Project to retrieve. | Defaults to null |
Returns ProjectResponse
search_projects
Legacy
This command is not actively maintained. Use with caution.
Searches for all Projects the user has access to that satisfies the query.
Parameters
Name | Type | Description | Notes |
---|---|---|---|
projects_query | ProjectsQuery |
Returns ProjectListResponse
update_project
Legacy
This command is not actively maintained. Use with caution.
Updates a Project.
Parameters
Name | Type | Description | Notes |
---|---|---|---|
project_id | str | ID of the Project to update. | Defaults to null |
update_project | UpdateProject |
Returns ProjectResponse
Project Models Legacy
CreateProject
Legacy
Model used to create a Project.
Name | Type | Description | Notes |
---|---|---|---|
name | str | Name of the Project to be created. | [default to null] |
cluster_config | str | Cluster 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] |
description | str | Description of Project. | [optional] [default to null] |
parent_cloud_id | str | Cloud that all resources in this project should be scoped to. | [optional] [default to null] |
Project
Legacy
Model used to read a Project.
Name | Type | Description | Notes |
---|---|---|---|
name | str | Name of the Project to be created. | [default to null] |
cluster_config | str | Cluster config associated with the Project. This can later be used to start a Session. | [default to null] |
description | str | Description of Project. | [optional] [default to null] |
parent_cloud_id | str | Cloud that all resources in this project should be scoped to. | [optional] [default to null] |
id | str | Server assigned unique identifier of the Project. | [default to null] |
creator_id | str | Identifier of user who created the Project. | [optional] [default to null] |
created_at | datetime | Time at which Project was created. | [default to null] |
organization_id | str | Organization that the Project is associated with. | [default to null] |
last_used_cloud_id | str | ID of the last cloud used in this project, or by the user if this is a new project. | [optional] [default to null] |
is_default | bool | True if this project is the default project for the organization. | [default to null] |
directory_name | str | Directory name of project to be used as working directory of clusters. | [default to null] |
active_sessions | int | DEPRECATED. Number of active sessions for this project. | [optional] [default to 0] |
last_activity_at | datetime | DEPRECATED. 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.
Name | Type | Description | Notes |
---|---|---|---|
results | List[Project] | [default to null] | |
metadata | ListResponseMetadata | [optional] [default to null] |
ProjectResponse
Legacy
A response from the API. Contains a field "result" which has the contents of the response.
Name | Type | Description | Notes |
---|---|---|---|
result | Project | [default to null] |
ProjectsQuery
Legacy
Query model used to filter Projects. It is used in the SDK.
Name | Type | Description | Notes |
---|---|---|---|
name | TextQuery | Filters Projects by name. If this field is absent, no filtering is done. | [optional] [default to null] |
creator_id | TextQuery | Filters Projects by creator_id. If this field is absent, no filtering is done. | [optional] [default to null] |
paging | PageQuery | Pagination information. | [optional] [default to null] |
parent_cloud_id | TextQuery | Filters Projects by parent_cloud_id. If this field is absent, no filtering is done. | [optional] [default to null] |
include_defaults | bool | Whether 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.
Name | Type | Description | Notes |
---|---|---|---|
cluster_config | str | New cluster config to apply to the Project on update action. | [optional] [default to null] |
description | str | New description to update in the Project. | [optional] [default to null] |