Get Result Metadata#

Retrieve detailed metadata for a specific result artifact to understand its properties before downloading.

Prerequisites#

Before you can get result metadata, make sure that you have:

  • Obtained the base URL of your NeMo Safe Synthesizer service

  • Set the SAFE_SYN_BASE_URL environment variable to your NeMo Safe Synthesizer service endpoint

  • A completed job with available results

  • The specific result_name you want to inspect

export SAFE_SYN_BASE_URL="https://your-safe-synthesizer-service-url"

Get Metadata for a Specific Result#

Retrieve detailed information about a specific result artifact, including its storage location, creation time, and properties.

import os
from nemo_microservices import NeMoMicroservices

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

# Get metadata for a specific result
job_id = "job-abc123def456"
result_name = "synthetic_data.csv"

try:
    result_metadata = client.beta.safe_synthesizer.jobs.results.retrieve(
        result_name, job_id=job_id
    )
    
    print(f"Result: {result_metadata.result_name}")
    print(f"Job ID: {result_metadata.job_id}")
    print(f"Namespace: {result_metadata.namespace}")
    print(f"Project: {result_metadata.project}")
    print(f"Created: {result_metadata.created_at}")
    print(f"Updated: {result_metadata.updated_at}")
    print(f"Storage Type: {result_metadata.artifact_storage_type}")
    print(f"Artifact URL: {result_metadata.artifact_url}")
    
    # Check if result is ready for download
    if result_metadata.artifact_url:
        print("✓ Result is ready for download")
    else:
        print("⚠ Result artifact not yet available")
        
except Exception as e:
    print(f"Error retrieving result metadata: {e}")
# Get metadata for a specific result
curl -X GET \
  "${SAFE_SYN_BASE_URL}/v1beta1/safe-synthesizer/jobs/<JOB_ID>/results/<RESULT_NAME>" \
  -H "Content-Type: application/json"

Example Response:

{
  "result_name": "synthetic_data.csv",
  "job_id": "job-abc123def456",
  "namespace": "default",
  "project": "privacy-project",
  "created_at": "2024-01-15T10:30:00Z",
  "updated_at": "2024-01-15T10:35:00Z",
  "artifact_url": "hf://default/synthetic-results/synthetic_data.csv",
  "artifact_storage_type": "nds"
}

Understanding Metadata Fields#

The result metadata provides important information about the artifact:

Field

Description

Example

result_name

Unique name identifying this result

"synthetic_data.csv"

job_id

Parent job that generated this result

"job-abc123def456"

namespace

Storage location for organization

"default"

project

Project context for the job

"privacy-project"

created_at

When the result was first created

"2024-01-15T10:30:00Z"

updated_at

Last modification timestamp

"2024-01-15T10:35:00Z"

artifact_url

Storage location for download

"hf://default/results/data.csv"

artifact_storage_type

Storage backend identifier

"nds"


Using Metadata to Plan Downloads#

The metadata helps you understand what you’re about to download:

# Determine file type from result name
result_name = result_metadata.result_name

if result_name.endswith('.csv'):
    print("Tabular data in CSV format")
elif result_name.endswith('.json'):
    print("Structured data or report in JSON format")  
elif result_name.endswith('.pdf'):
    print("Report document in PDF format")
elif result_name.endswith('.parquet'):
    print("Columnar data in Parquet format")
# Understand where the result is stored
storage_type = result_metadata.artifact_storage_type
artifact_url = result_metadata.artifact_url

if storage_type == "nds":
    print("Result stored in NeMo Data Store")
    print(f"Access path: {artifact_url}")
else:
    print(f"Result stored in {storage_type}")

Error Handling#

Common errors when retrieving result metadata:

{
  "detail": "Result not found: invalid_result_name"
}

Solution: Verify the result name exists by first listing all results for the job.

{
  "detail": "Job not found: job-invalid123"
}

Solution: Check that the job ID is correct and the job exists.

{
  "detail": "Access denied to job results"
}

Solution: Ensure you have proper permissions to access the job and its results.


Next Steps#

After retrieving result metadata, you can:

Tip

Save the artifact_url from the metadata if you need to access the result through other storage interfaces or share access with team members.