Undeploy Default API
Celery tasks for undeploying llmclient default API domains.
This module defines Celery tasks for reversing llmclient deployments by destroying the customer API default domain A record and updating deployment status.
Main Tasks
- undeploy_default_api(llmclient_id):
Reverses an llmclient deployment by destroying the customer API default domain A record and updating the llmclient’s deployment state.
Signals
pre_undeploy_default_api: Sent before undeployment of the default API begins.
post_undeploy_default_api: Sent after undeployment of the default API is completed.
Configuration
Celery task behavior (retries, backoff, queue) is controlled by smarter_settings.
Logging
Task execution and undeployment actions are logged using the smarter logging library, with waffle switches for task and llmclient logging.
Usage
Import this module and call the Celery task as needed to asynchronously undeploy an llmclient default API domain:
undeploy_default_api.delay(llmclient_id)
- raises LLMClient.DoesNotExist:
If the LLMClient with the given ID does not exist.
- raises Exception:
Any exception during task execution will trigger a retry according to Celery settings.
- smarter.apps.llmclient.tasks.undeploy_default_api.undeploy_default_api(llmclient_id)
Reverse a LLMClient deployment by destroying the customer API default domain A record for an llmclient.
This Celery task performs the following steps: 1. Sends a pre-undeploy signal for the llmclient API. 2. Logs the undeployment request. 3. Retrieves the LLMClient instance by ID. 4. Marks the llmclient as not deployed and resets DNS verification status. 5. Saves the llmclient state and sends a post-undeploy signal.
- Parameters:
llmclient_id (int) – The primary key of the LLMClient instance to be undeployed.
Signals
-------
pre_undeploy_default_api (django.dispatch.Signal) – Sent before undeployment of the default API begins.
post_undeploy_default_api (django.dispatch.Signal) – Sent after undeployment of the default API is completed.
- Raises:
LLMClient.DoesNotExist – If the LLMClient with the given ID does not exist.
Exception – Any exception raised during the undeployment process will trigger a retry according to Celery settings.