Delete Customization Target#

Prerequisites#

Before you can delete a customization target, make sure that you have:

  • The namespace the target belongs to.

  • The name of the target.

  • Set the CUSTOMIZER_BASE_URL environment variable to your NeMo Customizer service endpoint

export CUSTOMIZER_BASE_URL="https://your-customizer-service-url"

You can get this information for all targets by listing the available targets.

Warning

  • Deleting a target deletes all the associated files from the disk.

  • You cannot delete a target if:

    • It is currently being used by an active customization job

    • It is already in DELETING status


To Delete a Customization Target#

Choose one of the following options to delete a customization target.

import os
from nemo_microservices import NeMoMicroservices

# Initialize the client
client = NeMoMicroservices(
    base_url=os.environ['CUSTOMIZER_BASE_URL']
)

# Delete customization target
result = client.customization.targets.delete(
    target_name="llama-3.1-8b-instruct@2.0",
    namespace="meta"
)

print("Target deletion initiated")

# Check deletion status
try:
    status = client.customization.targets.retrieve(
        target_name="llama-3.1-8b-instruct@2.0",
        namespace="meta"
    )
    print(f"Target status: {status}")
except Exception as e:
    print(f"Target status check: {e}")
curl --delete "${CUSTOMIZER_BASE_URL}/customization/targets/meta/llama-3.1-8b-instruct@2.0"
Example Response
"message": "Deleting target from DB meta/llama-3.1-8b-instruct@2.0 and related files from disk"

Check the status of deleted target by using a GET request to /customization/targets/{namespace}/{name}.

# Check deletion status
try:
    status = client.customization.targets.retrieve(
        target_name="llama-3.1-8b-instruct@2.0",
        namespace="meta"
    )
    print(f"Target status: {status}")
except Exception as e:
    print(f"Target status check: {e}")
curl --get "${CUSTOMIZER_BASE_URL}/customization/targets/meta/llama-3.1-8b-instruct@2.0"
Example Response of Target Being Deleted
"Target meta/llama-3.1-8b-instruct@2.0 is currently being deleted"
Example Response of Target Failed to Delete
"Deletion failed for target meta/llama-3.1-8b-instruct@2.0, please retry deleting"

In this case, try deleting it again.

Example Response of Target Successfully Deleted
"Target meta/llama-3.1-8b-instruct@2.0 not found"

Once you have deleted the target, you can get the status by using get targets API. If the target is in tge DELETE_FAILED status, try deleting it again using this API.