Job Logs and Retry Management Guide

The Job Logs feature in NextGenAiAssistant allows you to monitor and manage the various jobs that run in the background to process content generation tasks, updates, and other operations related to AI assistants. Job logs are essential for tracking the status of each task, diagnosing errors, and ensuring that all processes run smoothly.

In this guide, we’ll cover how to access job logs, understand the different types of logs, and retry failed jobs when needed.


What are Job Logs?

Job Logs record the activity of each job or task executed by the module, such as processing AI requests, updating product data, or managing backups. Each log entry provides information about the job’s status and any errors that might have occurred, allowing you to:

  • Verify that all jobs have completed successfully.
  • Troubleshoot errors if any job fails.
  • Identify patterns in job performance or failures.

Job logs are categorized by job type, including processing, updating, and backup-related tasks.


Accessing Job Logs

NextGenAiAssistant provides two ways to view and manage job logs, allowing you to monitor tasks efficiently. Whether you want to see logs for a specific product or review all jobs across your store, the system offers flexibility in log management.


1. Viewing Job Logs for a Specific Product

If you want to review logs related to a particular product:

  • Navigate to the Product Edit Page:
    • Go to the product’s edit page in PrestaShop.
    • Open the AI Assistant – Job Logs tab specific to that product.
  • What You’ll See:
    • This view shows logs for all jobs related to the selected product, such as content generation, updates, or backups.
    • It’s useful for quickly diagnosing issues or reviewing the history of tasks for that particular product.

2. Viewing All Job Logs in the Module Interface

For a broader view of all job logs across your store:

  • Navigate to the Global Job Logs Page:
    • In the PrestaShop admin panel, go to AI Assistant > Job Logs from the module menu.
  • What You’ll See:
    • A complete list of all recent jobs, regardless of the product or category they are associated with.
    • Details include:
      • Job ID: A unique identifier for each job.
      • Job Type: The type of task, such as “Content Generation,” “Backup,” or “Update.”
      • Status: Indicates whether the job completed successfully, is still in progress, or failed.
      • Timestamp: Shows when the job was executed.
      • Tries: Displays how many times the job has been attempted. By default, each job is retried up to 3 times if it fails, unless otherwise configured in the cron settings.
  • Filtering Options:
    • Use filters to refine your search:
      • Job Type: Filter by task type, like “Backup” or “Content Generation.”
      • Status: View jobs by status, such as “Failed,” “Completed,” or “Pending.”
      • Date Range: Narrow down to jobs executed within a specific time frame.
      • Entity Type and Entity ID:
        • Entity Type lets you specify whether the job is related to a product, category, or another type of record.
        • Entity ID allows you to search for jobs tied to a specific product, category, or entity by its unique ID. For example, selecting Product as the Entity Type and entering 123 in Entity ID will display all jobs related to Product ID 123.

This global view is ideal for administrators who want to monitor and manage tasks across the entire store.


Understanding Job Statuses

Each job has a status that provides insight into its current state:

  • Completed: The job finished successfully, and the associated task (e.g., content generation or backup) has been applied as expected.
  • Pending: The job is queued and waiting to be processed by the system.
  • In Progress: The job is currently being executed.
  • Failed: The job encountered an error and did not complete successfully. This status usually includes an error message or code to help diagnose the issue.

Retrying Failed Jobs

If a job fails, you have the option to Retry it directly from the job logs. Retrying a job can help resolve temporary issues, such as network errors or server overload, without needing to restart the entire process.

To retry a failed job:

  1. In the Job Logs tab, locate the failed job entry.
  2. Click the Retry button next to the job. This action will reinitiate the job and attempt to complete the task again.

When to Use the Retry Feature

  • Temporary Errors: Retry the job if the failure was due to a temporary issue, such as a network glitch.
  • Validation Failures: Sometimes, content may fail validation due to format issues or data inconsistencies. Correct the data if needed and then retry the job.
  • Backup or Update Failures: If a backup or update job fails, retrying can ensure that the changes are successfully applied without losing data.

Note: Retrying jobs that have failed multiple times may increase processing costs, especially if the job repeatedly encounters errors. Only retry jobs after reviewing the error details to ensure that the issue can potentially be resolved by re-executing the job.


Job Preview and Detailed Logs

The Job Preview feature provides a comprehensive overview of each job’s execution. By clicking the Preview button in the job logs, you can access detailed information, including:

  • Job ID and Job Name for identification.
  • Status and Tries to monitor the job’s progress and retry attempts.
  • Timestamps: Created At, Started At, and Completed At to track the job’s lifecycle.
  • Related Entities: Displays the type and ID of the entity (e.g., Product or Category) associated with the job.

Error Logs and Debug Information

If the job encountered any issues:

  • The Error Logs section will display any captured exceptions or error messages, helping you diagnose the problem.

Additionally, if the module is operating in debug mode, it records detailed logs of the API communication. This includes all requests and responses exchanged with the AI model, providing deeper insights into the job’s execution and any potential issues.

These logs are invaluable for troubleshooting and optimizing the interaction between your store and the AI, ensuring smooth and efficient content generation.


Job Logs for Troubleshooting and Monitoring

Job logs are a valuable resource for ongoing monitoring and troubleshooting. Regularly reviewing logs can help you identify recurring issues, optimize job performance, and ensure a smoother experience with the AI module.

Best Practices:

  • Review Logs Regularly: Regularly check logs to detect and resolve issues early, particularly after large batch jobs or mass content generation actions.
  • Use Filters: Apply filters to quickly find failed jobs, specific job types, or any entries within a given timeframe.
  • Understand Error Messages: Review error details for failed jobs before retrying to prevent repeated failures and unnecessary retries.

Job Logs Clearing

To maintain optimal database performance, it’s recommended to periodically clear the following tables:

  1. ps_next_gen_ai_assistant_logs:
    This table stores logs related to the module’s operations. It is safe to clear all entries in this table as they do not affect the module’s functionality. Logs are primarily used for debugging and can be deleted when no longer needed.
  2. ps_next_gen_ai_assistant_jobs_failed:
    This table stores records of failed jobs. Clearing this table is safe and recommended after resolving any issues that caused the failures, as these entries are no longer needed once addressed.
  3. ps_next_gen_ai_assistant_jobs:
    This table contains job entries for tasks executed by the module. When clearing this table, avoid deleting jobs with the statuses queued or processing, as these are active or pending tasks. Instead, clear jobs with completed or failed statuses, ensuring you don’t interrupt ongoing operations.

By following these guidelines, you can free up space in your database without disrupting the workflow of the NextGenAiAssistant module.


By effectively managing Job Logs and utilizing the Retry feature, you can maintain the reliability of the AI-powered content generation processes in your store. This guide ensures that you have the tools to monitor, troubleshoot, and resolve any issues with the jobs that power NextGenAiAssistant, helping you maintain smooth and accurate content generation workflows.

How can we help?