Undeploy Default API

Celery tasks for undeploying llm_client default API domains.

This module defines Celery tasks for reversing llm_client deployments by destroying the customer API default domain A record and updating deployment status.

Main Tasks

  • undeploy_default_api(llm_client_id):

    Reverses an llm_client deployment by destroying the customer API default domain A record and updating the llm_client’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 llm_client logging.

Usage

Import this module and call the Celery task as needed to asynchronously undeploy an llm_client default API domain:

undeploy_default_api.delay(llm_client_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.llm_client.tasks.undeploy_default_api.undeploy_default_api(llm_client_id)

Reverse a LLMClient deployment by destroying the customer API default domain A record for an llm_client.

This Celery task performs the following steps: 1. Sends a pre-undeploy signal for the llm_client API. 2. Logs the undeployment request. 3. Retrieves the LLMClient instance by ID. 4. Marks the llm_client as not deployed and resets DNS verification status. 5. Saves the llm_client state and sends a post-undeploy signal.

Parameters:
  • llm_client_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.