Vectorstore Deployment
The progress of a Vectorstore’s deploy: its conditions, its attempts, and its last error.
Creating a vector database takes minutes: Pinecone initializes a new index, and a self-hosted
Qdrant server needs a volume, an image and a pod that starts. Each of those can fail on its own,
and most failures are temporary. So deploy only checks what it can check at once, e.g. that
Pinecone accepts the api key, and queues the Celery task
deploy_vectorstore(), which checks the database again every
DEPLOY_CHECK_INTERVAL seconds, backs off after an error, and gives up after
DEPLOY_MAX_ATTEMPTS checks.
VectorstoreDeploymentState is what the task records, in the Vectorstore’s deployment
column. The Vectorstore manifest’s status and the REST api’s vectorstore show it, so that a
person, or the web console, can follow a deploy: which conditions are met, which attempt it is
on, when it checks again, and why the last attempt failed.
- smarter.apps.vectorstore.deployment.CONDITION_ORDER: tuple[Literal['Credentials', 'Volume', 'Server', 'Index'], ...] = ('Credentials', 'Volume', 'Server', 'Index')
The conditions in the order that a deploy meets them, which is the order that they are shown.
('Credentials', 'Volume', 'Server', 'Index')
- smarter.apps.vectorstore.deployment.DEPLOY_CHECK_INTERVAL = 15
Seconds between the checks of a deploy that is waiting, e.g. for a server to start.
- smarter.apps.vectorstore.deployment.DEPLOY_MAX_ATTEMPTS = 80
The checks that a deploy makes before it fails, about 20 minutes of waiting.
- smarter.apps.vectorstore.deployment.DEPLOY_MAX_BACKOFF = 300
the wait doubles after each error in a row, up to this.
- Type:
The longest wait, in seconds, after errors
- smarter.apps.vectorstore.deployment.DEPLOY_STALLED_AFTER = datetime.timedelta(seconds=600)
A deploy whose next check is this late lost its Celery task, and Celery Beat’s reconcile takes it over.
- class smarter.apps.vectorstore.deployment.VectorstoreDeploymentState(**data)[source]
Bases:
BaseModelThe progress of a Vectorstore’s last deploy, as the deploy task records it.
It is stored as JSON in
VectorstoreMeta.deployment. Read it withof(), and save it withsave_to().- backoff()[source]
Return the seconds to wait before the next check.
It is
DEPLOY_CHECK_INTERVALwhile the deploy is only waiting, and doubles with each error in a row, up toDEPLOY_MAX_BACKOFF.- Return type:
- condition(condition_type)[source]
Return a condition.
- Parameters:
condition_type (
str) – Its type, e.g.Index.- Return type:
- Returns:
The condition, or None if it hasn’t been recorded.
- conditions: List[SAMVectorstoreCondition]
- is_stalled(now=None)[source]
Whether a deploy in progress lost its Celery task: its next check is long overdue.
- Parameters:
- Return type:
- Returns:
True if the deploy’s next check is later than
DEPLOY_STALLED_AFTER.
- model_config = {}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- classmethod of(vectorstore)[source]
Return a Vectorstore’s deployment state.
- Parameters:
vectorstore (
VectorstoreMeta) – The Vectorstore.- Return type:
- Returns:
Its state, or an empty one if it was never deployed.
- save_to(vectorstore)[source]
Save the state on a Vectorstore.
- Parameters:
vectorstore (
VectorstoreMeta) – The Vectorstore.- Return type:
- set_condition(condition_type, status, reason='', message='')[source]
Record a condition.
Its
lastTransitionTimechanges only when its status changes, as in Kubernetes, so that it says how long a condition has been what it is.- Parameters:
- Return type:
- Returns:
The condition.