Class: Ml::Candidate

Inherits:
ApplicationRecord show all
Includes:
AtomicInternalId, IgnorableColumns, 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 ResetOnUnionError

ResetOnUnionError::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 inherited from ApplicationRecord

cached_column_list, #create_or_load_association, declarative_enum, default_select_columns, id_in, id_not_in, iid_in, 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 SensitiveSerializableHash

#serializable_hash

Class Method Details

.with_project_id_and_eid(project_id, eid) ⇒ Object



77
78
79
80
81
# File 'app/models/ml/candidate.rb', line 77

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



83
84
85
86
87
# File 'app/models/ml/candidate.rb', line 83

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



64
65
66
# File 'app/models/ml/candidate.rb', line 64

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

#from_ci?Boolean

Returns:

  • (Boolean)


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

def from_ci?
  ci_build_id.present?
end

#package_versionObject



68
69
70
# File 'app/models/ml/candidate.rb', line 68

def package_version
  iid
end