Class: Types::Ci::RunnerManagerType

Inherits:
BaseObject
  • Object
show all
Defined in:
app/graphql/types/ci/runner_manager_type.rb

Instance Method Summary collapse

Methods inherited from BaseObject

accepts, assignable?, authorization, authorize, authorized?, #current_user, #id

Methods included from Gitlab::Graphql::Present

#present, #unpresented

Instance Method Details

#executor_nameObject



49
50
51
# File 'app/graphql/types/ci/runner_manager_type.rb', line 49

def executor_name
  ::Ci::Runner::EXECUTOR_TYPE_TO_NAMES[runner_manager.executor_type&.to_sym]
end

#job_execution_statusObject



53
54
55
56
57
58
59
60
61
# File 'app/graphql/types/ci/runner_manager_type.rb', line 53

def job_execution_status
  BatchLoader::GraphQL.for(runner_manager.id).batch(key: :running_builds_exist) do |runner_manager_ids, loader|
    statuses = ::Ci::RunnerManager.id_in(runner_manager_ids).with_running_builds.index_by(&:id)

    runner_manager_ids.each do |runner_manager_id|
      loader.call(runner_manager_id, statuses[runner_manager_id] ? :running : :idle)
    end
  end
end