Skip to content

Run cram tests in parallel#1995

Merged
jameshadfield merged 5 commits into
masterfrom
speed-up-tests
May 18, 2026
Merged

Run cram tests in parallel#1995
jameshadfield merged 5 commits into
masterfrom
speed-up-tests

Conversation

@jameshadfield
Copy link
Copy Markdown
Member

@jameshadfield jameshadfield commented May 13, 2026

See #1994 for context. We see typical speedups from 22min to ~5min for test jobs:

Passed: 242  Failed: 0  Total: 242
Wall time:  320.9s
Total CPU:  1275.2s
Speedup:    4.0x

But others failed, and the failures were stochastic. At least tests/functional/tree/cram/iqtree-model-auto.t failed once. My hunch is that some of the tests aren't correctly using the tmp directories cram provides, and thus certain jobs running at the same time can fail.

A number of follow-up commits make all our (cram) tests parallel-safe

@codecov
Copy link
Copy Markdown

codecov Bot commented May 13, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 72.90%. Comparing base (9d178e5) to head (74484d5).
⚠️ Report is 3 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1995      +/-   ##
==========================================
- Coverage   72.92%   72.90%   -0.02%     
==========================================
  Files          85       85              
  Lines       10714    10714              
  Branches     2096     2096              
==========================================
- Hits         7813     7811       -2     
- Misses       2535     2537       +2     
  Partials      366      366              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@jameshadfield jameshadfield requested review from joverlee521 and victorlin and removed request for joverlee521 May 13, 2026 08:42
@victorlin
Copy link
Copy Markdown
Member

See #1996 for an alternative that Tom proposed a while back. I'll still review this as there are additional features compared to the simple drop-in replacement.

@jameshadfield
Copy link
Copy Markdown
Member Author

See #1996 for an alternative that Tom proposed a while back. I'll still review this as there are additional features compared to the simple drop-in replacement.

Thanks! At the least, the last 4 commits of this PR should go in (or equivelents of them), as they're each solid improvements. As for the parallel runner itself, I prefer the approach of this PR (python, using techniques we now use in Augur code itself) to a perl+bash+parallel implementation.

Copy link
Copy Markdown
Member

@victorlin victorlin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't feel strongly about implementation detail, but I prefer the interface of our custom script as a drop-in replacement (e.g. 4177bcb). If we use the custom script in CI we should also use it for local tests, so my suggestions below assume that will be the case.

Comment thread .github/workflows/ci.yaml Outdated
Comment thread scripts/run-cram-parallel.py Outdated
Comment thread scripts/run-cram-parallel.py Outdated
Comment thread scripts/run-cram-parallel.py Outdated
Comment thread scripts/run-cram-parallel.py
Comment thread tests/functional/titers/cram/titers-tree.t
See #1994 for context, and an explanation for the hardcoded SLOW_TESTS

Lots of tests use cram's $TMP directory to create files which seems like
a collision risk, as noted in
<#1176 (comment)>

    Note that the name of the $TMP directory is misleading - although it
    is temporary, it is shared across all tests so you'll have to explicitly
    remove files at the end of each test to avoid affecting other tests. The
    initial directory of each test is a unique directory within $TMP.

however here we run every test file in a separate cram process
(`subprocess.run(["cram", ..., str(test_file)])`) and thus $TMP is
unique per test in this parallel setup. Over time it'd probably still
be nice to change our usage of $TMP to $CRAMTMP/$TESTFILE, but that's
not needed here.

Code written entirely by Claude Opus 4.6
`augur tree` creates IQ-TREE intermediate files (.log, .iqtree.log,
-delim.fasta, .treefile, etc.) next to the input alignment file. When tests
pointed at the shared data/ directory, parallel runs would collide on those
intermediates.

All code by Claude Opus 4.6
These tests all ran in the source directory (the setup script used
`pushd "$TESTDIR"`) which posed a collision risk if they can now run
in parallel. They now run in a (unique) $CRAMTMP/$TESTFILE folder
(the cram default).

Fix by Claude opus 4.6
Missing `--output-node-data` arguments were causing a node-data JSON to
be written based off the input alignment path, i.e.
tests/functional/refine/data/aligned.node_data.json
The previous messaging ("default: None") implied that no tree/node-data
JSON would be created, which isn't the case.
@jameshadfield
Copy link
Copy Markdown
Member Author

CI failures are due to rabies (ingest) and both unrelated to this PR and observed in multiple PRs this morning. Merging this PR now to speed up tests in Augur, but as per dev-chat last week this runner script may be replaced by prysk/pytest shortly

@jameshadfield jameshadfield merged commit 5ac3b06 into master May 18, 2026
34 of 35 checks passed
@jameshadfield jameshadfield deleted the speed-up-tests branch May 18, 2026 01:47
@victorlin victorlin linked an issue May 18, 2026 that may be closed by this pull request
@joverlee521 joverlee521 mentioned this pull request May 19, 2026
6 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

CI tests take too long

2 participants