Skip to content

Information

This description file relates to method create_reindex_task.

Documentation for create_reindex_task

Functionality

Creates or reuses a reindex task based on the provided request body. It checks for an existing task and, if absent, creates a new one. The task is then sent to a worker and its details are returned.

Parameters

  • body (ReindexTaskRunRequest): The input request containing task data. It may include an optional task_id for deduplication.

Usage

  • Purpose: To initiate a reindex task within the application. If a task with the given ID exists, it is reused. Otherwise, a new task is created. On failure, an HTTP 500 error is raised.

Example

from embedding_studio.api.api_v1.internal_endpoints.reindex 
    import create_reindex_task
from embedding_studio.api.api_v1.internal_schemas.reindex 
    import ReindexTaskRunRequest

body = ReindexTaskRunRequest(task_id="optional_id", other_field="value")
task_response = create_reindex_task(body)
print(task_response)