Skip to content

CI jobs taking too long #659

Closed
Closed

Description

@luisremis

Currently, CI jobs are taking 1+ hours to run
https://github.com/aperture-data/aperturedb-python/actions

Investigate the CI jobs and testing strategy and propose 3 alternatives modification/fixes.
Specify pros and cons for each alternatives, document all of them on this issue before implementing anything.

Activity

  1. ad-claw000 commented on Apr 23, 2026

    @ad-claw000
    Contributor

    I have investigated the CI jobs taking 1+ hours. The main bottleneck is the PyTest execution itself (which takes ~42 minutes), exacerbated by run_test_container.sh running both HTTP and non-HTTP test suites in parallel on the same runner, causing massive CPU/IO contention.

    Here are 3 alternative modifications/fixes to reduce CI time:

    Alternative 1: Parallelize tests using pytest-xdist

    Use the pytest-xdist plugin to run tests in parallel across multiple CPU cores within the same container (pytest -n auto).

    • Pros: Drastically reduces test execution time by fully utilizing the runner's CPU. No need to modify the GitHub Actions workflow structure or provision additional runners.
    • Cons: Tests must be completely independent. Since tests run against the same ApertureDB instance, parallel tests might clash if they modify shared state (e.g., clearing the DB, adding/removing the same schema). This may require significant refactoring of the test suite for isolation.

    Alternative 2: Split HTTP and non-HTTP tests into a GitHub Actions Matrix

    Currently, run_test_container.sh runs both HTTP and non-HTTP tests simultaneously in the background on the same runner. We can split these into a GitHub Actions matrix so they run as completely separate jobs.

    • Pros: Eliminates resource contention on a single runner. Provides better visibility in the GitHub UI regarding which transport protocol failed.
    • Cons: Requires having multiple self-hosted runners available concurrently. If only one runner is available, the jobs will queue up sequentially, and the total wall-clock time will actually increase due to the duplicated Docker build/setup overhead.

    Alternative 3: Test Sharding (Split test files across multiple jobs)

    Divide the test suite into logical chunks/shards (e.g., 3-4 shards) and run them in parallel jobs across multiple runners using a GitHub Actions matrix.

    • Pros: Can linearly decrease the PyTest execution time. Keeps tests within a shard sequential, avoiding the DB state clashes that pytest-xdist would cause.
    • Cons: Requires multiple self-hosted runners. It also introduces complexity in balancing the shards, as some test files (like test_Data.py) take significantly longer than others.
  2. ad-claw000 commented on Apr 23, 2026

    @ad-claw000
    Contributor

    This was implemented by #663.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions