Verify Domain

Celery tasks for verifying llm_client domain DNS records.

This module defines Celery tasks for verifying that Internet domain names resolve to the expected DNS records (NS or other), including signal handling, llm_client deployment status updates, and retry logic.

Main Tasks

  • verify_domain(domain_name, record_type=”A”, llm_client=None, activate_llm_client=False, hosted_zone_id=None, task_id=None):

    Attempts to verify that a domain name resolves to the expected DNS records, updating llm_client deployment status and sending verification signals.

Signals

  • pre_verify_domain: Sent before domain verification begins.

  • post_verify_domain: Sent after domain verification is completed.

  • llm_client_dns_verification_initiated: Sent when DNS verification is initiated.

  • llm_client_dns_failed: Sent when DNS verification fails.

  • llm_client_dns_verified: Sent when DNS verification succeeds.

Configuration

Celery task behavior (retries, backoff, queue) is controlled by smarter_settings.

Logging

Task execution, verification attempts, and results 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 verify an llm_client domain:

verify_domain.delay(domain_name, record_type, llm_client, activate_llm_client, hosted_zone_id, task_id)

raises Exception:

Any exception during task execution will trigger a retry according to Celery settings.

smarter.apps.llm_client.tasks.verify_domain.verify_domain(domain_name, record_type='A', llm_client=None, activate_llm_client=False, hosted_zone_id=None, task_id=None)

Verify that an Internet domain name resolves to NS records.

This Celery task attempts to verify that a domain name resolves to the expected DNS records (NS or other), sending verification signals and updating llm_client deployment status as appropriate. It retries verification multiple times, logging each attempt and result.

Return type:

bool

Parameters:
  • domain_name (str) – The domain name to verify.

  • record_type (str, optional) – The DNS record type to verify (default is “A”).

  • llm_client (LLMClient, optional) – The LLMClient instance associated with the domain, if any.

  • activate_llm_client (bool, optional) – Whether to activate the llm_client upon successful verification. Default is False.

  • hosted_zone_id (str, optional) – The AWS Route53 hosted zone ID to use for DNS lookups.

  • task_id (str, optional) – The Celery task ID for logging and signal purposes.

Returns:

  • bool – True if the domain is successfully verified, False otherwise.

  • Signals

  • ——-

  • pre_verify_domain (django.dispatch.Signal) – Sent before domain verification begins.

  • post_verify_domain (django.dispatch.Signal) – Sent after domain verification is completed.

  • llm_client_dns_verification_initiated (django.dispatch.Signal) – Sent when DNS verification is initiated.

  • llm_client_dns_failed (django.dispatch.Signal) – Sent when DNS verification fails.

  • llm_client_dns_verified (django.dispatch.Signal) – Sent when DNS verification succeeds.

Raises:

Exception – Any exception raised during the verification process will trigger a retry according to Celery settings.