Class: Observ::DatasetRunnerJob
- Inherits:
-
ApplicationJob
- Object
- ActiveJob::Base
- ApplicationJob
- Observ::DatasetRunnerJob
- Defined in:
- app/jobs/observ/dataset_runner_job.rb
Overview
Background job for executing dataset evaluations asynchronously
This job wraps the DatasetRunnerService to allow dataset runs to be processed in the background via ActiveJob.
Usage:
DatasetRunnerJob.perform_later(dataset_run.id)
The job will:
- Find the dataset run by ID
- Skip execution if the run is already completed or running
- Execute the DatasetRunnerService
Instance Method Summary collapse
Instance Method Details
#perform(dataset_run_id) ⇒ Object
37 38 39 40 41 42 43 44 45 46 47 |
# File 'app/jobs/observ/dataset_runner_job.rb', line 37 def perform(dataset_run_id) dataset_run = Observ::DatasetRun.find(dataset_run_id) # Skip if already completed or failed return if dataset_run.finished? # Skip if already running (avoid duplicate execution) return if dataset_run.running? DatasetRunnerService.new(dataset_run).call end |