Analysis of Ibis’s CI performance

blog
bigquery
continuous integration
data engineering
dogfood
Author

Phillip Cloud

Published

January 9, 2023

Summary

This notebook takes you through an analysis of Ibis’s CI data using ibis on top of Google BigQuery.

  • First, we load some data and poke around at it to see what’s what.
  • Second, we figure out some useful things to calculate based on our poking.
  • Third, we’ll visualize the results of calculations to showcase what changed and how.

Imports

Let’s start out by importing ibis and turning on interactive mode.

import ibis
from ibis import _

ibis.options.interactive = True

Connect to BigQuery

We connect to BigQuery using the ibis.connect API, which accepts a URL string indicating the backend and various bit of information needed to connect to the backend. Here we’re using BigQuery, so we need the project id (ibis-gbq) and the dataset id (workflows).

Datasets are analogous to schemas in other systems.

url = "bigquery://ibis-gbq/workflows"
con = ibis.connect(url)

Let’s see what tables are available.

con.list_tables()
['analysis', 'jobs', 'workflows']

Analysis

Here we’ve got our first bit of interesting information: the jobs and workflows tables.

Terminology

Before we jump in, it helps to lay down some terminology.

  • A workflow corresponds to an individual GitHub Actions YAML file in a GitHub repository under the .github/workflows directory.
  • A job is a named set of steps to run inside a workflow file.

What’s in the workflows table?

Each row in the workflows table corresponds to a workflow run.

  • A workflow run is an instance of a workflow that was triggered by some entity: a GitHub user, bot, or other entity. Each row of the workflows table is a workflow run.

What’s in the jobs table?

Similarly, each row in the jobs table is a job run. That is, for a given workflow run there are a set of jobs run with it.

  • A job run is an instance of a job in a workflow. It is associated with a single workflow run.

Rationale

The goal of this analysis is to try to understand ibis’s CI performance, and whether the amount of time we spent waiting on CI has decreased, stayed the same or increased. Ideally, we can understand the pieces that contribute to the change or lack thereof.

Metrics

To that end there are a few interesting metrics to look at:

  • job run duration: this is the amount of time it takes for a given job to complete
  • workflow run duration: the amount of time it takes for all job runs in a workflow run to complete.
  • queueing duration: the amount time time spent waiting for the first job run to commence.

Mitigating Factors

  • Around October 2021, we changed our CI infrastructure to use Poetry instead of Conda. The goal there was to see if we could cache dependencies using the lock file generated by poetry. We should see whether that had any effect.
  • At the end of November 2022, we switch to the Team Plan (a paid GitHub plan) for the Ibis organzation. This tripled the amount of job runs that could execute in parallel. We should see if that helped anything.

Alright, let’s jump into some data!

jobs = con.tables.jobs
jobs
┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━┳━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
┃ url                                                                     steps                                                                             status     started_at                 runner_group_name  run_attempt  name                                       labels          node_id                       id          runner_id  run_url                                                                run_id     check_run_url                                                         html_url                                                                     runner_name  runner_group_id  head_sha                                  conclusion  completed_at              ┃
┡━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━╇━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━━━━┩
│ stringarray<!struct<status: string, conclusion: string, started_at: timestamp('UTC'),…stringtimestamp('UTC')stringint64stringarray<!string>stringint64int64stringint64stringstringstringint64stringstringtimestamp('UTC')          │
├────────────────────────────────────────────────────────────────────────┼──────────────────────────────────────────────────────────────────────────────────┼───────────┼───────────────────────────┼───────────────────┼─────────────┼───────────────────────────────────────────┼────────────────┼──────────────────────────────┼────────────┼───────────┼───────────────────────────────────────────────────────────────────────┼───────────┼──────────────────────────────────────────────────────────────────────┼─────────────────────────────────────────────────────────────────────────────┼─────────────┼─────────────────┼──────────────────────────────────────────┼────────────┼───────────────────────────┤
│ https://api.github.com/repos/ibis-project/ibis/actions/jobs/1076214556[{...}, {...}, ... +5]completed2020-09-05 19:52:40+00:00NULL1Tests OmniSciDB/Spark (3.7)              []MDg6Q2hlY2tSdW4xMDc2MjE0NTU21076214556NULLhttps://api.github.com/repos/ibis-project/ibis/actions/runs/240931982240931982https://api.github.com/repos/ibis-project/ibis/check-runs/1076214556https://github.com/ibis-project/ibis/runs/1076214556?check_suite_focus=trueNULLNULL0b720cbe9a6ab62d2402d5b400ca3f6f3f480855success   2020-09-05 20:08:23+00:00 │
│ https://api.github.com/repos/ibis-project/ibis/actions/jobs/1076214567[{...}, {...}, ... +5]completed2020-09-05 19:52:41+00:00NULL1Tests SQL (3.7)                          []MDg6Q2hlY2tSdW4xMDc2MjE0NTY31076214567NULLhttps://api.github.com/repos/ibis-project/ibis/actions/runs/240931982240931982https://api.github.com/repos/ibis-project/ibis/check-runs/1076214567https://github.com/ibis-project/ibis/runs/1076214567?check_suite_focus=trueNULLNULL0b720cbe9a6ab62d2402d5b400ca3f6f3f480855success   2020-09-05 20:03:29+00:00 │
│ https://api.github.com/repos/ibis-project/ibis/actions/jobs/1076214573[{...}, {...}, ... +5]completed2020-09-05 19:52:42+00:00NULL1Tests SQL (3.8)                          []MDg6Q2hlY2tSdW4xMDc2MjE0NTcz1076214573NULLhttps://api.github.com/repos/ibis-project/ibis/actions/runs/240931982240931982https://api.github.com/repos/ibis-project/ibis/check-runs/1076214573https://github.com/ibis-project/ibis/runs/1076214573?check_suite_focus=trueNULLNULL0b720cbe9a6ab62d2402d5b400ca3f6f3f480855success   2020-09-05 20:02:04+00:00 │
│ https://api.github.com/repos/ibis-project/ibis/actions/jobs/1076214584[{...}, {...}, ... +3]completed2020-09-05 19:52:40+00:00NULL1Tests pandas / files (ubuntu-latest, 3.7)[]MDg6Q2hlY2tSdW4xMDc2MjE0NTg01076214584NULLhttps://api.github.com/repos/ibis-project/ibis/actions/runs/240931982240931982https://api.github.com/repos/ibis-project/ibis/check-runs/1076214584https://github.com/ibis-project/ibis/runs/1076214584?check_suite_focus=trueNULLNULL0b720cbe9a6ab62d2402d5b400ca3f6f3f480855success   2020-09-05 19:59:41+00:00 │
│ https://api.github.com/repos/ibis-project/ibis/actions/jobs/1076214594[{...}, {...}, ... +3]completed2020-09-05 19:52:41+00:00NULL1Tests pandas / files (ubuntu-latest, 3.8)[]MDg6Q2hlY2tSdW4xMDc2MjE0NTk01076214594NULLhttps://api.github.com/repos/ibis-project/ibis/actions/runs/240931982240931982https://api.github.com/repos/ibis-project/ibis/check-runs/1076214594https://github.com/ibis-project/ibis/runs/1076214594?check_suite_focus=trueNULLNULL0b720cbe9a6ab62d2402d5b400ca3f6f3f480855success   2020-09-05 20:00:30+00:00 │
│ https://api.github.com/repos/ibis-project/ibis/actions/jobs/1076214604[{...}, {...}, ... +9]completed2020-09-05 19:52:41+00:00NULL1Lint, package and benckmark              []MDg6Q2hlY2tSdW4xMDc2MjE0NjA01076214604NULLhttps://api.github.com/repos/ibis-project/ibis/actions/runs/240931982240931982https://api.github.com/repos/ibis-project/ibis/check-runs/1076214604https://github.com/ibis-project/ibis/runs/1076214604?check_suite_focus=trueNULLNULL0b720cbe9a6ab62d2402d5b400ca3f6f3f480855success   2020-09-05 20:46:45+00:00 │
│ https://api.github.com/repos/ibis-project/ibis/actions/jobs/1076214621[]completed2020-09-05 20:52:43+00:00NULL1Tests Impala / Clickhouse                []MDg6Q2hlY2tSdW4xMDc2MjE0NjIx1076214621NULLhttps://api.github.com/repos/ibis-project/ibis/actions/runs/240931982240931982https://api.github.com/repos/ibis-project/ibis/check-runs/1076214621https://github.com/ibis-project/ibis/runs/1076214621?check_suite_focus=trueNULLNULL0b720cbe9a6ab62d2402d5b400ca3f6f3f480855skipped   2020-09-05 20:52:43+00:00 │
│ https://api.github.com/repos/ibis-project/ibis/actions/jobs/1076164518[{...}, {...}, ... +5]completed2020-09-05 19:20:53+00:00NULL1Tests OmniSciDB/Spark (3.7)              []MDg6Q2hlY2tSdW4xMDc2MTY0NTE41076164518NULLhttps://api.github.com/repos/ibis-project/ibis/actions/runs/240911764240911764https://api.github.com/repos/ibis-project/ibis/check-runs/1076164518https://github.com/ibis-project/ibis/runs/1076164518?check_suite_focus=trueNULLNULL39794be13e92913c753b37fb20bab70523444c6dsuccess   2020-09-05 19:36:44+00:00 │
│ https://api.github.com/repos/ibis-project/ibis/actions/jobs/1076164569[{...}, {...}, ... +5]completed2020-09-05 19:20:54+00:00NULL1Tests SQL (3.7)                          []MDg6Q2hlY2tSdW4xMDc2MTY0NTY51076164569NULLhttps://api.github.com/repos/ibis-project/ibis/actions/runs/240911764240911764https://api.github.com/repos/ibis-project/ibis/check-runs/1076164569https://github.com/ibis-project/ibis/runs/1076164569?check_suite_focus=trueNULLNULL39794be13e92913c753b37fb20bab70523444c6dsuccess   2020-09-05 19:29:55+00:00 │
│ https://api.github.com/repos/ibis-project/ibis/actions/jobs/1076164581[{...}, {...}, ... +5]completed2020-09-05 19:20:55+00:00NULL1Tests SQL (3.8)                          []MDg6Q2hlY2tSdW4xMDc2MTY0NTgx1076164581NULLhttps://api.github.com/repos/ibis-project/ibis/actions/runs/240911764240911764https://api.github.com/repos/ibis-project/ibis/check-runs/1076164581https://github.com/ibis-project/ibis/runs/1076164581?check_suite_focus=trueNULLNULL39794be13e92913c753b37fb20bab70523444c6dsuccess   2020-09-05 19:29:53+00:00 │
│                          │
└────────────────────────────────────────────────────────────────────────┴──────────────────────────────────────────────────────────────────────────────────┴───────────┴───────────────────────────┴───────────────────┴─────────────┴───────────────────────────────────────────┴────────────────┴──────────────────────────────┴────────────┴───────────┴───────────────────────────────────────────────────────────────────────┴───────────┴──────────────────────────────────────────────────────────────────────┴─────────────────────────────────────────────────────────────────────────────┴─────────────┴─────────────────┴──────────────────────────────────────────┴────────────┴───────────────────────────┘

These first few columns in the jobs table aren’t that interesting so we should look at what else is there

jobs.columns
('url',
 'steps',
 'status',
 'started_at',
 'runner_group_name',
 'run_attempt',
 'name',
 'labels',
 'node_id',
 'id',
 'runner_id',
 'run_url',
 'run_id',
 'check_run_url',
 'html_url',
 'runner_name',
 'runner_group_id',
 'head_sha',
 'conclusion',
 'completed_at')

A bunch of these aren’t that useful for our purposes. However, run_id, started_at, completed_at are useful for us. The GitHub documentation for job information provides useful detail about the meaning of these fields.

  • run_id: the workflow run associated with this job run
  • started_at: when the job started
  • completed_at: when the job completed

What we’re interested in to a first degree is the job duration, so let’s compute that.

We also need to compute when the last job for a given run_id started and when it completed. We’ll use the former to compute the queueing duration, and the latter to compute the total time it took for a given workflow run to complete.

run_id_win = ibis.window(group_by=_.run_id)
jobs = jobs.select(
    _.run_id,
    job_duration=_.completed_at.delta(_.started_at, "microsecond"),
    last_job_started_at=_.started_at.max().over(run_id_win),
    last_job_completed_at=_.completed_at.max().over(run_id_win),
)
jobs
┏━━━━━━━━━━━┳━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
┃ run_id     job_duration  last_job_started_at        last_job_completed_at     ┃
┡━━━━━━━━━━━╇━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━━━━┩
│ int64int64timestamp('UTC')timestamp('UTC')          │
├───────────┼──────────────┼───────────────────────────┼───────────────────────────┤
│ 2062991153930000002020-08-13 00:55:18+00:002020-08-13 00:55:18+00:00 │
│ 2062991154080000002020-08-13 00:55:18+00:002020-08-13 00:55:18+00:00 │
│ 2062991153550000002020-08-13 00:55:18+00:002020-08-13 00:55:18+00:00 │
│ 2062991153330000002020-08-13 00:55:18+00:002020-08-13 00:55:18+00:00 │
│ 20629911531670000002020-08-13 00:55:18+00:002020-08-13 00:55:18+00:00 │
│ 20629911502020-08-13 00:55:18+00:002020-08-13 00:55:18+00:00 │
│ 20629911511050000002020-08-13 00:55:18+00:002020-08-13 00:55:18+00:00 │
│ 2074705534770000002020-08-13 18:55:30+00:002020-08-13 18:55:30+00:00 │
│ 2074705533500000002020-08-13 18:55:30+00:002020-08-13 18:55:30+00:00 │
│ 20747055312170000002020-08-13 18:55:30+00:002020-08-13 18:55:30+00:00 │
│                                  │
└───────────┴──────────────┴───────────────────────────┴───────────────────────────┘

Let’s take a look at workflows

workflows = con.tables.workflows
workflows
┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━┳━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━┳━━━━━━━━━━┳━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
┃ workflow_url                                                              workflow_id  triggering_actor  run_number  run_attempt  updated_at                 cancel_url                                                                    rerun_url                                                                    check_suite_node_id               pull_requests                                                                     id         node_id                           status     repository                                                                                                                                                     jobs_url                                                                    previous_attempt_url  artifacts_url                                                                    html_url                                                     head_sha                                  head_repository                                                                                                                                                    run_started_at             head_branch                            url                                                                    event         name      actor  created_at                 check_suite_url                                                         check_suite_id  conclusion  head_commit                                                                                                                            logs_url                                                                   ┃
┡━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━╇━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━╇━━━━━━━━━━╇━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┩
│ stringint64struct<subscrip…int64int64timestamp('UTC')stringstringstringarray<!struct<number: int64, url: string, id: int64, head: struct<sha: string, …int64stringstringstruct<trees_url: string, teams_url: string, statuses_url: string, subscribers_…stringstringstringstringstringstruct<trees_url: string, teams_url: string, statuses_url: string, subscribers_…timestamp('UTC')stringstringstringstringstru…timestamp('UTC')stringint64stringstruct<tree_id: string, timestamp: timestamp('UTC'), message: string, id: strin…string                                                                     │
├──────────────────────────────────────────────────────────────────────────┼─────────────┼──────────────────┼────────────┼─────────────┼───────────────────────────┼──────────────────────────────────────────────────────────────────────────────┼─────────────────────────────────────────────────────────────────────────────┼──────────────────────────────────┼──────────────────────────────────────────────────────────────────────────────────┼───────────┼──────────────────────────────────┼───────────┼───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┼────────────────────────────────────────────────────────────────────────────┼──────────────────────┼─────────────────────────────────────────────────────────────────────────────────┼─────────────────────────────────────────────────────────────┼──────────────────────────────────────────┼───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┼───────────────────────────┼───────────────────────────────────────┼───────────────────────────────────────────────────────────────────────┼──────────────┼──────────┼───────┼───────────────────────────┼────────────────────────────────────────────────────────────────────────┼────────────────┼────────────┼───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┼────────────────────────────────────────────────────────────────────────────┤
│ https://api.github.com/repos/ibis-project/ibis/actions/workflows/21705172170517NULL3112020-09-07 19:17:53+00:00https://api.github.com/repos/ibis-project/ibis/actions/runs/243465015/cancelhttps://api.github.com/repos/ibis-project/ibis/actions/runs/243465015/rerunMDEwOkNoZWNrU3VpdGUxMTU2NDgxNzIw[{...}, {...}]243465015MDExOldvcmtmbG93UnVuMjQzNDY1MDE1completed{'trees_url': 'https://api.github.com/repos/ibis-project/ibis/git/trees{/sha}', 'teams_url': 'https://api.github.com/repos/ibis-project/ibis/teams', ... +44}https://api.github.com/repos/ibis-project/ibis/actions/runs/243465015/jobsNULLhttps://api.github.com/repos/ibis-project/ibis/actions/runs/243465015/artifactshttps://github.com/ibis-project/ibis/actions/runs/243465015e7ac01853b5534a3378f78ebff25c861bc9209e8{'trees_url': 'https://api.github.com/repos/ibis-project/ibis/git/trees{/sha}', 'teams_url': 'https://api.github.com/repos/ibis-project/ibis/teams', ... +44}2020-09-07 18:57:15+00:00master                               https://api.github.com/repos/ibis-project/ibis/actions/runs/243465015push        BigQueryNULL2020-09-07 18:57:15+00:00https://api.github.com/repos/ibis-project/ibis/check-suites/11564817201156481720failure   {'tree_id': 'a9497cb44b4aa63f304f69505e596a4446f22883', 'timestamp': datetime.datetime(2020, 9, 7, 18, 57, 13, tzinfo=<UTC>), ... +4}https://api.github.com/repos/ibis-project/ibis/actions/runs/243465015/logs │
│ https://api.github.com/repos/ibis-project/ibis/actions/workflows/21009862100986NULL29812020-09-07 19:57:27+00:00https://api.github.com/repos/ibis-project/ibis/actions/runs/243465016/cancelhttps://api.github.com/repos/ibis-project/ibis/actions/runs/243465016/rerunMDEwOkNoZWNrU3VpdGUxMTU2NDgxNzIy[{...}, {...}]243465016MDExOldvcmtmbG93UnVuMjQzNDY1MDE2completed{'trees_url': 'https://api.github.com/repos/ibis-project/ibis/git/trees{/sha}', 'teams_url': 'https://api.github.com/repos/ibis-project/ibis/teams', ... +44}https://api.github.com/repos/ibis-project/ibis/actions/runs/243465016/jobsNULLhttps://api.github.com/repos/ibis-project/ibis/actions/runs/243465016/artifactshttps://github.com/ibis-project/ibis/actions/runs/243465016e7ac01853b5534a3378f78ebff25c861bc9209e8{'trees_url': 'https://api.github.com/repos/ibis-project/ibis/git/trees{/sha}', 'teams_url': 'https://api.github.com/repos/ibis-project/ibis/teams', ... +44}2020-09-07 18:57:15+00:00master                               https://api.github.com/repos/ibis-project/ibis/actions/runs/243465016push        Main    NULL2020-09-07 18:57:15+00:00https://api.github.com/repos/ibis-project/ibis/check-suites/11564817221156481722failure   {'tree_id': 'a9497cb44b4aa63f304f69505e596a4446f22883', 'timestamp': datetime.datetime(2020, 9, 7, 18, 57, 13, tzinfo=<UTC>), ... +4}https://api.github.com/repos/ibis-project/ibis/actions/runs/243465016/logs │
│ https://api.github.com/repos/ibis-project/ibis/actions/workflows/21009862100986NULL29712020-09-07 19:47:34+00:00https://api.github.com/repos/ibis-project/ibis/actions/runs/243457947/cancelhttps://api.github.com/repos/ibis-project/ibis/actions/runs/243457947/rerunMDEwOkNoZWNrU3VpdGUxMTU2NDU2ODE1[]243457947MDExOldvcmtmbG93UnVuMjQzNDU3OTQ3completed{'trees_url': 'https://api.github.com/repos/ibis-project/ibis/git/trees{/sha}', 'teams_url': 'https://api.github.com/repos/ibis-project/ibis/teams', ... +44}https://api.github.com/repos/ibis-project/ibis/actions/runs/243457947/jobsNULLhttps://api.github.com/repos/ibis-project/ibis/actions/runs/243457947/artifactshttps://github.com/ibis-project/ibis/actions/runs/24345794766463beac16e48b12f001637791d966786539047{'trees_url': 'https://api.github.com/repos/zbrookle/ibis/git/trees{/sha}', 'teams_url': 'https://api.github.com/repos/zbrookle/ibis/teams', ... +44}2020-09-07 18:47:22+00:00fix_slowdown_caused_by_fixing_aliaseshttps://api.github.com/repos/ibis-project/ibis/actions/runs/243457947pull_requestMain    NULL2020-09-07 18:47:22+00:00https://api.github.com/repos/ibis-project/ibis/check-suites/11564568151156456815success   {'tree_id': '0af846ddd6161bfae9fcd558d58fa6026ebb1ff0', 'timestamp': datetime.datetime(2020, 9, 7, 18, 47, 11, tzinfo=<UTC>), ... +4}https://api.github.com/repos/ibis-project/ibis/actions/runs/243457947/logs │
│ https://api.github.com/repos/ibis-project/ibis/actions/workflows/21009862100986NULL29612020-09-07 19:44:06+00:00https://api.github.com/repos/ibis-project/ibis/actions/runs/243454838/cancelhttps://api.github.com/repos/ibis-project/ibis/actions/runs/243454838/rerunMDEwOkNoZWNrU3VpdGUxMTU2NDQ3MTM5[]243454838MDExOldvcmtmbG93UnVuMjQzNDU0ODM4completed{'trees_url': 'https://api.github.com/repos/ibis-project/ibis/git/trees{/sha}', 'teams_url': 'https://api.github.com/repos/ibis-project/ibis/teams', ... +44}https://api.github.com/repos/ibis-project/ibis/actions/runs/243454838/jobsNULLhttps://api.github.com/repos/ibis-project/ibis/actions/runs/243454838/artifactshttps://github.com/ibis-project/ibis/actions/runs/24345483819966825608bc00e2dc2a17fc8f3285fb83a5a9d{'trees_url': 'https://api.github.com/repos/zbrookle/ibis/git/trees{/sha}', 'teams_url': 'https://api.github.com/repos/zbrookle/ibis/teams', ... +44}2020-09-07 18:43:53+00:00fix_slowdown_caused_by_fixing_aliaseshttps://api.github.com/repos/ibis-project/ibis/actions/runs/243454838pull_requestMain    NULL2020-09-07 18:43:53+00:00https://api.github.com/repos/ibis-project/ibis/check-suites/11564471391156447139success   {'tree_id': '409b991e08567a5dce9e2325265f3d9660acdf8e', 'timestamp': datetime.datetime(2020, 9, 7, 18, 43, 40, tzinfo=<UTC>), ... +4}https://api.github.com/repos/ibis-project/ibis/actions/runs/243454838/logs │
│ https://api.github.com/repos/ibis-project/ibis/actions/workflows/21009862100986NULL29512020-09-07 16:35:46+00:00https://api.github.com/repos/ibis-project/ibis/actions/runs/243262051/cancelhttps://api.github.com/repos/ibis-project/ibis/actions/runs/243262051/rerunMDEwOkNoZWNrU3VpdGUxMTU1Nzk3Nzk5[{...}, {...}]243262051MDExOldvcmtmbG93UnVuMjQzMjYyMDUxcompleted{'trees_url': 'https://api.github.com/repos/ibis-project/ibis/git/trees{/sha}', 'teams_url': 'https://api.github.com/repos/ibis-project/ibis/teams', ... +44}https://api.github.com/repos/ibis-project/ibis/actions/runs/243262051/jobsNULLhttps://api.github.com/repos/ibis-project/ibis/actions/runs/243262051/artifactshttps://github.com/ibis-project/ibis/actions/runs/2432620519f44fd7fd2cd9f333a9d4f646a96a75002fa6a08{'trees_url': 'https://api.github.com/repos/ibis-project/ibis/git/trees{/sha}', 'teams_url': 'https://api.github.com/repos/ibis-project/ibis/teams', ... +44}2020-09-07 15:35:31+00:00master                               https://api.github.com/repos/ibis-project/ibis/actions/runs/243262051push        Main    NULL2020-09-07 15:35:31+00:00https://api.github.com/repos/ibis-project/ibis/check-suites/11557977991155797799success   {'tree_id': '4ba3fc9dc3c1d72d10dc726580e5b1661f0c6a49', 'timestamp': datetime.datetime(2020, 9, 7, 15, 35, 28, tzinfo=<UTC>), ... +4}https://api.github.com/repos/ibis-project/ibis/actions/runs/243262051/logs │
│ https://api.github.com/repos/ibis-project/ibis/actions/workflows/21705172170517NULL3012020-09-07 15:56:15+00:00https://api.github.com/repos/ibis-project/ibis/actions/runs/243262053/cancelhttps://api.github.com/repos/ibis-project/ibis/actions/runs/243262053/rerunMDEwOkNoZWNrU3VpdGUxMTU1Nzk3ODA0[{...}, {...}]243262053MDExOldvcmtmbG93UnVuMjQzMjYyMDUzcompleted{'trees_url': 'https://api.github.com/repos/ibis-project/ibis/git/trees{/sha}', 'teams_url': 'https://api.github.com/repos/ibis-project/ibis/teams', ... +44}https://api.github.com/repos/ibis-project/ibis/actions/runs/243262053/jobsNULLhttps://api.github.com/repos/ibis-project/ibis/actions/runs/243262053/artifactshttps://github.com/ibis-project/ibis/actions/runs/2432620539f44fd7fd2cd9f333a9d4f646a96a75002fa6a08{'trees_url': 'https://api.github.com/repos/ibis-project/ibis/git/trees{/sha}', 'teams_url': 'https://api.github.com/repos/ibis-project/ibis/teams', ... +44}2020-09-07 15:35:31+00:00master                               https://api.github.com/repos/ibis-project/ibis/actions/runs/243262053push        BigQueryNULL2020-09-07 15:35:31+00:00https://api.github.com/repos/ibis-project/ibis/check-suites/11557978041155797804failure   {'tree_id': '4ba3fc9dc3c1d72d10dc726580e5b1661f0c6a49', 'timestamp': datetime.datetime(2020, 9, 7, 15, 35, 28, tzinfo=<UTC>), ... +4}https://api.github.com/repos/ibis-project/ibis/actions/runs/243262053/logs │
│ https://api.github.com/repos/ibis-project/ibis/actions/workflows/21009862100986NULL29412020-09-07 13:34:27+00:00https://api.github.com/repos/ibis-project/ibis/actions/runs/243022374/cancelhttps://api.github.com/repos/ibis-project/ibis/actions/runs/243022374/rerunMDEwOkNoZWNrU3VpdGUxMTU0OTE2NzEw[]243022374MDExOldvcmtmbG93UnVuMjQzMDIyMzc0completed{'trees_url': 'https://api.github.com/repos/ibis-project/ibis/git/trees{/sha}', 'teams_url': 'https://api.github.com/repos/ibis-project/ibis/teams', ... +44}https://api.github.com/repos/ibis-project/ibis/actions/runs/243022374/jobsNULLhttps://api.github.com/repos/ibis-project/ibis/actions/runs/243022374/artifactshttps://github.com/ibis-project/ibis/actions/runs/2430223746b086d1c7d2a66535aa7d2416b7700b44bffc23b{'trees_url': 'https://api.github.com/repos/datapythonista/ibis/git/trees{/sha}', 'teams_url': 'https://api.github.com/repos/datapythonista/ibis/teams', ... +44}2020-09-07 12:34:14+00:00pyspark2                             https://api.github.com/repos/ibis-project/ibis/actions/runs/243022374pull_requestMain    NULL2020-09-07 12:34:14+00:00https://api.github.com/repos/ibis-project/ibis/check-suites/11549167101154916710success   {'tree_id': '986fe0ce796e5e5f271660e61a8e34ac8b3aad83', 'timestamp': datetime.datetime(2020, 9, 7, 12, 33, 54, tzinfo=<UTC>), ... +4}https://api.github.com/repos/ibis-project/ibis/actions/runs/243022374/logs │
│ https://api.github.com/repos/ibis-project/ibis/actions/workflows/21009862100986NULL29312020-09-07 13:16:27+00:00https://api.github.com/repos/ibis-project/ibis/actions/runs/243013375/cancelhttps://api.github.com/repos/ibis-project/ibis/actions/runs/243013375/rerunMDEwOkNoZWNrU3VpdGUxMTU0ODg2NDQ3[]243013375MDExOldvcmtmbG93UnVuMjQzMDEzMzc1completed{'trees_url': 'https://api.github.com/repos/ibis-project/ibis/git/trees{/sha}', 'teams_url': 'https://api.github.com/repos/ibis-project/ibis/teams', ... +44}https://api.github.com/repos/ibis-project/ibis/actions/runs/243013375/jobsNULLhttps://api.github.com/repos/ibis-project/ibis/actions/runs/243013375/artifactshttps://github.com/ibis-project/ibis/actions/runs/243013375cd4b02f33abd85dc543a24f28d4f2160a4e37be1{'trees_url': 'https://api.github.com/repos/datapythonista/ibis/git/trees{/sha}', 'teams_url': 'https://api.github.com/repos/datapythonista/ibis/teams', ... +44}2020-09-07 12:27:54+00:00backends_toc                         https://api.github.com/repos/ibis-project/ibis/actions/runs/243013375pull_requestMain    NULL2020-09-07 12:27:54+00:00https://api.github.com/repos/ibis-project/ibis/check-suites/11548864471154886447success   {'tree_id': '72f78d3b17b37cd795b0ad3e4206aae06e5b0f5f', 'timestamp': datetime.datetime(2020, 9, 7, 12, 25, 33, tzinfo=<UTC>), ... +4}https://api.github.com/repos/ibis-project/ibis/actions/runs/243013375/logs │
│ https://api.github.com/repos/ibis-project/ibis/actions/workflows/21009862100986NULL29212020-09-07 13:09:18+00:00https://api.github.com/repos/ibis-project/ibis/actions/runs/242985647/cancelhttps://api.github.com/repos/ibis-project/ibis/actions/runs/242985647/rerunMDEwOkNoZWNrU3VpdGUxMTU0Nzk5ODYy[{...}, {...}]242985647MDExOldvcmtmbG93UnVuMjQyOTg1NjQ3completed{'trees_url': 'https://api.github.com/repos/ibis-project/ibis/git/trees{/sha}', 'teams_url': 'https://api.github.com/repos/ibis-project/ibis/teams', ... +44}https://api.github.com/repos/ibis-project/ibis/actions/runs/242985647/jobsNULLhttps://api.github.com/repos/ibis-project/ibis/actions/runs/242985647/artifactshttps://github.com/ibis-project/ibis/actions/runs/242985647a37c24cdf213c67ce844e27279f4fceb46358c80{'trees_url': 'https://api.github.com/repos/ibis-project/ibis/git/trees{/sha}', 'teams_url': 'https://api.github.com/repos/ibis-project/ibis/teams', ... +44}2020-09-07 12:09:06+00:00master                               https://api.github.com/repos/ibis-project/ibis/actions/runs/242985647push        Main    NULL2020-09-07 12:09:06+00:00https://api.github.com/repos/ibis-project/ibis/check-suites/11547998621154799862success   {'tree_id': '01da912d363a08018b3dc4b5ed61d89ee5b964ac', 'timestamp': datetime.datetime(2020, 9, 7, 12, 9, 3, tzinfo=<UTC>), ... +4}https://api.github.com/repos/ibis-project/ibis/actions/runs/242985647/logs │
│ https://api.github.com/repos/ibis-project/ibis/actions/workflows/21705172170517NULL2912020-09-07 12:28:42+00:00https://api.github.com/repos/ibis-project/ibis/actions/runs/242985648/cancelhttps://api.github.com/repos/ibis-project/ibis/actions/runs/242985648/rerunMDEwOkNoZWNrU3VpdGUxMTU0Nzk5ODY1[{...}, {...}]242985648MDExOldvcmtmbG93UnVuMjQyOTg1NjQ4completed{'trees_url': 'https://api.github.com/repos/ibis-project/ibis/git/trees{/sha}', 'teams_url': 'https://api.github.com/repos/ibis-project/ibis/teams', ... +44}https://api.github.com/repos/ibis-project/ibis/actions/runs/242985648/jobsNULLhttps://api.github.com/repos/ibis-project/ibis/actions/runs/242985648/artifactshttps://github.com/ibis-project/ibis/actions/runs/242985648a37c24cdf213c67ce844e27279f4fceb46358c80{'trees_url': 'https://api.github.com/repos/ibis-project/ibis/git/trees{/sha}', 'teams_url': 'https://api.github.com/repos/ibis-project/ibis/teams', ... +44}2020-09-07 12:09:06+00:00master                               https://api.github.com/repos/ibis-project/ibis/actions/runs/242985648push        BigQueryNULL2020-09-07 12:09:06+00:00https://api.github.com/repos/ibis-project/ibis/check-suites/11547998651154799865failure   {'tree_id': '01da912d363a08018b3dc4b5ed61d89ee5b964ac', 'timestamp': datetime.datetime(2020, 9, 7, 12, 9, 3, tzinfo=<UTC>), ... +4}https://api.github.com/repos/ibis-project/ibis/actions/runs/242985648/logs │
│                                                                           │
└──────────────────────────────────────────────────────────────────────────┴─────────────┴──────────────────┴────────────┴─────────────┴───────────────────────────┴──────────────────────────────────────────────────────────────────────────────┴─────────────────────────────────────────────────────────────────────────────┴──────────────────────────────────┴──────────────────────────────────────────────────────────────────────────────────┴───────────┴──────────────────────────────────┴───────────┴───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┴────────────────────────────────────────────────────────────────────────────┴──────────────────────┴─────────────────────────────────────────────────────────────────────────────────┴─────────────────────────────────────────────────────────────┴──────────────────────────────────────────┴───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┴───────────────────────────┴───────────────────────────────────────┴───────────────────────────────────────────────────────────────────────┴──────────────┴──────────┴───────┴───────────────────────────┴────────────────────────────────────────────────────────────────────────┴────────────────┴────────────┴───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┴────────────────────────────────────────────────────────────────────────────┘

Again we have a bunch of columns that aren’t so useful to us, so let’s see what else is there.

workflows.columns
('workflow_url',
 'workflow_id',
 'triggering_actor',
 'run_number',
 'run_attempt',
 'updated_at',
 'cancel_url',
 'rerun_url',
 'check_suite_node_id',
 'pull_requests',
 'id',
 'node_id',
 'status',
 'repository',
 'jobs_url',
 'previous_attempt_url',
 'artifacts_url',
 'html_url',
 'head_sha',
 'head_repository',
 'run_started_at',
 'head_branch',
 'url',
 'event',
 'name',
 'actor',
 'created_at',
 'check_suite_url',
 'check_suite_id',
 'conclusion',
 'head_commit',
 'logs_url')

We don’t care about many of these for the purposes of this analysis, however we need the id and a few values derived from the run_started_at column.

  • id: the unique identifier of the workflow run
  • run_started_at: the time the workflow run started

We compute the date the run started at so we can later compare it to the dates where we added poetry and switched to the team plan.

workflows = workflows.select(
    _.id, _.run_started_at, started_date=_.run_started_at.date()
)
workflows
┏━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━┓
┃ id         run_started_at             started_date ┃
┡━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━┩
│ int64timestamp('UTC')date         │
├───────────┼───────────────────────────┼──────────────┤
│ 2872718182020-10-04 01:41:55+00:002020-10-04   │
│ 2982467792020-10-09 21:10:32+00:002020-10-09   │
│ 2982458162020-10-09 21:09:44+00:002020-10-09   │
│ 2982458172020-10-09 21:09:44+00:002020-10-09   │
│ 2980377032020-10-09 19:41:09+00:002020-10-09   │
│ 2980112632020-10-09 18:20:59+00:002020-10-09   │
│ 2979287272020-10-09 17:22:33+00:002020-10-09   │
│ 2979199852020-10-09 17:16:42+00:002020-10-09   │
│ 2979160502020-10-09 17:13:56+00:002020-10-09   │
│ 2978475292020-10-09 16:27:03+00:002020-10-09   │
│                     │
└───────────┴───────────────────────────┴──────────────┘

We need to associate jobs and workflows somehow, so let’s join them on the relevant key fields.

joined = jobs.join(workflows, jobs.run_id == workflows.id)
joined
┏━━━━━━━━━━━┳━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━┓
┃ run_id     job_duration  last_job_started_at        last_job_completed_at      id         run_started_at             started_date ┃
┡━━━━━━━━━━━╇━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━┩
│ int64int64timestamp('UTC')timestamp('UTC')int64timestamp('UTC')date         │
├───────────┼──────────────┼───────────────────────────┼───────────────────────────┼───────────┼───────────────────────────┼──────────────┤
│ 24017468811370000002020-09-04 23:20:53+00:002020-09-04 23:39:52+00:002401746882020-09-04 23:20:42+00:002020-09-04   │
│ 24017468811390000002020-09-04 23:20:53+00:002020-09-04 23:39:52+00:002401746882020-09-04 23:20:42+00:002020-09-04   │
│ 24017468930010000002020-09-05 00:20:53+00:002020-09-05 00:20:53+00:002401746892020-09-04 23:20:42+00:002020-09-04   │
│ 2401746894760000002020-09-05 00:20:53+00:002020-09-05 00:20:53+00:002401746892020-09-04 23:20:42+00:002020-09-04   │
│ 2401746894770000002020-09-05 00:20:53+00:002020-09-05 00:20:53+00:002401746892020-09-04 23:20:42+00:002020-09-04   │
│ 24017468910730000002020-09-05 00:20:53+00:002020-09-05 00:20:53+00:002401746892020-09-04 23:20:42+00:002020-09-04   │
│ 24017468902020-09-05 00:20:53+00:002020-09-05 00:20:53+00:002401746892020-09-04 23:20:42+00:002020-09-04   │
│ 2401746896330000002020-09-05 00:20:53+00:002020-09-05 00:20:53+00:002401746892020-09-04 23:20:42+00:002020-09-04   │
│ 2401746895790000002020-09-05 00:20:53+00:002020-09-05 00:20:53+00:002401746892020-09-04 23:20:42+00:002020-09-04   │
│ 24009992410560000002020-09-04 22:49:21+00:002020-09-04 22:49:21+00:002400999242020-09-04 22:02:51+00:002020-09-04   │
│                     │
└───────────┴──────────────┴───────────────────────────┴───────────────────────────┴───────────┴───────────────────────────┴──────────────┘

Sweet! Now we have workflow runs and job runs together in the same table, let’s start exploring summarization.

Let’s encode our knowledge about when the poetry move happened and also when we moved to the team plan.

from datetime import date

POETRY_MERGED_DATE = date(2021, 10, 15)
TEAMIZATION_DATE = date(2022, 11, 28)

Let’s compute some indicator variables indicating whether a given row contains data after poetry changes occurred, and do the same for the team plan.

Let’s also compute queueing time and workflow duration.

stats = joined.select(
    _.started_date,
    _.job_duration,
    has_poetry=_.started_date > POETRY_MERGED_DATE,
    has_team=_.started_date > TEAMIZATION_DATE,
    queueing_time=_.last_job_started_at.delta(_.run_started_at, "microsecond"),
    workflow_duration=_.last_job_completed_at.delta(_.run_started_at, "microsecond"),
)
stats
┏━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━┳━━━━━━━━━━━━┳━━━━━━━━━━┳━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━┓
┃ started_date  job_duration  has_poetry  has_team  queueing_time  workflow_duration ┃
┡━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━╇━━━━━━━━━━━━╇━━━━━━━━━━╇━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━┩
│ dateint64booleanbooleanint64int64             │
├──────────────┼──────────────┼────────────┼──────────┼───────────────┼───────────────────┤
│ 2021-02-18986000000 │ False      │ False    │    14320000001432000000 │
│ 2021-02-181282000000 │ False      │ False    │    14320000001432000000 │
│ 2021-02-18836000000 │ False      │ False    │    14320000001432000000 │
│ 2021-02-18974000000 │ False      │ False    │    14320000001432000000 │
│ 2021-02-18972000000 │ False      │ False    │    14320000001432000000 │
│ 2021-02-181258000000 │ False      │ False    │    14320000001432000000 │
│ 2021-02-18731000000 │ False      │ False    │    14320000001432000000 │
│ 2021-02-181047000000 │ False      │ False    │    14320000001432000000 │
│ 2021-02-18803000000 │ False      │ False    │    14320000001432000000 │
│ 2021-02-180 │ False      │ False    │    14320000001432000000 │
│  │
└──────────────┴──────────────┴────────────┴──────────┴───────────────┴───────────────────┘

Let’s create a column ranging from 0 to 2 inclusive where:

  • 0: no improvements
  • 1: just poetry
  • 2: poetry and the team plan

Let’s also give them some names that’ll look nice on our plots.

stats = stats.mutate(
    raw_improvements=_.has_poetry.cast("int") + _.has_team.cast("int")
).mutate(
    improvements=_.raw_improvements.cases(
        (0, "None"),
        (1, "Poetry"),
        (2, "Poetry + Team Plan"),
        else_="NA",
    ),
    team_plan=ibis.ifelse(_.raw_improvements > 1, "Poetry + Team Plan", "None"),
)
stats
┏━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━┳━━━━━━━━━━━━┳━━━━━━━━━━┳━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━┳━━━━━━━━━━━┓
┃ started_date  job_duration  has_poetry  has_team  queueing_time  workflow_duration  raw_improvements  improvements  team_plan ┃
┡━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━╇━━━━━━━━━━━━╇━━━━━━━━━━╇━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━╇━━━━━━━━━━━┩
│ dateint64booleanbooleanint64int64int64stringstring    │
├──────────────┼──────────────┼────────────┼──────────┼───────────────┼───────────────────┼──────────────────┼──────────────┼───────────┤
│ 2020-08-053013000000 │ False      │ False    │       800000030210000000None        None      │
│ 2020-08-052809000000 │ False      │ False    │       900000028180000000None        None      │
│ 2020-08-05361000000 │ False      │ False    │      390000004000000000None        None      │
│ 2020-08-051626000000 │ False      │ False    │       700000016330000000None        None      │
│ 2020-08-057000000 │ False      │ False    │       9000000160000000None        None      │
│ 2020-08-052914000000 │ False      │ False    │      1100000029250000000None        None      │
│ 2020-08-051868000000 │ False      │ False    │      1000000018780000000None        None      │
│ 2020-08-051999000000 │ False      │ False    │      1000000020090000000None        None      │
│ 2020-08-051834000000 │ False      │ False    │      1200000018460000000None        None      │
│ 2020-08-051890000000 │ False      │ False    │       900000018990000000None        None      │
│          │
└──────────────┴──────────────┴────────────┴──────────┴───────────────┴───────────────────┴──────────────────┴──────────────┴───────────┘

Finally, we can summarize by averaging the different durations, grouping on the variables of interest.

USECS_PER_MIN = 60_000_000

agged = stats.group_by(_.started_date, _.improvements, _.team_plan).agg(
    job=_.job_duration.div(USECS_PER_MIN).mean(),
    workflow=_.workflow_duration.div(USECS_PER_MIN).mean(),
    queueing_time=_.queueing_time.div(USECS_PER_MIN).mean(),
)
agged
┏━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━┳━━━━━━━━━━━┳━━━━━━━━━━━━━━━┓
┃ started_date  improvements        team_plan           job       workflow   queueing_time ┃
┡━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━╇━━━━━━━━━━━╇━━━━━━━━━━━━━━━┩
│ datestringstringfloat64float64float64       │
├──────────────┼────────────────────┼────────────────────┼──────────┼───────────┼───────────────┤
│ 2022-03-01Poetry            None              3.54291717.62386916.112236 │
│ 2023-07-23Poetry + Team PlanPoetry + Team Plan6.37775823.26770021.250076 │
│ 2021-03-26None              None              9.97431017.8261151.752335 │
│ 2021-10-11None              None              5.24345212.96825412.952778 │
│ 2022-01-31Poetry            None              3.61377427.80732526.611106 │
│ 2022-07-01Poetry            None              3.04988012.84166712.191460 │
│ 2022-09-09Poetry            None              2.68701335.55123234.742179 │
│ 2023-06-30Poetry + Team PlanPoetry + Team Plan5.94635622.99243920.968384 │
│ 2023-10-09Poetry + Team PlanPoetry + Team Plan5.97708230.37345828.128672 │
│ 2023-11-20Poetry + Team PlanPoetry + Team Plan3.46905710.3821008.987097 │
│  │
└──────────────┴────────────────────┴────────────────────┴──────────┴───────────┴───────────────┘

If at any point you want to inspect the SQL you’ll be running, ibis has you covered with ibis.to_sql.

ibis.to_sql(agged)
SELECT
  `t7`.`started_date`,
  `t7`.`improvements`,
  `t7`.`team_plan`,
  AVG(ieee_divide(`t7`.`job_duration`, 60000000)) AS `job`,
  AVG(ieee_divide(`t7`.`workflow_duration`, 60000000)) AS `workflow`,
  AVG(ieee_divide(`t7`.`queueing_time`, 60000000)) AS `queueing_time`
FROM (
  SELECT
    `t6`.`started_date`,
    `t6`.`job_duration`,
    `t6`.`has_poetry`,
    `t6`.`has_team`,
    `t6`.`queueing_time`,
    `t6`.`workflow_duration`,
    CAST(`t6`.`has_poetry` AS INT64) + CAST(`t6`.`has_team` AS INT64) AS `raw_improvements`,
    CASE CAST(`t6`.`has_poetry` AS INT64) + CAST(`t6`.`has_team` AS INT64)
      WHEN 0
      THEN 'None'
      WHEN 1
      THEN 'Poetry'
      WHEN 2
      THEN 'Poetry + Team Plan'
      ELSE 'NA'
    END AS `improvements`,
    IF(
      (
        CAST(`t6`.`has_poetry` AS INT64) + CAST(`t6`.`has_team` AS INT64)
      ) > 1,
      'Poetry + Team Plan',
      'None'
    ) AS `team_plan`
  FROM (
    SELECT
      `t4`.`started_date`,
      `t5`.`job_duration`,
      `t4`.`started_date` > DATE(2021, 10, 15) AS `has_poetry`,
      `t4`.`started_date` > DATE(2022, 11, 28) AS `has_team`,
      TIMESTAMP_DIFF(`t5`.`last_job_started_at`, `t4`.`run_started_at`, MICROSECOND) AS `queueing_time`,
      TIMESTAMP_DIFF(`t5`.`last_job_completed_at`, `t4`.`run_started_at`, MICROSECOND) AS `workflow_duration`
    FROM (
      SELECT
        `t0`.`run_id`,
        TIMESTAMP_DIFF(`t0`.`completed_at`, `t0`.`started_at`, MICROSECOND) AS `job_duration`,
        MAX(`t0`.`started_at`) OVER (PARTITION BY `t0`.`run_id` ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS `last_job_started_at`,
        MAX(`t0`.`completed_at`) OVER (PARTITION BY `t0`.`run_id` ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS `last_job_completed_at`
      FROM `ibis-gbq`.`workflows`.`jobs` AS `t0`
    ) AS `t5`
    INNER JOIN (
      SELECT
        `t1`.`id`,
        `t1`.`run_started_at`,
        DATE(`t1`.`run_started_at`) AS `started_date`
      FROM `ibis-gbq`.`workflows`.`workflows` AS `t1`
    ) AS `t4`
      ON `t5`.`run_id` = `t4`.`id`
  ) AS `t6`
) AS `t7`
GROUP BY
  1,
  2,
  3

Plot the Results

Ibis doesn’t have builtin plotting support, so we need to pull our results into pandas.

Here I’m using plotnine (a Python port of ggplot2), which has great integration with pandas DataFrames.

Generally, plotnine works with long, tidy data so let’s use Ibis’s pivot_longer to get there.

agged_pivoted = (
    agged.pivot_longer(
        ("job", "workflow", "queueing_time"),
        names_to="entity",
        values_to="duration",
    )
    .mutate(started_date=_.started_date.cast("timestamp").truncate("D"))
)

df = agged_pivoted.execute()
df.head()
started_date improvements team_plan entity duration
0 2021-10-14 None None job 7.072183
1 2021-10-14 None None workflow 25.551891
2 2021-10-14 None None queueing_time 23.428684
3 2020-09-11 None None job 13.146855
4 2020-09-11 None None workflow 48.506604

Let’s make our theme lighthearted by using xkcd-style plots.

from plotnine import *

theme_set(theme_xkcd())

Create a few labels for our plot.

poetry_label = f"Poetry\n{POETRY_MERGED_DATE}"
team_label = f"Team Plan\n{TEAMIZATION_DATE}"

Without the following line you may see large amount of inconsequential warnings that make the notebook unusable.

import logging

# without this, findfont logging spams the notebook making it unusable
logging.getLogger('matplotlib.font_manager').disabled = True
logging.getLogger('plotnine').disabled = True

Here we show job durations, coloring the points differently depending on whether they have no improvements, poetry, or poetry + team plan.

import pandas as pd


g = (
    ggplot(
        df.loc[df.entity == "job"].reset_index(drop=True),
        aes(x="started_date", y="duration", color="factor(improvements)"),
    )
    + geom_point()
    + geom_vline(
        xintercept=[TEAMIZATION_DATE, POETRY_MERGED_DATE],
        colour=["blue", "green"],
        linetype="dashed",
    )
    + scale_color_brewer(
        palette=7,
        type='qual',
        limits=["None", "Poetry", "Poetry + Team Plan"],
    )
    + geom_text(aes("x", "y"), label=poetry_label, data=pd.DataFrame({"x": [POETRY_MERGED_DATE], "y": [15]}), color="blue")
    + geom_text(aes("x", "y"), label=team_label, data=pd.DataFrame({"x": [TEAMIZATION_DATE], "y": [10]}), color="blue")
    + stat_smooth(method="lm")
    + labs(x="Date", y="Duration (minutes)")
    + ggtitle("Job Duration")
    + theme(
        figure_size=(22, 6),
        legend_position=(0.67, 0.65),
        legend_direction="vertical",
    )
)
g.show()

Result #1: Job Duration

This result is pretty interesting.

A few things pop out to me right away:

  • The move to poetry decreased the average job run duration by quite a bit. No, I’m not going to do any statistical tests.
  • The variability of job run durations also decreased by quite a bit after introducing poetry.
  • Moving to the team plan had little to no effect on job run duration.
g = (
    ggplot(
        df.loc[df.entity != "job"].reset_index(drop=True),
        aes(x="started_date", y="duration", color="factor(improvements)"),
    )
    + facet_wrap("entity", ncol=1)
    + geom_point()
    + geom_vline(
        xintercept=[TEAMIZATION_DATE, POETRY_MERGED_DATE],
        linetype="dashed",
    )
    + scale_color_brewer(
        palette=7,
        type='qual',
        limits=["None", "Poetry", "Poetry + Team Plan"],
    )
    + geom_text(aes("x", "y"), label=poetry_label, data=pd.DataFrame({"x": [POETRY_MERGED_DATE], "y": [75]}), color="blue")
    + geom_text(aes("x", "y"), label=team_label, data=pd.DataFrame({"x": [TEAMIZATION_DATE], "y": [50]}), color="blue")
    + stat_smooth(method="lm")
    + labs(x="Date", y="Duration (minutes)")
    + ggtitle("Workflow Duration")
    + theme(
        figure_size=(22, 13),
        legend_position=(0.68, 0.75),
        legend_direction="vertical",
    )
)
g.show()

Result #2: Workflow Duration and Queueing Time

Another interesting result.

Queueing Time

  • It almost looks like moving to poetry made average queueing time worse. This is probably due to our perception that faster jobs means faster ci. As we see here that isn’t the case
  • Moving to the team plan cut down the queueing time by quite a bit

Workflow Duration

  • Overall workflow duration appears to be strongly influenced by moving to the team plan, which is almost certainly due to the drop in queueing time since we are no longer limited by slow job durations.
  • Perhaps it’s obvious, but queueing time and workflow duration appear to be highly correlated.

In the next plot we’ll look at that correlation.

g = (
    ggplot(agged.execute(), aes(x="workflow", y="queueing_time"))
    + geom_point()
    + geom_rug()
    + facet_grid(". ~ team_plan")
    + labs(x="Workflow Duration (minutes)", y="Queueing Time (minutes)")
    + ggtitle("Workflow Duration vs. Queueing Time")
    + theme(figure_size=(22, 6))
)
g.show()

Result #3: Workflow Duration and Queueing Duration are correlated

It also seems that moving to the team plan (though also the move to poetry might be related here) reduced the variability of both metrics.

We’re lacking data compared to the past so we should wait for more to come in.

Conclusions

It appears that you need both a short queue time and fast individual jobs to minimize time spent in CI.

If you have a short queue time, but long job runs then you’ll be bottlenecked on individual jobs, and if you have more jobs than queue slots then you’ll be blocked on queueing time.

I think we can sum this up nicely:

  • slow jobs, slow queue: 🤷 blocked by jobs or queue
  • slow jobs, fast queue: ❓ blocked by jobs, if jobs are slow enough
  • fast jobs, slow queue: ❗ blocked by queue, with enough jobs
  • fast jobs, fast queue: ✅
Back to top