Verify Domain

Celery tasks for verifying llmclient 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, llmclient deployment status updates, and retry logic.

Main Tasks

  • verify_domain(domain_name, record_type=”A”, llmclient=None, activate_llmclient=False, hosted_zone_id=None, task_id=None):

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

Signals

  • pre_verify_domain: Sent before domain verification begins.

  • post_verify_domain: Sent after domain verification is completed.

  • llmclient_dns_verification_initiated: Sent when DNS verification is initiated.

  • llmclient_dns_failed: Sent when DNS verification fails.

  • llmclient_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 llmclient logging.

Usage

Import this module and call the Celery task as needed to asynchronously verify an llmclient domain:

verify_domain.delay(domain_name, record_type, llmclient, activate_llmclient, hosted_zone_id, task_id)

raises Exception:

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

smarter.apps.llmclient.tasks.verify_domain.verify_domain(domain_name, record_type='A', llmclient=None, activate_llmclient=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 llmclient 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”).

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

  • activate_llmclient (bool, optional) – Whether to activate the llmclient 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.

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

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

  • llmclient_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.