Get Job Logs#
Get logs from a NeMo Safe Synthesizer job to track progress and troubleshoot issues.
Prerequisites#
Before you can get logs from a NeMo Safe Synthesizer job, 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
export SAFE_SYN_BASE_URL="https://your-safe-synthesizer-service-url"
To Get Logs from a NeMo Safe Synthesizer Job#
Choose one of the following options to get logs from a NeMo Safe Synthesizer job.
import os
from nemo_microservices import NeMoMicroservices
# Initialize the client
client = NeMoMicroservices(
base_url=os.environ['SAFE_SYN_BASE_URL']
)
# Get job logs (returns paginated response)
job_id = "job-abc123def456"
logs_response = client.beta.safe_synthesizer.jobs.get_logs(job_id)
print(f"Logs for job {job_id}:")
# The response is a generic object, so you'll need to handle it based on the actual structure
print(logs_response)
JOB_ID="job-abc123def456"
# Get logs
curl -X GET \
"${SAFE_SYN_BASE_URL}/v1beta1/safe-synthesizer/jobs/${JOB_ID}/logs"
Example Response
{
"data": [
{
"id": 1,
"job_id": "job-abc123def456",
"job_step": "initialization",
"job_task": "setup",
"message": "Starting NeMo Safe Synthesizer job job-abc123def456",
"timestamp": "2025-01-10T10:30:00Z"
},
{
"id": 2,
"job_id": "job-abc123def456",
"job_step": "processing",
"job_task": "pii_detection",
"message": "Initializing PII detection pipeline",
"timestamp": "2025-01-10T10:30:15Z"
}
],
"next_page": "cursor_abc123",
"prev_page": "",
"total": 25,
"object": "platform_job_log_page"
}
Typical Response Structure#
The logs endpoint returns a JSON object. The current SDK returns a generic object for this endpoint and the schema may evolve. Typically, the response contains structured log entries similar to the following. Each log entry includes:
id: Unique identifier for the log entry
job_id
: The job identifierjob_step
: The job step that generated the logjob_task
: The specific task within the job stepmessage: The log message content
timestamp: The log entry creation time
Pagination#
When pagination is present, common fields include:
data: Array of log entries for the current page
next_page
: Cursor for the next page of results (empty if no more pages)prev_page
: Cursor for the previous page of resultstotal: Total number of log entries available