(A - C)
A comprehensive list of all available functions and models available in our Python SDK.
Python SDK Reference
Utility Functions
launch_cluster
Starts a Cluster in the specified Project.
If a Cluster with the specified name already exists, we will update that Cluster. Otherwise, a new Cluster will be created.
Returns the started Cluster object.
Raises an Exception if starting Cluster fails or times out.
project_id
String
ID of the Project the Cluster belongs to
cluster_name
String
Name of the Cluster
cluster_environment_build_id
String
ID of the Cluster Environment Build to start this Cluster with
cluster_compute_id
String
ID of the Cluster Compute to start this Cluster with
poll_rate_seconds
Optional Integer
seconds to wait when polling cluster operation status; defaults to 15
idle_timeout_minutes
Optional Integer
Idle timeout (in minutes), after which the Cluster is terminated; Defaults to 120 minutes.
timeout_seconds
Optional Integer
maximum number of seconds to wait for cluster operation to complete before timing out; defaults to no timeout
Example
from anyscale import AnyscaleSDK
sdk = AnyscaleSDK(auth_token="sss_YourAuthToken")
cluster = sdk.launch_cluster(
project_id="project_id",
cluster_name="my-cluster",
cluster_environment_build_id="cluster_environment_build_id",
cluster_compute_id="cluster_compute_id")
print(f"Cluster started successfully: {cluster}")
launch_cluster_with_new_cluster_environment
Builds a new Cluster Environment, then starts a Cluster in the specified Project with the new build.
If a Cluster with the specified name already exists, we will update that Cluster. Otherwise, a new Cluster will be created.
Returns the started Cluster object.
Raises an Exception if building Cluster Environment fails or starting the Cluster fails.
project_id
String
ID of the Project the Cluster belongs to
cluster_name
String
Name of the Cluster
create_cluster_environment
CreateClusterEnvironment
CreateClusterEnvironment object
cluster_compute_id
String
Cluster Compute to start this Cluster with
poll_rate_seconds
Optional Integer
seconds to wait when polling operation status; defaults to 15
timeout_seconds
Optional Integer
maximum number of seconds to wait for operations to complete before timing out; defaults to no timeout
Example
from anyscale import AnyscaleSDK
from anyscale.sdk.anyscale_client.models.create_cluster_environment import (
CreateClusterEnvironment,
)
sdk = AnyscaleSDK(auth_token="sss_YourAuthToken")
create_cluster_environment = CreateClusterEnvironment(
name="my-cluster-environment",
config_json={"base_image": "anyscale/ray:1.4.1-py37"}
)
cluster = sdk.launch_cluster_with_new_cluster_environment(
project_id="project_id",
cluster_name="my-cluster",
create_cluster_environment=create_cluster_environment,
cluster_compute_id="cluster_compute_id",
)
print(f"Cluster started successfully: {cluster}")
build_cluster_environment
Creates a new Cluster Environment and waits for build to complete.
If a Cluster Environment with the same name already exists, this will create an updated build of that environment.
Returns the newly created ClusterEnvironmentBuild object.
Raises an Exception if building Cluster Environment fails or times out.
create_cluster_environment
CreateClusterEnvironment
CreateClusterEnvironment object
poll_rate_seconds
Optional Integer
seconds to wait when polling build operation status; defaults to 15
timeout_seconds
Optional Integer
maximum number of seconds to wait for build operation to complete before timing out; defaults to no timeout
Example
from anyscale.sdk.anyscale_client.models.create_cluster_environment import (
CreateClusterEnvironment,
)
from anyscale import AnyscaleSDK
sdk = AnyscaleSDK(auth_token="sss_YourAuthToken")
create_cluster_environment = CreateClusterEnvironment(
name="my-cluster-environment",
config_json={"base_image": "anyscale/ray:1.4.1-py37"}
)
cluster_environment_build = sdk.build_cluster_environment(
create_cluster_environment=create_cluster_environment
)
print(f"Cluster Environment built successfully: {cluster_environment_build})
fetch_job_logs
Retrieves logs for a Job.
This function may take several minutes if the Cluster this Job ran on has been terminated.
Returns the log output as a string.
Raises an Exception if fetching logs fails.
job_id
String
ID of the Job
Example
from anyscale import AnyscaleSDK
sdk = AnyscaleSDK(auth_token="sss_YourAuthToken")
job_logs = sdk.fetch_job_logs(job_id="job_id")
print(job_logs)
fetch_actor_logs
Retrieves logs for an Actor.
This function may take several minutes if the Cluster this Actor ran on has been terminated.
Returns the log output as a string.
Raises an Exception if fetching logs fails.
actor_id
String
ID of the Actor
Example
from anyscale.sdk.anyscale_client.models.create_cluster_environment import (
CreateClusterEnvironment,
)
from anyscale import AnyscaleSDK
sdk = AnyscaleSDK(auth_token="sss_YourAuthToken")
actor_logs = sdk.fetch_actor_logs(actor_id="actor_id")
print(actor_logs)
Actors
get_actor
Gets an Actor by ID.
Parameters
actor_id
str
ID of the Actor to retrieve.
Defaults to null
Returns ActorResponse
get_actor_logs
Gets an Actor's logs.
Parameters
actor_id
str
ID of the Actor to get logs for.
Defaults to null
Returns ActorlogsResponse
search_actors
Lists all Actors the user has access to, matching the input query.
Parameters
Returns ActorListResponse
Clouds
create_cloud
Creates a Cloud.
Parameters
Returns CloudResponse
delete_cloud
Deletes a Cloud.
Parameters
cloud_id
str
ID of the Cloud to delete.
Defaults to null
Returns void (empty response body)
get_cloud
Retrieves a Cloud.
Parameters
cloud_id
str
ID of the Cloud to retrieve.
Defaults to null
Returns CloudResponse
search_clouds
Searches for all accessible Clouds that satisfies the query.
Parameters
Returns CloudListResponse
update_cloud
Updates a Cloud.
Parameters
cloud_id
str
ID of the Cloud to update.
Defaults to null
Returns CloudResponse
Cluster Computes
create_cluster_compute
Creates a Cluster Compute.
Parameters
Returns ClustercomputeResponse
delete_cluster_compute
Deletes a Cluster Compute.
Parameters
cluster_compute_id
str
ID of the Cluster Compute to delete.
Defaults to null
Returns void (empty response body)
get_cluster_compute
Retrieves a Cluster Compute.
Parameters
cluster_compute_id
str
ID of the Cluster Compute to retrieve.
Defaults to null
Returns ClustercomputeResponse
search_cluster_computes
Lists all Cluster Computes the user has access to, matching the input query.
Parameters
Returns ClustercomputeListResponse
Cluster Environment Build Operations
get_cluster_environment_build_operation
Retrives a Cluster Environment Build Operation.
Parameters
cluster_environment_build_operation_id
str
ID of the Cluster Environment Build Operation to retrieve.
Defaults to null
Returns ClusterenvironmentbuildoperationResponse
Cluster Environment Builds
cancel_cluster_environment_build
Cancels a Cluster Environment Build that is still in progress. This is a long running operation.
Parameters
cluster_environment_build_id
str
ID of the Cluster Environment Build to cancel.
Defaults to null
Returns ClusterenvironmentbuildoperationResponse
create_cluster_environment_build
Creates and starts a Cluster Environment Build. This is a long running operation.
Parameters
Returns ClusterenvironmentbuildoperationResponse
delete_cluster_environment_build
Deletes a Cluster Environment Build.
Parameters
cluster_environment_build_id
str
ID of the Cluster Environment Build to delete.
Defaults to null
Returns void (empty response body)
get_cluster_environment_build
Retrieves a Cluster Environment Build.
Parameters
cluster_environment_build_id
str
ID of the Cluster Environment Build to retrieve.
Defaults to null
Returns ClusterenvironmentbuildResponse
get_cluster_environment_build_logs
Retrieves logs for a Cluster Environment Build.
Parameters
cluster_environment_build_id
str
ID of the Cluster Environment Build to retrieve logs for.
Defaults to null
Returns ClusterenvironmentbuildlogresponseResponse
list_cluster_environment_builds
Lists all Cluster Environment Builds belonging to an Cluster Environment.
Parameters
cluster_environment_id
str
ID of the Cluster Environment to list builds for.
Defaults to null
paging_token
optional str
Defaults to null
count
optional int
Defaults to 10
Returns ClusterenvironmentbuildListResponse
Cluster Environments
create_cluster_environment
Creates a Cluster Environment.
Parameters
Returns ClusterenvironmentResponse
delete_cluster_environment
Deletes a Cluster Environment.
Parameters
cluster_config_id
str
ID of the Cluster Environment to delete.
Defaults to null
Returns void (empty response body)
get_cluster_environment
Retrieves a Cluster Environment.
Parameters
cluster_environment_id
str
ID of the Cluster Environment to retrieve.
Defaults to null
Returns ClusterenvironmentResponse
search_cluster_environments
Lists all Cluster Environments that the logged in user has permissions to access.
Parameters
Returns ClusterenvironmentListResponse
Cluster Operations
get_cluster_operation
Retrieves a Cluster Operation.
Parameters
cluster_operation_id
str
ID of the Cluster Operation to retrieve.
Defaults to null
Returns ClusteroperationResponse
Clusters
create_cluster
Creates a Cluster.
Parameters
Returns ClusterResponse
delete_cluster
Deletes a Cluster.
Parameters
cluster_id
str
ID of the Cluster to delete.
Defaults to null
Returns void (empty response body)
get_cluster
Retrieves a Cluster.
Parameters
cluster_id
str
ID of the Cluster to retreive.
Defaults to null
Returns ClusterResponse
search_clusters
Searches for all Clusters the user has access to that satisfies the query.
Parameters
Returns ClusterListResponse
start_cluster
Initializes workflow to transition the Cluster into the Running state. The Cluster will be updated if Cluster Environment Build or Cluster Compute is provided in the options. This is a long running operation. Clients will need to poll the operation's status to determine completion.
Parameters
cluster_id
str
ID of the Cluster to start.
Defaults to null
Returns ClusteroperationResponse
terminate_cluster
Initializes workflow to transition the Cluster into the Terminated state. This is a long running operation. Clients will need to poll the operation's status to determine completion.
Parameters
cluster_id
str
ID of the Cluster to terminate.
Defaults to null
Returns ClusteroperationResponse
update_cluster
Updates a Cluster.
Parameters
cluster_id
str
ID of the Cluster to update.
Defaults to null
Returns ClusterResponse
Last updated
Was this helpful?