Class: Ml::Candidate

Inherits:
ApplicationRecord show all
Includes:
AtomicInternalId, Presentable, Sortable
Defined in:
app/models/ml/candidate.rb

Constant Summary

Constants included from AtomicInternalId

AtomicInternalId::MissingValueError

Constants inherited from ApplicationRecord

ApplicationRecord::MAX_PLUCK

Constants included from HasCheckConstraints

HasCheckConstraints::NOT_NULL_CHECK_PATTERN

Constants included from ResetOnColumnErrors

ResetOnColumnErrors::MAX_RESET_PERIOD

Class Method Summary collapse

Instance Method Summary collapse

Methods included from AtomicInternalId

group_init, #internal_id_read_scope, #internal_id_scope_attrs, #internal_id_scope_usage, namespace_init, project_init, scope_attrs, scope_usage

Methods included from Presentable

#present

Methods inherited from ApplicationRecord

===, cached_column_list, #create_or_load_association, declarative_enum, default_select_columns, id_in, id_not_in, iid_in, nullable_column?, pluck_primary_key, primary_key_in, #readable_by?, safe_ensure_unique, safe_find_or_create_by, safe_find_or_create_by!, #to_ability_name, underscore, where_exists, where_not_exists, with_fast_read_statement_timeout, without_order

Methods included from ResetOnColumnErrors

#reset_on_union_error, #reset_on_unknown_attribute_error

Methods included from Gitlab::SensitiveSerializableHash

#serializable_hash

Class Method Details

.with_project_id_and_eid(project_id, eid) ⇒ Object



85
86
87
88
89
# File 'app/models/ml/candidate.rb', line 85

def with_project_id_and_eid(project_id, eid)
  return unless project_id.present? && eid.present?

  find_by(project_id: project_id, eid: eid)
end

.with_project_id_and_iid(project_id, iid) ⇒ Object



91
92
93
94
95
# File 'app/models/ml/candidate.rb', line 91

def with_project_id_and_iid(project_id, iid)
  return unless project_id.present? && iid.present?

  find_by(project_id: project_id, internal_id: iid)
end

Instance Method Details

#artifact_rootObject



66
67
68
# File 'app/models/ml/candidate.rb', line 66

def artifact_root
  "/#{package_name}/#{package_version}/"
end

#for_model?Boolean

Returns:

  • (Boolean)


80
81
82
# File 'app/models/ml/candidate.rb', line 80

def for_model?
  experiment.for_model? && !model_version_id.present?
end

#from_ci?Boolean

Returns:

  • (Boolean)


76
77
78
# File 'app/models/ml/candidate.rb', line 76

def from_ci?
  ci_build_id.present?
end

#package_versionObject



70
71
72
73
74
# File 'app/models/ml/candidate.rb', line 70

def package_version
  return "candidate_#{iid}" if for_model?

  iid
end