Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'app/helpers/projects/ml/experiments_helper.rb')
-rw-r--r--app/helpers/projects/ml/experiments_helper.rb28
1 files changed, 15 insertions, 13 deletions
diff --git a/app/helpers/projects/ml/experiments_helper.rb b/app/helpers/projects/ml/experiments_helper.rb
index 55216d412a5..7aef208447a 100644
--- a/app/helpers/projects/ml/experiments_helper.rb
+++ b/app/helpers/projects/ml/experiments_helper.rb
@@ -5,20 +5,10 @@ module Projects
require 'json'
include ActionView::Helpers::NumberHelper
- def show_candidate_view_model(candidate)
+ def experiment_as_data(experiment)
data = {
- candidate: {
- params: candidate.params,
- metrics: candidate.latest_metrics,
- info: {
- iid: candidate.iid,
- path_to_artifact: link_to_artifact(candidate),
- experiment_name: candidate.experiment.name,
- path_to_experiment: link_to_experiment(candidate.project, candidate.experiment),
- status: candidate.status
- },
- metadata: candidate.metadata
- }
+ name: experiment.name,
+ path: link_to_experiment(experiment.project, experiment)
}
Gitlab::Json.generate(data)
@@ -29,6 +19,7 @@ module Projects
{
**candidate.params.to_h { |p| [p.name, p.value] },
**candidate.latest_metrics.to_h { |m| [m.name, number_with_precision(m.value, precision: 4)] },
+ ci_job: job_info(candidate),
artifact: link_to_artifact(candidate),
details: link_to_details(candidate),
name: candidate.name,
@@ -81,6 +72,17 @@ module Projects
project_ml_candidate_path(candidate.project, candidate.iid)
end
+ def job_info(candidate)
+ return unless candidate.from_ci?
+
+ build = candidate.ci_build
+
+ {
+ path: project_job_path(build.project, build),
+ name: build.name
+ }
+ end
+
def link_to_experiment(project, experiment)
project_ml_experiment_path(project, experiment.iid)
end