blob: 00b965542f65d0734a33812b7dbedbbff7257595 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
|
# frozen_string_literal: true
module Projects
module Ml
class ExperimentsController < ::Projects::ApplicationController
include Projects::Ml::ExperimentsHelper
before_action :check_feature_flag
feature_category :mlops
MAX_EXPERIMENTS_PER_PAGE = 20
MAX_CANDIDATES_PER_PAGE = 30
def index
paginator = ::Ml::Experiment.by_project_id(@project.id)
.with_candidate_count
.keyset_paginate(cursor: params[:cursor], per_page: MAX_EXPERIMENTS_PER_PAGE)
@experiments = paginator.records
@page_info = page_info(paginator)
end
def show
@experiment = ::Ml::Experiment.by_project_id_and_iid(@project.id, params[:id])
return redirect_to project_ml_experiments_path(@project) unless @experiment.present?
find_params = params
.transform_keys(&:underscore)
.permit(:name, :order_by, :sort, :order_by_type)
paginator = CandidateFinder
.new(@experiment, find_params)
.execute
.keyset_paginate(cursor: params[:cursor], per_page: MAX_CANDIDATES_PER_PAGE)
@candidates = paginator.records.each(&:artifact_lazy)
@page_info = page_info(paginator)
end
private
def check_feature_flag
render_404 unless Feature.enabled?(:ml_experiment_tracking, @project)
end
end
end
end
|