Fix specs. Align with the new table name ci_build_trace_chunk
This commit is contained in:
parent
1fb66181db
commit
645b404d89
|
@ -19,18 +19,13 @@ module Ci
|
||||||
|
|
||||||
has_one :last_deployment, -> { order('deployments.id DESC') }, as: :deployable, class_name: 'Deployment'
|
has_one :last_deployment, -> { order('deployments.id DESC') }, as: :deployable, class_name: 'Deployment'
|
||||||
has_many :trace_sections, class_name: 'Ci::BuildTraceSection'
|
has_many :trace_sections, class_name: 'Ci::BuildTraceSection'
|
||||||
has_many :trace_chunks, class_name: 'Ci::BuildTraceChunk', foreign_key: :build_id, dependent: :destroy # rubocop:disable Cop/ActiveRecordDependent
|
has_many :trace_chunks, class_name: 'Ci::BuildTraceChunk', foreign_key: :build_id
|
||||||
|
|
||||||
has_many :job_artifacts, class_name: 'Ci::JobArtifact', foreign_key: :job_id, dependent: :destroy, inverse_of: :job # rubocop:disable Cop/ActiveRecordDependent
|
has_many :job_artifacts, class_name: 'Ci::JobArtifact', foreign_key: :job_id, dependent: :destroy, inverse_of: :job # rubocop:disable Cop/ActiveRecordDependent
|
||||||
has_one :job_artifacts_archive, -> { where(file_type: Ci::JobArtifact.file_types[:archive]) }, class_name: 'Ci::JobArtifact', inverse_of: :job, foreign_key: :job_id
|
has_one :job_artifacts_archive, -> { where(file_type: Ci::JobArtifact.file_types[:archive]) }, class_name: 'Ci::JobArtifact', inverse_of: :job, foreign_key: :job_id
|
||||||
has_one :job_artifacts_metadata, -> { where(file_type: Ci::JobArtifact.file_types[:metadata]) }, class_name: 'Ci::JobArtifact', inverse_of: :job, foreign_key: :job_id
|
has_one :job_artifacts_metadata, -> { where(file_type: Ci::JobArtifact.file_types[:metadata]) }, class_name: 'Ci::JobArtifact', inverse_of: :job, foreign_key: :job_id
|
||||||
has_one :job_artifacts_trace, -> { where(file_type: Ci::JobArtifact.file_types[:trace]) }, class_name: 'Ci::JobArtifact', inverse_of: :job, foreign_key: :job_id
|
has_one :job_artifacts_trace, -> { where(file_type: Ci::JobArtifact.file_types[:trace]) }, class_name: 'Ci::JobArtifact', inverse_of: :job, foreign_key: :job_id
|
||||||
|
|
||||||
<<<<<<< HEAD
|
|
||||||
has_many :chunks, class_name: 'Ci::JobTraceChunk', foreign_key: :job_id
|
|
||||||
|
|
||||||
=======
|
|
||||||
>>>>>>> live-trace-v2
|
|
||||||
has_one :metadata, class_name: 'Ci::BuildMetadata'
|
has_one :metadata, class_name: 'Ci::BuildMetadata'
|
||||||
delegate :timeout, to: :metadata, prefix: true, allow_nil: true
|
delegate :timeout, to: :metadata, prefix: true, allow_nil: true
|
||||||
delegate :gitlab_deploy_token, to: :project
|
delegate :gitlab_deploy_token, to: :project
|
||||||
|
|
|
@ -19,9 +19,8 @@ module Ci
|
||||||
db: 2
|
db: 2
|
||||||
}
|
}
|
||||||
|
|
||||||
<<<<<<< HEAD:app/models/ci/job_trace_chunk.rb
|
|
||||||
def self.delayed_cleanup_blk
|
def self.delayed_cleanup_blk
|
||||||
ids = all.redis.pluck(:job_id, :chunk_index).map do |data|
|
ids = all.redis.pluck(:build_id, :chunk_index).map do |data|
|
||||||
"gitlab:ci:trace:#{data.first}:chunks:#{data.second}:data"
|
"gitlab:ci:trace:#{data.first}:chunks:#{data.second}:data"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -44,10 +43,8 @@ module Ci
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
=======
|
|
||||||
##
|
##
|
||||||
# Data is memoized for optimizing #size and #end_offset
|
# Data is memoized for optimizing #size and #end_offset
|
||||||
>>>>>>> live-trace-v2:app/models/ci/build_trace_chunk.rb
|
|
||||||
def data
|
def data
|
||||||
@data ||= get_data
|
@data ||= get_data
|
||||||
end
|
end
|
||||||
|
|
|
@ -228,7 +228,7 @@ class Project < ActiveRecord::Base
|
||||||
# still using `dependent: :destroy` here.
|
# still using `dependent: :destroy` here.
|
||||||
has_many :builds, class_name: 'Ci::Build', inverse_of: :project, dependent: :destroy # rubocop:disable Cop/ActiveRecordDependent
|
has_many :builds, class_name: 'Ci::Build', inverse_of: :project, dependent: :destroy # rubocop:disable Cop/ActiveRecordDependent
|
||||||
has_many :build_trace_section_names, class_name: 'Ci::BuildTraceSectionName'
|
has_many :build_trace_section_names, class_name: 'Ci::BuildTraceSectionName'
|
||||||
has_many :build_trace_chunks, class_name: 'Ci::JobTraceChunk', foreign_key: :job_id, through: :builds, source: :chunks
|
has_many :build_trace_chunks, class_name: 'Ci::BuildTraceChunk', through: :builds, source: :trace_chunks
|
||||||
has_many :runner_projects, class_name: 'Ci::RunnerProject'
|
has_many :runner_projects, class_name: 'Ci::RunnerProject'
|
||||||
has_many :runners, through: :runner_projects, source: :runner, class_name: 'Ci::Runner'
|
has_many :runners, through: :runner_projects, source: :runner, class_name: 'Ci::Runner'
|
||||||
has_many :variables, class_name: 'Ci::Variable'
|
has_many :variables, class_name: 'Ci::Variable'
|
||||||
|
|
|
@ -8,7 +8,7 @@ class BuildFinishedWorker
|
||||||
Ci::Build.find_by(id: build_id).try do |build|
|
Ci::Build.find_by(id: build_id).try do |build|
|
||||||
# Swap all trace chunks to Database from Redis
|
# Swap all trace chunks to Database from Redis
|
||||||
# TODO: Do we need that?
|
# TODO: Do we need that?
|
||||||
build.chunks.redis.map(&:use_database!)
|
build.trace_chunks.redis.map(&:use_database!)
|
||||||
|
|
||||||
# We execute that in sync as this access the files in order to access local data, and reduce IO
|
# We execute that in sync as this access the files in order to access local data, and reduce IO
|
||||||
BuildTraceSectionsWorker.new.perform(build.id)
|
BuildTraceSectionsWorker.new.perform(build.id)
|
||||||
|
|
|
@ -111,7 +111,7 @@ module Gitlab
|
||||||
if job.trace_chunks.any?
|
if job.trace_chunks.any?
|
||||||
Gitlab::Ci::Trace::ChunkedIO.new(job) do |stream|
|
Gitlab::Ci::Trace::ChunkedIO.new(job) do |stream|
|
||||||
archive_stream!(stream)
|
archive_stream!(stream)
|
||||||
stream.delete!
|
stream.destroy!
|
||||||
end
|
end
|
||||||
elsif current_path
|
elsif current_path
|
||||||
File.open(current_path) do |stream|
|
File.open(current_path) do |stream|
|
||||||
|
|
|
@ -276,6 +276,7 @@ project:
|
||||||
- uploads
|
- uploads
|
||||||
- members_and_requesters
|
- members_and_requesters
|
||||||
- build_trace_section_names
|
- build_trace_section_names
|
||||||
|
- build_trace_chunks
|
||||||
- root_of_fork_network
|
- root_of_fork_network
|
||||||
- fork_network_member
|
- fork_network_member
|
||||||
- fork_network
|
- fork_network
|
||||||
|
|
Loading…
Reference in New Issue