Class: Protege::ApplicationJob

Inherits:
ActiveJob::Base
  • Object
show all
Defined in:
app/jobs/protege/application_job.rb

Overview

Abstract base class for every Active Job in the Protege engine.

Both InferenceJob and ConsoleInferenceJob inherit from this class rather than ActiveJob::Base directly, matching the host-app convention of an ApplicationJob base. It provides a single place to configure cross-cutting job behaviour — retry policy, queue adapter selection, and around-perform callbacks — so individual jobs stay focused on their own work.

Failure policy

Inference can fail for two very different reasons, and they are handled differently:

  • Protege::Error::TRANSIENT are provider hiccups that a later attempt may clear (rate limits, timeouts, outages). These are retried with polynomial backoff.
  • Protege::Error::PERMANENT cannot be fixed by retrying — a malformed request, bad credentials, an unknown model/capability, an unparseable response (plus a vanished record). Retrying only wastes work, so these are discarded after the job has recorded the failure.

Any other error falls through to the queue adapter's default handling (no retry), still recorded on the message by each job's own rescue.