Class: Gitlab::GithubImport::ParallelImporter

Inherits:
Object
  • Object
show all
Defined in:
lib/gitlab/github_import/parallel_importer.rb

Overview

The ParallelImporter schedules the importing of a GitHub project using Sidekiq.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(project) ⇒ ParallelImporter

Returns a new instance of ParallelImporter.



31
32
33
# File 'lib/gitlab/github_import/parallel_importer.rb', line 31

def initialize(project)
  @project = project
end

Instance Attribute Details

#projectObject (readonly)

Returns the value of attribute project.



8
9
10
# File 'lib/gitlab/github_import/parallel_importer.rb', line 8

def project
  @project
end

Class Method Details

.async?Boolean

Returns:

  • (Boolean)


10
11
12
# File 'lib/gitlab/github_import/parallel_importer.rb', line 10

def self.async?
  true
end

.imports_repository?Boolean

Returns:

  • (Boolean)


14
15
16
# File 'lib/gitlab/github_import/parallel_importer.rb', line 14

def self.imports_repository?
  true
end

.requires_ci_cd_setup?Boolean

Returns:

  • (Boolean)

Raises:

  • (NotImplementedError)


26
27
28
# File 'lib/gitlab/github_import/parallel_importer.rb', line 26

def self.requires_ci_cd_setup?
  raise NotImplementedError
end

.track_start_import(project) ⇒ Object



18
19
20
# File 'lib/gitlab/github_import/parallel_importer.rb', line 18

def self.track_start_import(project)
  Gitlab::Import::Metrics.new(:github_importer, project).track_start_import
end

Instance Method Details

#executeObject



35
36
37
38
39
40
41
42
43
44
# File 'lib/gitlab/github_import/parallel_importer.rb', line 35

def execute
  Gitlab::Import::SetAsyncJid.set_jid(project.import_state)

  # We need to track this job's status for use by Gitlab::GithubImport::RefreshImportJidWorker.
  Stage::ImportRepositoryWorker
    .with_status
    .perform_async(project.id)

  true
end