Skip to main content


Project Context

From Anyscale CLI release 0.5.4 onwards, project contexts will be deprecated. Project contexts will continue to work for the next few months, and we plan to remove this functionality in April 2022. This deprecation affects CLI commands and calls to Anyscale Ray Client. Warning messages with migration instructions will be printed for the affected commands if a project context is currently used.

Migration Instructions

Creating Projects

anyscale project init was previously used to create projects for an Anyscale user account, or attach a local project directory to an Anyscale project. This command would make sure the .anyscale.yaml file was correctly created and formatted so a project context could be defined for the local directory.

Going forward, anyscale project init will be deprecated and anyscale project create can be used to create a project in Anyscale. anyscale project create will not set any state that allows commands to execute in the project context, so the project information should either be specified through the command arguments or through the ANYSCALE_PROJECT_NAME environment variable.

CLI Commands

Some of the CLI commands like anyscale cluster start and anyscale job submit interact with a project. Previously, if the directory these commands were run in contained a project context through the .anyscale.yaml file, the command would be executed using that project.

The project information should now be specified to these commands through the --project-id or --project-name arguments, or the ANYSCALE_PROJECT_NAME environment variable. For example:

$ anyscale cluster start --project-id prj_fBKGnY6s8XnpGMQ1AxpFv22G
$ ANYSCALE_PROJECT_NAME="my_project" anyscale cluster start

For anyscale job submit and anyscale service deploy, the project information can be specified in the configuration yaml file with the project_id field. If ANYSCALE_PROJECT_NAME is set, it will override the value in the configuration file.

The commands will run without a project if the project information is not provided by the user.

Anyscale Ray Client

As is the case with the CLI, the project context was previously used in Anyscale Ray Client to determine which cluster to connect to.

The project can now be specified in the connection string URL with the following syntax:

# Connects and/or starts my_cluster in my_project.

# Connects and/or starts my_cluster in the project specified by ANYSCALE_PROJECT_NAME.
# If the environment variable isn't set, my_cluster is not grouped by project.

# Starts and connects to a cluster with an autogenerated name in my_project.

# Starts and connects to a cluster with an autogenerated name in the project specified by ANYSCALE_PROJECT_NAME.
# If the environment variable isn't set, the cluster is not grouped by project.

project_dir argument for Anyscale Ray Client

From Anyscale release 0.4.38 onwards, the project_dir argument for Anyscale Ray Client will be deprecated. The project directory can still be specified through this argument, but this functionality will be removed in April 2022. Migration instructions will be shown if project_dir is specified.

Migration Instructions

Local files will only be uploaded if the working_dir argument is provided in a runtime_env when connecting to the cluster. For example:

ray.init("anyscale://...", runtime_env={"working_dir": directory}, ...)

The working_dir doesn't affect the project of the cluster that is being connected to. This is specified instead by providing the project name in the connection string or in the ANYSCALE_PROJECT_NAME environment variable.