Search…
Python client

Python client

cortex

client

1
client(env: Optional[str] = None) -> Client
Copied!
Initialize a client based on the specified environment. If no environment is specified, it will attempt to use the default environment.
Arguments:
  • env - Name of the environment to use.
Returns:
Cortex client that can be used to deploy and manage APIs in the specified environment.

new_client

1
new_client(name: str, operator_endpoint: str) -> Client
Copied!
Create a new environment to connect to an existing cluster, and initialize a client to deploy and manage APIs on that cluster.
Arguments:
  • name - Name of the environment to create.
  • operator_endpoint - The endpoint for the operator of your Cortex cluster. You can get this endpoint by running the CLI command cortex cluster info.
Returns:
Cortex client that can be used to deploy and manage APIs on a cluster.

env_list

1
env_list() -> List
Copied!
List all environments configured on this machine.

env_delete

1
env_delete(name: str)
Copied!
Delete an environment configured on this machine.
Arguments:
  • name - Name of the environment to delete.

cortex.client.Client

deploy

1
| deploy(api_spec: Dict[str, Any], force: bool = True, wait: bool = False)
Copied!
Deploy or update an API.
Arguments:
  • api_spec - A dictionary defining a single Cortex API. See https://docs.cortex.dev/v/0.42/ for schema.
  • force - Override any in-progress api updates.
  • wait - Block until the API is ready.
Returns:
Deployment status, API specification, and endpoint for each API.

deploy_from_file

1
| deploy_from_file(config_file: str, force: bool = False, wait: bool = False) -> Dict
Copied!
Deploy or update APIs specified in a configuration file.
Arguments:
  • config_file - Local path to a yaml file defining Cortex API(s). See https://docs.cortex.dev/v/0.42/ for schema.
  • force - Override any in-progress api updates.
  • wait - Block until the API is ready.
Returns:
Deployment status, API specification, and endpoint for each API.

get_api

1
| get_api(api_name: str) -> Dict
Copied!
Get information about an API.
Arguments:
  • api_name - Name of the API.
Returns:
Information about the API, including the API specification, endpoint, status, and metrics (if applicable).

list_apis

1
| list_apis() -> List
Copied!
List all APIs in the environment.
Returns:
List of APIs, including information such as the API specification, endpoint, status, and metrics (if applicable).

get_job

1
| get_job(api_name: str, job_id: str) -> Dict
Copied!
Get information about a submitted job.
Arguments:
  • api_name - Name of the Batch/Task API.
  • job_id - Job ID.
Returns:
Information about the job, including the job status, worker status, and job progress.

refresh

1
| refresh(api_name: str, force: bool = False)
Copied!
Restart all of the replicas for a Realtime API without downtime.
Arguments:
  • api_name - Name of the API to refresh.
  • force - Override an already in-progress API update.

delete

1
| delete(api_name: str, keep_cache: bool = False)
Copied!
Delete an API.
Arguments:
  • api_name - Name of the API to delete.
  • keep_cache - Whether to retain the cached data for this API.

stop_job

1
| stop_job(api_name: str, job_id: str, keep_cache: bool = False)
Copied!
Stop a running job.
Arguments:
  • api_name - Name of the Batch/Task API.
  • job_id - ID of the Job to stop.
Last modified 15d ago