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[_.started_at < "2023-01-09"]
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/947152589[{...}, {...}, ... +12]completed2020-08-04 23:54:37+00:00NULL1Test Conda               []MDg6Q2hlY2tSdW45NDcxNTI1ODk=947152589NULLhttps://api.github.com/repos/ibis-project/ibis/actions/runs/195478382195478382https://api.github.com/repos/ibis-project/ibis/check-runs/947152589https://github.com/ibis-project/ibis/runs/947152589?check_suite_focus=trueNULLNULL29c148e9679a53c7bb99755347e336d6c1f4d8c8success   2020-08-04 23:56:50+00:00 │
│ https://api.github.com/repos/ibis-project/ibis/actions/jobs/947152601[{...}, {...}, ... +5]completed2020-08-04 23:54:37+00:00NULL1Test setup miniconda task[]MDg6Q2hlY2tSdW45NDcxNTI2MDE=947152601NULLhttps://api.github.com/repos/ibis-project/ibis/actions/runs/195478382195478382https://api.github.com/repos/ibis-project/ibis/check-runs/947152601https://github.com/ibis-project/ibis/runs/947152601?check_suite_focus=trueNULLNULL29c148e9679a53c7bb99755347e336d6c1f4d8c8failure   2020-08-04 23:56:59+00:00 │
│ https://api.github.com/repos/ibis-project/ibis/actions/jobs/947147571[{...}, {...}, ... +5]completed2020-08-04 23:51:54+00:00NULL1Test setup miniconda task[]MDg6Q2hlY2tSdW45NDcxNDc1NzE=947147571NULLhttps://api.github.com/repos/ibis-project/ibis/actions/runs/195476517195476517https://api.github.com/repos/ibis-project/ibis/check-runs/947147571https://github.com/ibis-project/ibis/runs/947147571?check_suite_focus=trueNULLNULL501d9cc1f2f8d016b1e4fe44ebfc3e1facaa3c91failure   2020-08-04 23:54:48+00:00 │
│ https://api.github.com/repos/ibis-project/ibis/actions/jobs/947147586[{...}, {...}, ... +12]completed2020-08-04 23:51:53+00:00NULL1Test Conda               []MDg6Q2hlY2tSdW45NDcxNDc1ODY=947147586NULLhttps://api.github.com/repos/ibis-project/ibis/actions/runs/195476517195476517https://api.github.com/repos/ibis-project/ibis/check-runs/947147586https://github.com/ibis-project/ibis/runs/947147586?check_suite_focus=trueNULLNULL501d9cc1f2f8d016b1e4fe44ebfc3e1facaa3c91failure   2020-08-04 23:54:15+00:00 │
│ https://api.github.com/repos/ibis-project/ibis/actions/jobs/947144553[{...}, {...}, ... +11]completed2020-08-04 23:50:19+00:00NULL1Test Conda               []MDg6Q2hlY2tSdW45NDcxNDQ1NTM=947144553NULLhttps://api.github.com/repos/ibis-project/ibis/actions/runs/195475525195475525https://api.github.com/repos/ibis-project/ibis/check-runs/947144553https://github.com/ibis-project/ibis/runs/947144553?check_suite_focus=trueNULLNULL963821c370fb8f10f915e4b29e1c78f053c6e7b0failure   2020-08-04 23:52:45+00:00 │
│ https://api.github.com/repos/ibis-project/ibis/actions/jobs/947144585[{...}, {...}, ... +5]completed2020-08-04 23:50:20+00:00NULL1Test setup miniconda task[]MDg6Q2hlY2tSdW45NDcxNDQ1ODU=947144585NULLhttps://api.github.com/repos/ibis-project/ibis/actions/runs/195475525195475525https://api.github.com/repos/ibis-project/ibis/check-runs/947144585https://github.com/ibis-project/ibis/runs/947144585?check_suite_focus=trueNULLNULL963821c370fb8f10f915e4b29e1c78f053c6e7b0failure   2020-08-04 23:52:53+00:00 │
│ https://api.github.com/repos/ibis-project/ibis/actions/jobs/947123154[{...}, {...}, ... +5]completed2020-08-04 23:39:58+00:00NULL1Test setup miniconda task[]MDg6Q2hlY2tSdW45NDcxMjMxNTQ=947123154NULLhttps://api.github.com/repos/ibis-project/ibis/actions/runs/195468677195468677https://api.github.com/repos/ibis-project/ibis/check-runs/947123154https://github.com/ibis-project/ibis/runs/947123154?check_suite_focus=trueNULLNULLfcab3265e8afd70dddc518601b33661d15e19f62failure   2020-08-04 23:42:36+00:00 │
│ https://api.github.com/repos/ibis-project/ibis/actions/jobs/947123167[{...}, {...}, ... +9]completed2020-08-04 23:39:57+00:00NULL1Test Conda               []MDg6Q2hlY2tSdW45NDcxMjMxNjc=947123167NULLhttps://api.github.com/repos/ibis-project/ibis/actions/runs/195468677195468677https://api.github.com/repos/ibis-project/ibis/check-runs/947123167https://github.com/ibis-project/ibis/runs/947123167?check_suite_focus=trueNULLNULLfcab3265e8afd70dddc518601b33661d15e19f62failure   2020-08-04 23:42:15+00:00 │
│ https://api.github.com/repos/ibis-project/ibis/actions/jobs/947111435[{...}, {...}, ... +9]completed2020-08-04 23:34:19+00:00NULL1Test Conda               []MDg6Q2hlY2tSdW45NDcxMTE0MzU=947111435NULLhttps://api.github.com/repos/ibis-project/ibis/actions/runs/195465343195465343https://api.github.com/repos/ibis-project/ibis/check-runs/947111435https://github.com/ibis-project/ibis/runs/947111435?check_suite_focus=trueNULLNULL0b496d97d80f22c5a1a7db27cffd3f71a0d28941failure   2020-08-04 23:36:26+00:00 │
│ https://api.github.com/repos/ibis-project/ibis/actions/jobs/947111464[{...}, {...}, ... +5]completed2020-08-04 23:34:19+00:00NULL1Test setup miniconda task[]MDg6Q2hlY2tSdW45NDcxMTE0NjQ=947111464NULLhttps://api.github.com/repos/ibis-project/ibis/actions/runs/195465343195465343https://api.github.com/repos/ibis-project/ibis/check-runs/947111464https://github.com/ibis-project/ibis/runs/947111464?check_suite_focus=trueNULLNULL0b496d97d80f22c5a1a7db27cffd3f71a0d28941failure   2020-08-04 23:36:28+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')          │
├───────────┼──────────────┼───────────────────────────┼───────────────────────────┤
│ 23650377011090000002020-09-02 19:06:50+00:002020-09-02 19:06:50+00:00 │
│ 2365037706360000002020-09-02 19:06:50+00:002020-09-02 19:06:50+00:00 │
│ 2365037705940000002020-09-02 19:06:50+00:002020-09-02 19:06:50+00:00 │
│ 2365037704590000002020-09-02 19:06:50+00:002020-09-02 19:06:50+00:00 │
│ 2365037704300000002020-09-02 19:06:50+00:002020-09-02 19:06:50+00:00 │
│ 23650377032680000002020-09-02 19:06:50+00:002020-09-02 19:06:50+00:00 │
│ 23650377002020-09-02 19:06:50+00:002020-09-02 19:06:50+00:00 │
│ 2438355375650000002020-09-08 02:45:31+00:002020-09-08 02:45:31+00:00 │
│ 2438355375810000002020-09-08 02:45:31+00:002020-09-08 02:45:31+00:00 │
│ 2438355376440000002020-09-08 02:45:31+00:002020-09-08 02:45:31+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, r…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/21009862100986NULL2812020-08-05 20:01:17+00:00https://api.github.com/repos/ibis-project/ibis/actions/runs/196667191/cancelhttps://api.github.com/repos/ibis-project/ibis/actions/runs/196667191/rerunMDEwOkNoZWNrU3VpdGUxMDEzMDI5NDkw[]196667191MDExOldvcmtmbG93UnVuMTk2NjY3MTkxcompleted{'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/196667191/jobsNULLhttps://api.github.com/repos/ibis-project/ibis/actions/runs/196667191/artifactshttps://github.com/ibis-project/ibis/actions/runs/19666719108855609f1e9ebdeb6197887cf64ecda015d99a8{'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-08-05 19:01:08+00:00actions-lint https://api.github.com/repos/ibis-project/ibis/actions/runs/196667191pull_requestMain  NULL2020-08-05 19:01:08+00:00https://api.github.com/repos/ibis-project/ibis/check-suites/10130294901013029490success   {'tree_id': 'c4277198178ae73c3d9611af464ee75eadbceedc', 'timestamp': datetime.datetime(2020, 8, 5, 19, 0, 57, tzinfo=<UTC>), ... +4}https://api.github.com/repos/ibis-project/ibis/actions/runs/196667191/logs │
│ https://api.github.com/repos/ibis-project/ibis/actions/workflows/21009862100986NULL2712020-08-05 18:59:37+00:00https://api.github.com/repos/ibis-project/ibis/actions/runs/196617109/cancelhttps://api.github.com/repos/ibis-project/ibis/actions/runs/196617109/rerunMDEwOkNoZWNrU3VpdGUxMDEyODM0OTQ3[]196617109MDExOldvcmtmbG93UnVuMTk2NjE3MTA5completed{'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/196617109/jobsNULLhttps://api.github.com/repos/ibis-project/ibis/actions/runs/196617109/artifactshttps://github.com/ibis-project/ibis/actions/runs/1966171097472797f3e4da39d18e53c09566dba5e373094b0{'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-08-05 18:12:34+00:00actions-lint https://api.github.com/repos/ibis-project/ibis/actions/runs/196617109pull_requestMain  NULL2020-08-05 18:12:34+00:00https://api.github.com/repos/ibis-project/ibis/check-suites/10128349471012834947success   {'tree_id': '451472455efc6f20b81f6e1762ac712ec75e77b3', 'timestamp': datetime.datetime(2020, 8, 5, 18, 12, 25, tzinfo=<UTC>), ... +4}https://api.github.com/repos/ibis-project/ibis/actions/runs/196617109/logs │
│ https://api.github.com/repos/ibis-project/ibis/actions/workflows/21009862100986NULL2612020-08-05 18:05:32+00:00https://api.github.com/repos/ibis-project/ibis/actions/runs/196598751/cancelhttps://api.github.com/repos/ibis-project/ibis/actions/runs/196598751/rerunMDEwOkNoZWNrU3VpdGUxMDEyNzc0OTQ4[]196598751MDExOldvcmtmbG93UnVuMTk2NTk4NzUxcompleted{'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/196598751/jobsNULLhttps://api.github.com/repos/ibis-project/ibis/actions/runs/196598751/artifactshttps://github.com/ibis-project/ibis/actions/runs/1965987517452ea048908149a672f681ffd94e3fd0953ab2c{'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-08-05 17:58:48+00:00actions-lint https://api.github.com/repos/ibis-project/ibis/actions/runs/196598751pull_requestMain  NULL2020-08-05 17:58:48+00:00https://api.github.com/repos/ibis-project/ibis/check-suites/10127749481012774948failure   {'tree_id': 'e753c3d693a15eeb99a0d2bd074414ab90dbc85d', 'timestamp': datetime.datetime(2020, 8, 5, 17, 58, 39, tzinfo=<UTC>), ... +4}https://api.github.com/repos/ibis-project/ibis/actions/runs/196598751/logs │
│ https://api.github.com/repos/ibis-project/ibis/actions/workflows/21009862100986NULL2512020-08-05 18:23:52+00:00https://api.github.com/repos/ibis-project/ibis/actions/runs/196596932/cancelhttps://api.github.com/repos/ibis-project/ibis/actions/runs/196596932/rerunMDEwOkNoZWNrU3VpdGUxMDEyNzY2NTk2[]196596932MDExOldvcmtmbG93UnVuMTk2NTk2OTMycompleted{'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/196596932/jobsNULLhttps://api.github.com/repos/ibis-project/ibis/actions/runs/196596932/artifactshttps://github.com/ibis-project/ibis/actions/runs/19659693259daccd16de041b14fa48b9ba53e8aac6495a578{'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-08-05 17:56:34+00:00actions-lint https://api.github.com/repos/ibis-project/ibis/actions/runs/196596932pull_requestMain  NULL2020-08-05 17:56:34+00:00https://api.github.com/repos/ibis-project/ibis/check-suites/10127665961012766596failure   {'tree_id': '342312b7ce508d4d7c91259dd7919cee06508f19', 'timestamp': datetime.datetime(2020, 8, 5, 17, 56, 25, tzinfo=<UTC>), ... +4}https://api.github.com/repos/ibis-project/ibis/actions/runs/196596932/logs │
│ https://api.github.com/repos/ibis-project/ibis/actions/workflows/21009862100986NULL2412020-08-05 17:54:55+00:00https://api.github.com/repos/ibis-project/ibis/actions/runs/196595357/cancelhttps://api.github.com/repos/ibis-project/ibis/actions/runs/196595357/rerunMDEwOkNoZWNrU3VpdGUxMDEyNzU5MjQ1[]196595357MDExOldvcmtmbG93UnVuMTk2NTk1MzU3completed{'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/196595357/jobsNULLhttps://api.github.com/repos/ibis-project/ibis/actions/runs/196595357/artifactshttps://github.com/ibis-project/ibis/actions/runs/1965953571d4f2db372834da7fb33b53c60b59d3f3e40cf7c{'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-08-05 17:54:35+00:00actions-lint https://api.github.com/repos/ibis-project/ibis/actions/runs/196595357pull_requestMain  NULL2020-08-05 17:54:35+00:00https://api.github.com/repos/ibis-project/ibis/check-suites/10127592451012759245failure   {'tree_id': '82f0fdad2916ec10d33f5b6c589dbfe8e4decccd', 'timestamp': datetime.datetime(2020, 8, 5, 17, 54, 26, tzinfo=<UTC>), ... +4}https://api.github.com/repos/ibis-project/ibis/actions/runs/196595357/logs │
│ https://api.github.com/repos/ibis-project/ibis/actions/workflows/21009862100986NULL2312020-08-05 17:17:46+00:00https://api.github.com/repos/ibis-project/ibis/actions/runs/196505866/cancelhttps://api.github.com/repos/ibis-project/ibis/actions/runs/196505866/rerunMDEwOkNoZWNrU3VpdGUxMDEyNDExMDA0[]196505866MDExOldvcmtmbG93UnVuMTk2NTA1ODY2completed{'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/196505866/jobsNULLhttps://api.github.com/repos/ibis-project/ibis/actions/runs/196505866/artifactshttps://github.com/ibis-project/ibis/actions/runs/196505866c36dd6504d86d1994fb36d6a84fb3f302a57642c{'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-08-05 16:28:57+00:00actions-lint https://api.github.com/repos/ibis-project/ibis/actions/runs/196505866pull_requestMain  NULL2020-08-05 16:28:57+00:00https://api.github.com/repos/ibis-project/ibis/check-suites/10124110041012411004failure   {'tree_id': 'c3bf70f2809e48fc5c1dd5b0e7e2321bae4879ea', 'timestamp': datetime.datetime(2020, 8, 5, 16, 28, 48, tzinfo=<UTC>), ... +4}https://api.github.com/repos/ibis-project/ibis/actions/runs/196505866/logs │
│ https://api.github.com/repos/ibis-project/ibis/actions/workflows/21009862100986NULL2212020-08-05 16:47:06+00:00https://api.github.com/repos/ibis-project/ibis/actions/runs/196491206/cancelhttps://api.github.com/repos/ibis-project/ibis/actions/runs/196491206/rerunMDEwOkNoZWNrU3VpdGUxMDEyMzQ4MjUz[]196491206MDExOldvcmtmbG93UnVuMTk2NDkxMjA2completed{'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/196491206/jobsNULLhttps://api.github.com/repos/ibis-project/ibis/actions/runs/196491206/artifactshttps://github.com/ibis-project/ibis/actions/runs/1964912065ffc4dcb3857eae64b5b36f46b378149c0bb2d74{'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-08-05 16:15:44+00:00actions-lint https://api.github.com/repos/ibis-project/ibis/actions/runs/196491206pull_requestMain  NULL2020-08-05 16:15:44+00:00https://api.github.com/repos/ibis-project/ibis/check-suites/10123482531012348253failure   {'tree_id': '3781a799e538f99a2e05399fea4237e5d06d5df2', 'timestamp': datetime.datetime(2020, 8, 5, 16, 12, 4, tzinfo=<UTC>), ... +4}https://api.github.com/repos/ibis-project/ibis/actions/runs/196491206/logs │
│ https://api.github.com/repos/ibis-project/ibis/actions/workflows/21009862100986NULL2112020-08-05 15:10:13+00:00https://api.github.com/repos/ibis-project/ibis/actions/runs/196367166/cancelhttps://api.github.com/repos/ibis-project/ibis/actions/runs/196367166/rerunMDEwOkNoZWNrU3VpdGUxMDExODM5NTE5[]196367166MDExOldvcmtmbG93UnVuMTk2MzY3MTY2completed{'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/196367166/jobsNULLhttps://api.github.com/repos/ibis-project/ibis/actions/runs/196367166/artifactshttps://github.com/ibis-project/ibis/actions/runs/196367166e88d621425c939857b3b9391794c5ddfd7615981{'trees_url': 'https://api.github.com/repos/datapythonista/ibis/git/trees{/sha}', 'teams_url': 'https://api.github.com/repos/datapythonista/ibis/teams', ... +44}2020-08-05 14:36:39+00:00conda-windowshttps://api.github.com/repos/ibis-project/ibis/actions/runs/196367166pull_requestMain  NULL2020-08-05 14:36:39+00:00https://api.github.com/repos/ibis-project/ibis/check-suites/10118395191011839519failure   {'tree_id': 'e093ce6398be8a2fb5331d944d07ef0c5518cc84', 'timestamp': datetime.datetime(2020, 8, 5, 14, 36, 30, tzinfo=<UTC>), ... +4}https://api.github.com/repos/ibis-project/ibis/actions/runs/196367166/logs │
│ https://api.github.com/repos/ibis-project/ibis/actions/workflows/21009862100986NULL2012020-08-05 14:32:14+00:00https://api.github.com/repos/ibis-project/ibis/actions/runs/196316939/cancelhttps://api.github.com/repos/ibis-project/ibis/actions/runs/196316939/rerunMDEwOkNoZWNrU3VpdGUxMDExNjUzNDY5[]196316939MDExOldvcmtmbG93UnVuMTk2MzE2OTM5completed{'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/196316939/jobsNULLhttps://api.github.com/repos/ibis-project/ibis/actions/runs/196316939/artifactshttps://github.com/ibis-project/ibis/actions/runs/196316939702446a96a1b9e6b463084f2f09f2f2106fef8d4{'trees_url': 'https://api.github.com/repos/datapythonista/ibis/git/trees{/sha}', 'teams_url': 'https://api.github.com/repos/datapythonista/ibis/teams', ... +44}2020-08-05 14:01:24+00:00conda-windowshttps://api.github.com/repos/ibis-project/ibis/actions/runs/196316939pull_requestMain  NULL2020-08-05 14:01:24+00:00https://api.github.com/repos/ibis-project/ibis/check-suites/10116534691011653469failure   {'tree_id': 'cdac62bce1914add5faceafd210f32965aa00fe7', 'timestamp': datetime.datetime(2020, 8, 5, 14, 1, 11, tzinfo=<UTC>), ... +4}https://api.github.com/repos/ibis-project/ibis/actions/runs/196316939/logs │
│ https://api.github.com/repos/ibis-project/ibis/actions/workflows/21009862100986NULL1912020-08-05 01:20:00+00:00https://api.github.com/repos/ibis-project/ibis/actions/runs/195537439/cancelhttps://api.github.com/repos/ibis-project/ibis/actions/runs/195537439/rerunMDEwOkNoZWNrU3VpdGUxMDA5MDQ3OTk5[]195537439MDExOldvcmtmbG93UnVuMTk1NTM3NDM5completed{'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/195537439/jobsNULLhttps://api.github.com/repos/ibis-project/ibis/actions/runs/195537439/artifactshttps://github.com/ibis-project/ibis/actions/runs/1955374392ab26f385b87f39b66cf51783d7ab8904fdb4677{'trees_url': 'https://api.github.com/repos/datapythonista/ibis/git/trees{/sha}', 'teams_url': 'https://api.github.com/repos/datapythonista/ibis/teams', ... +44}2020-08-05 00:48:17+00:00conda-windowshttps://api.github.com/repos/ibis-project/ibis/actions/runs/195537439pull_requestMain  NULL2020-08-05 00:48:17+00:00https://api.github.com/repos/ibis-project/ibis/check-suites/10090479991009047999failure   {'tree_id': '33ca23ad93f84344f03894d952d7ffeaf8fb5990', 'timestamp': datetime.datetime(2020, 8, 5, 0, 48, 8, tzinfo=<UTC>), ... +4}https://api.github.com/repos/ibis-project/ibis/actions/runs/195537439/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         │
├───────────┼───────────────────────────┼──────────────┤
│ 1954783822020-08-04 23:54:29+00:002020-08-04   │
│ 1954765172020-08-04 23:51:44+00:002020-08-04   │
│ 1954755252020-08-04 23:50:11+00:002020-08-04   │
│ 1954686772020-08-04 23:39:51+00:002020-08-04   │
│ 1954653432020-08-04 23:34:11+00:002020-08-04   │
│ 1954606112020-08-04 23:29:07+00:002020-08-04   │
│ 1954525052020-08-04 23:17:29+00:002020-08-04   │
│ 1954478862020-08-04 23:11:35+00:002020-08-04   │
│ 1954355212020-08-04 23:02:34+00:002020-08-04   │
│ 1954333852020-08-04 23:01:00+00:002020-08-04   │
│                     │
└───────────┴───────────────────────────┴──────────────┘

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         │
├───────────┼──────────────┼───────────────────────────┼───────────────────────────┼───────────┼───────────────────────────┼──────────────┤
│ 64713727010000002021-03-12 18:59:42+00:002021-03-12 18:59:43+00:006471372702021-03-12 18:59:31+00:002021-03-12   │
│ 6471133248010000002021-03-12 18:51:40+00:002021-03-12 19:06:13+00:006471133242021-03-12 18:51:26+00:002021-03-12   │
│ 6471133248320000002021-03-12 18:51:40+00:002021-03-12 19:06:13+00:006471133242021-03-12 18:51:26+00:002021-03-12   │
│ 6471133243800000002021-03-12 18:51:40+00:002021-03-12 19:06:13+00:006471133242021-03-12 18:51:26+00:002021-03-12   │
│ 6471133243710000002021-03-12 18:51:40+00:002021-03-12 19:06:13+00:006471133242021-03-12 18:51:26+00:002021-03-12   │
│ 6471133247480000002021-03-12 18:51:40+00:002021-03-12 19:06:13+00:006471133242021-03-12 18:51:26+00:002021-03-12   │
│ 6471133247750000002021-03-12 18:51:40+00:002021-03-12 19:06:13+00:006471133242021-03-12 18:51:26+00:002021-03-12   │
│ 6471133243840000002021-03-12 18:51:40+00:002021-03-12 19:06:13+00:006471133242021-03-12 18:51:26+00:002021-03-12   │
│ 6471133243950000002021-03-12 18:51:40+00:002021-03-12 19:06:13+00:006471133242021-03-12 18:51:26+00:002021-03-12   │
│ 6471133248630000002021-03-12 18:51:40+00:002021-03-12 19:06:13+00:006471133242021-03-12 18:51:26+00:002021-03-12   │
│                     │
└───────────┴──────────────┴───────────────────────────┴───────────────────────────┴───────────┴───────────────────────────┴──────────────┘

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-07-251000000 │ False      │ False    │       70000008000000 │
│ 2021-07-250 │ False      │ False    │      1000000010000000 │
│ 2021-07-25389000000 │ False      │ False    │      110000001010000000 │
│ 2021-07-25482000000 │ False      │ False    │      110000001010000000 │
│ 2021-07-25451000000 │ False      │ False    │      110000001010000000 │
│ 2021-07-25519000000 │ False      │ False    │      110000001010000000 │
│ 2021-07-25733000000 │ False      │ False    │      110000001010000000 │
│ 2021-07-25758000000 │ False      │ False    │      110000001010000000 │
│ 2021-07-25388000000 │ False      │ False    │      110000001010000000 │
│ 2021-07-25403000000 │ False      │ False    │      110000001010000000 │
│  │
└──────────────┴──────────────┴────────────┴──────────┴───────────────┴───────────────────┘

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.case()
        .when(0, "None")
        .when(1, "Poetry")
        .when(2, "Poetry + Team Plan")
        .else_("NA")
        .end()
    ),
    team_plan=ibis.where(_.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    │
├──────────────┼──────────────┼────────────┼──────────┼───────────────┼───────────────────┼──────────────────┼──────────────┼───────────┤
│ 2022-10-0843000000 │ True       │ False    │       8000000510000001Poetry      None      │
│ 2022-10-0815000000 │ True       │ False    │     4580000004730000001Poetry      None      │
│ 2022-10-080 │ True       │ False    │      16000000160000001Poetry      None      │
│ 2022-10-088000000 │ True       │ False    │      16000000240000001Poetry      None      │
│ 2022-10-080 │ True       │ False    │      16000000160000001Poetry      None      │
│ 2022-10-080 │ True       │ False    │      27000000270000001Poetry      None      │
│ 2022-10-081000000 │ True       │ False    │      25000000250000001Poetry      None      │
│ 2022-10-080 │ True       │ False    │      25000000250000001Poetry      None      │
│ 2022-10-081000000 │ True       │ False    │      25000000250000001Poetry      None      │
│ 2022-10-082000000 │ True       │ False    │      25000000250000001Poetry      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-08-10Poetry            None              5.35806327.10392122.845206 │
│ 2020-10-02None              None              11.53641029.32564128.941538 │
│ 2022-12-29Poetry + Team PlanPoetry + Team Plan2.6128436.5389345.663799 │
│ 2022-05-25Poetry            None              2.1716209.6412429.223480 │
│ 2021-03-23None              None              9.90827318.1210041.824016 │
│ 2022-10-21Poetry            None              3.34787312.1950769.156614 │
│ 2021-01-31None              None              0.0000000.2666670.266667 │
│ 2021-07-27None              None              0.0166670.1833330.166667 │
│ 2022-03-15Poetry            None              2.2754189.0912008.498640 │
│ 2021-12-12Poetry            None              4.24576715.02757910.329464 │
│  │
└──────────────┴────────────────────┴────────────────────┴───────────┴───────────┴───────────────┘

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)
WITH t0 AS (
  SELECT
    t6.*
  FROM `ibis-gbq`.workflows.jobs AS t6
  WHERE
    t6.`started_at` < '2023-01-09'
), t1 AS (
  SELECT
    t6.`id`,
    t6.`run_started_at`,
    DATE(t6.`run_started_at`) AS `started_date`
  FROM `ibis-gbq`.workflows.workflows AS t6
), t2 AS (
  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`) AS `last_job_started_at`,
    MAX(t0.`completed_at`) OVER (PARTITION BY t0.`run_id`) AS `last_job_completed_at`
  FROM t0
), t3 AS (
  SELECT
    `started_date`,
    `job_duration`,
    `started_date` > CAST('2021-10-15' AS DATE) AS `has_poetry`,
    `started_date` > CAST('2022-11-28' AS DATE) AS `has_team`,
    TIMESTAMP_DIFF(`last_job_started_at`, `run_started_at`, MICROSECOND) AS `queueing_time`,
    TIMESTAMP_DIFF(`last_job_completed_at`, `run_started_at`, MICROSECOND) AS `workflow_duration`
  FROM t2
  INNER JOIN t1
    ON t2.`run_id` = t1.`id`
), t4 AS (
  SELECT
    t3.*,
    CAST(t3.`has_poetry` AS INT64) + CAST(t3.`has_team` AS INT64) AS `raw_improvements`
  FROM t3
)
SELECT
  t5.`started_date`,
  t5.`improvements`,
  t5.`team_plan`,
  avg(IEEE_DIVIDE(t5.`job_duration`, 60000000)) AS `job`,
  avg(IEEE_DIVIDE(t5.`workflow_duration`, 60000000)) AS `workflow`,
  avg(IEEE_DIVIDE(t5.`queueing_time`, 60000000)) AS `queueing_time`
FROM (
  SELECT
    t4.*,
    CASE t4.`raw_improvements`
      WHEN 0
      THEN 'None'
      WHEN 1
      THEN 'Poetry'
      WHEN 2
      THEN 'Poetry + Team Plan'
      ELSE 'NA'
    END AS `improvements`,
    IF(t4.`raw_improvements` > 1, 'Poetry + Team Plan', 'None') AS `team_plan`
  FROM t4
) AS t5
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.

raw_df = agged.execute()
raw_df
started_date improvements team_plan job workflow queueing_time
0 2021-11-03 Poetry None 3.948251 18.438061 17.952411
1 2020-10-01 None None 9.915315 26.179842 26.083483
2 2022-08-23 Poetry None 2.744350 12.839580 12.064237
3 2021-06-09 None None 8.044477 15.938178 1.141473
4 2022-06-13 Poetry None 3.117226 15.782421 14.715766
... ... ... ... ... ... ...
779 2020-12-03 None None 10.913713 39.732489 39.495992
780 2021-10-21 Poetry None 3.781108 31.423465 28.041193
781 2021-12-14 Poetry None 3.240217 13.778852 10.919449
782 2023-01-02 Poetry + Team Plan Poetry + Team Plan 3.144575 10.116722 7.886025
783 2022-02-02 Poetry None 3.119334 25.054407 23.989267

784 rows × 6 columns

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

import pandas as pd

df = pd.melt(
    raw_df,
    id_vars=["started_date", "improvements", "team_plan"],
    var_name="entity",
    value_name="duration",
)
df.head()
started_date improvements team_plan entity duration
0 2021-11-03 Poetry None job 3.948251
1 2020-10-01 None None job 9.915315
2 2022-08-23 Poetry None job 2.744350
3 2021-06-09 None None job 8.044477
4 2022-06-13 Poetry None job 3.117226

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

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

(
    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(x=POETRY_MERGED_DATE, label=poetry_label, y=15, color="blue")
    + geom_text(x=TEAMIZATION_DATE, label=team_label, 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",
    )
)

<Figure Size: (2200 x 600)>

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.
(
    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(x=POETRY_MERGED_DATE, label=poetry_label, y=75, color="blue")
    + geom_text(x=TEAMIZATION_DATE, label=team_label, 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",
    )
)

<Figure Size: (2200 x 1300)>

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.

(
    ggplot(raw_df, 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))
)

<Figure Size: (2200 x 600)>

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