Skip to content

Handle Job.DoesNotExist exception properly in process_source_images_async #1061

@coderabbitai

Description

@coderabbitai

Problem Description

In ami/ml/tasks.py, the process_source_images_async function catches Job.DoesNotExist exceptions but doesn't reset job_id to None. This means the invalid job_id is passed to downstream functions (process_images() and save_results()), which could cause errors.

Additionally, the exception handler uses logger.error() instead of logger.exception(), which means the full traceback is not captured for debugging.

Context

Expected Behavior

When a Job.DoesNotExist exception occurs:

  1. The job_id variable should be set to None to prevent passing an invalid ID downstream
  2. The full exception traceback should be logged using logger.exception() for debugging

Requested by: @mihow

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions