Class: Ml::CandidateDetailsPresenter

Inherits:
Object
  • Object
show all
Defined in:
app/presenters/ml/candidate_details_presenter.rb

Instance Method Summary collapse

Constructor Details

#initialize(candidate) ⇒ CandidateDetailsPresenter

Returns a new instance of CandidateDetailsPresenter.



7
8
9
# File 'app/presenters/ml/candidate_details_presenter.rb', line 7

def initialize(candidate)
  @candidate = candidate
end

Instance Method Details

#presentObject



11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'app/presenters/ml/candidate_details_presenter.rb', line 11

def present
  data = {
    candidate: {
      info: {
        iid: candidate.iid,
        eid: candidate.eid,
        path_to_artifact: link_to_artifact,
        experiment_name: candidate.experiment.name,
        path_to_experiment: link_to_experiment,
        path: link_to_details,
        status: candidate.status,
        ci_job: job_info
      },
      params: candidate.params,
      metrics: candidate.latest_metrics,
      metadata: candidate.
    }
  }

  Gitlab::Json.generate(data)
end