ray.serve.schema.TaskProcessorAdapter#

class ray.serve.schema.TaskProcessorAdapter(*args, **kwargs)[source]#

Bases: ABC

Abstract base class for task processing adapters.

Subclasses can support different combinations of sync and async operations. Use supports_async_capability() to check if a specific async operation is supported.

PublicAPI (alpha): This API is in alpha and may change before becoming stable.

Methods

__init__

Initialize the TaskProcessorAdapter.

cancel_task_async

Cancel a task.

cancel_task_sync

Cancel a task synchronously.

enqueue_task_async

Enqueue a task asynchronously.

enqueue_task_sync

Enqueue a task for execution synchronously.

get_metrics_async

Get metrics asynchronously.

get_metrics_sync

Get metrics synchronously.

get_task_status_async

Get task status asynchronously.

get_task_status_sync

Retrieve the current status of a task synchronously.

health_check_async

Perform health check asynchronously.

health_check_sync

Perform health check synchronously.

initialize

Initialize the task processor.

register_task_handle

Register a function as a task handler.

shutdown

Shutdown the task processor and clean up resources.

start_consumer

Start the task consumer/worker process.

stop_consumer

Stop the task consumer gracefully.