Class: Leva::RunEvalJob

Inherits:
ApplicationJob show all
Defined in:
app/jobs/leva/run_eval_job.rb

Instance Method Summary collapse

Instance Method Details

#perform(experiment_id, dataset_record_id) ⇒ void

This method returns an undefined value.

Perform a single run and evaluation for a dataset record

Parameters:

  • experiment_id (Integer)

    The ID of the experiment

  • dataset_record_id (Integer)

    The ID of the dataset record



12
13
14
15
16
17
18
19
20
21
22
# File 'app/jobs/leva/run_eval_job.rb', line 12

def perform(experiment_id, dataset_record_id)
  experiment = Experiment.find(experiment_id)
  dataset_record = DatasetRecord.find(dataset_record_id)

  run = constantize_class(experiment.runner_class).new
  evals = experiment.evaluator_classes.compact.reject(&:empty?).map { |klass| constantize_class(klass).new }

  Leva.run_single_evaluation(experiment: experiment, run: run, evals: evals, dataset_record: dataset_record)

  experiment.update!(status: :completed) if is_last(experiment)
end