Skip to content

GraphQL: Add job_execution_status to CiRunner

Pedro Pombeiro requested to merge pedropombeiro/372869/add-graphql-query into master

What does this MR do and why?

Describe in detail what your merge request does and why.

This MR adds a jobExecutionStatus enum field to RunnerType. This can return IDLE or RUNNING.

Part of Indicate if a runner is running a job or not (i... (#372869 - closed)

Screenshots or screen recordings

Screenshots are required for UI changes, and strongly recommended for all other merge requests.

How to set up and validate locally

Numbered steps to set up and validate the change are strongly suggested.

  1. Visit http://gdk.test:3000/-/graphql-explorer

  2. Enter the following query:

    {
      runners(first: 20) {
        nodes {
          id
          description
          jobExecutionStatus
        }
      }
    }
  3. The jobExecutionStatus property should be listed on the resulting JSON

Database query plans

https://postgres.ai/console/gitlab/gitlab-production-ci/sessions/13364/commands/46946

`job_execution_status` query
SELECT "ci_runners".*
FROM "ci_runners"
WHERE "ci_runners"."id" IN (13, 12, 11, 10, 9, 8, 7, 6, 4, 3, 2)
  AND (EXISTS (
      SELECT 1
      FROM "ci_running_builds"
      WHERE (ci_running_builds.runner_id = ci_runners.id)))
Query plan
 Nested Loop Semi Join  (cost=0.84..45.34 rows=1 width=271) (actual time=9.412..9.414 rows=0 loops=1)
   Buffers: shared hit=39 read=4 dirtied=1
   I/O Timings: read=8.068 write=0.000
   ->  Index Scan using ci_runners_pkey on public.ci_runners  (cost=0.43..37.41 rows=11 width=271) (actual time=9.338..9.349 rows=1 loops=1)
         Index Cond: (ci_runners.id = ANY ('{13,12,11,10,9,8,7,6,4,3,2}'::integer[]))
         Buffers: shared hit=33 read=4 dirtied=1
         I/O Timings: read=8.068 write=0.000
   ->  Index Only Scan using index_ci_running_builds_on_runner_id on public.ci_running_builds  (cost=0.41..105.81 rows=400 width=8) (actual time=0.057..0.057 rows=0 loops=1)
         Index Cond: (ci_running_builds.runner_id = ci_runners.id)
         Heap Fetches: 0
         Buffers: shared hit=6
         I/O Timings: read=0.000 write=0.000

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Edited by Pedro Pombeiro

Merge request reports

Loading