Skip to content

Commit 11ef486

Browse files
blagininclaude
andauthored
Runs-on for extended CI checks (#20511)
part of #20052 ## Which issue does this PR close? example run: https://github.com/apache/datafusion/actions/runs/22325922758 this recused the run time from 3h to 1h. still a lot (on my mac it runs in 5m!) but that's a start --------- Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
1 parent d59cdfe commit 11ef486

2 files changed

Lines changed: 57 additions & 8 deletions

File tree

.github/workflows/extended.yml

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -66,9 +66,10 @@ jobs:
6666
# Check crate compiles and base cargo check passes
6767
linux-build-lib:
6868
name: linux build test
69-
runs-on: ubuntu-latest
69+
runs-on: ${{ github.repository_owner == 'apache' && format('runs-on={0},family=m8a,cpu=8,image=ubuntu24-full-x64,extras=s3-cache,disk=large,tag=datafusion', github.run_id) || 'ubuntu-latest' }}
7070
# note: do not use amd/rust container to preserve disk space
7171
steps:
72+
- uses: runs-on/action@cd2b598b0515d39d78c38a02d529db87d2196d1e # v2.0.3
7273
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
7374
with:
7475
ref: ${{ github.event.inputs.pr_head_sha }} # will be empty if triggered by push
@@ -80,7 +81,9 @@ jobs:
8081
source $HOME/.cargo/env
8182
rustup toolchain install
8283
- name: Install Protobuf Compiler
83-
run: sudo apt-get install -y protobuf-compiler
84+
run: |
85+
sudo apt-get update
86+
sudo apt-get install -y protobuf-compiler
8487
- name: Prepare cargo build
8588
run: |
8689
cargo check --profile ci --all-targets
@@ -90,9 +93,11 @@ jobs:
9093
linux-test-extended:
9194
name: cargo test 'extended_tests' (amd64)
9295
needs: [linux-build-lib]
93-
runs-on: ubuntu-latest
96+
runs-on: ${{ github.repository_owner == 'apache' && format('runs-on={0},family=m8a,cpu=32,image=ubuntu24-full-x64,extras=s3-cache,disk=large,tag=datafusion,spot=false', github.run_id) || 'ubuntu-latest' }}
97+
# spot=false because the tests are long, https://runs-on.com/configuration/spot-instances/#disable-spot-pricing
9498
# note: do not use amd/rust container to preserve disk space
9599
steps:
100+
- uses: runs-on/action@cd2b598b0515d39d78c38a02d529db87d2196d1e # v2.0.3
96101
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
97102
with:
98103
ref: ${{ github.event.inputs.pr_head_sha }} # will be empty if triggered by push
@@ -106,7 +111,9 @@ jobs:
106111
source $HOME/.cargo/env
107112
rustup toolchain install
108113
- name: Install Protobuf Compiler
109-
run: sudo apt-get install -y protobuf-compiler
114+
run: |
115+
sudo apt-get update
116+
sudo apt-get install -y protobuf-compiler
110117
# For debugging, test binaries can be large.
111118
- name: Show available disk space
112119
run: |
@@ -133,10 +140,11 @@ jobs:
133140
# Check answers are correct when hash values collide
134141
hash-collisions:
135142
name: cargo test hash collisions (amd64)
136-
runs-on: ubuntu-latest
143+
runs-on: ${{ github.repository_owner == 'apache' && format('runs-on={0},family=m8a,cpu=16,image=ubuntu24-full-x64,extras=s3-cache,disk=large,tag=datafusion', github.run_id) || 'ubuntu-latest' }}
137144
container:
138145
image: amd64/rust
139146
steps:
147+
- uses: runs-on/action@cd2b598b0515d39d78c38a02d529db87d2196d1e # v2.0.3
140148
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
141149
with:
142150
ref: ${{ github.event.inputs.pr_head_sha }} # will be empty if triggered by push
@@ -154,10 +162,12 @@ jobs:
154162
155163
sqllogictest-sqlite:
156164
name: "Run sqllogictests with the sqlite test suite"
157-
runs-on: ubuntu-latest
165+
runs-on: ${{ github.repository_owner == 'apache' && format('runs-on={0},family=m8a,cpu=48,image=ubuntu24-full-x64,extras=s3-cache,disk=large,tag=datafusion,spot=false', github.run_id) || 'ubuntu-latest' }}
166+
# spot=false because the tests are long, https://runs-on.com/configuration/spot-instances/#disable-spot-pricing
158167
container:
159168
image: amd64/rust
160169
steps:
170+
- uses: runs-on/action@cd2b598b0515d39d78c38a02d529db87d2196d1e # v2.0.3
161171
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
162172
with:
163173
ref: ${{ github.event.inputs.pr_head_sha }} # will be empty if triggered by push

datafusion/sqllogictest/bin/sqllogictests.rs

Lines changed: 41 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,11 @@ use datafusion::common::runtime::SpawnedTask;
4444
use futures::FutureExt;
4545
use std::ffi::OsStr;
4646
use std::fs;
47-
use std::io::{IsTerminal, stdout};
47+
use std::io::{IsTerminal, stderr, stdout};
4848
use std::path::{Path, PathBuf};
4949
use std::str::FromStr;
50+
use std::sync::Arc;
51+
use std::sync::atomic::{AtomicUsize, Ordering};
5052

5153
#[cfg(feature = "postgres")]
5254
mod postgres_container;
@@ -110,6 +112,13 @@ async fn run_tests() -> Result<()> {
110112

111113
options.warn_on_ignored();
112114

115+
// Print parallelism info for debugging CI performance
116+
eprintln!(
117+
"Running with {} test threads (available parallelism: {})",
118+
options.test_threads,
119+
get_available_parallelism()
120+
);
121+
113122
#[cfg(feature = "postgres")]
114123
initialize_postgres_container(&options).await?;
115124

@@ -147,6 +156,10 @@ async fn run_tests() -> Result<()> {
147156
}
148157

149158
let num_tests = test_files.len();
159+
// For CI environments without TTY, print progress periodically
160+
let is_ci = !stderr().is_terminal();
161+
let completed_count = Arc::new(AtomicUsize::new(0));
162+
150163
let errors: Vec<_> = futures::stream::iter(test_files)
151164
.map(|test_file| {
152165
let validator = if options.include_sqlite
@@ -162,10 +175,12 @@ async fn run_tests() -> Result<()> {
162175
let filters = options.filters.clone();
163176

164177
let relative_path = test_file.relative_path.clone();
178+
let relative_path_for_timing = test_file.relative_path.clone();
165179

166180
let currently_running_sql_tracker = CurrentlyExecutingSqlTracker::new();
167181
let currently_running_sql_tracker_clone =
168182
currently_running_sql_tracker.clone();
183+
let file_start = Instant::now();
169184
SpawnedTask::spawn(async move {
170185
match (
171186
options.postgres_runner,
@@ -227,14 +242,38 @@ async fn run_tests() -> Result<()> {
227242
)
228243
.await?
229244
}
245+
};
246+
// Log slow files (>30s) for CI debugging
247+
let elapsed = file_start.elapsed();
248+
if elapsed.as_secs() > 30 {
249+
eprintln!(
250+
"Slow file: {} took {:.1}s",
251+
relative_path_for_timing.display(),
252+
elapsed.as_secs_f64()
253+
);
230254
}
231-
Ok(()) as Result<()>
255+
Ok(())
232256
})
233257
.join()
234258
.map(move |result| (result, relative_path, currently_running_sql_tracker))
235259
})
236260
// run up to num_cpus streams in parallel
237261
.buffer_unordered(options.test_threads)
262+
.inspect({
263+
let completed_count = Arc::clone(&completed_count);
264+
move |_| {
265+
let completed = completed_count.fetch_add(1, Ordering::Relaxed) + 1;
266+
// In CI (no TTY), print progress every 10% or every 50 files
267+
if is_ci && (completed.is_multiple_of(50) || completed == num_tests) {
268+
eprintln!(
269+
"Progress: {}/{} files completed ({:.0}%)",
270+
completed,
271+
num_tests,
272+
(completed as f64 / num_tests as f64) * 100.0
273+
);
274+
}
275+
}
276+
})
238277
.flat_map(|(result, test_file_path, current_sql)| {
239278
// Filter out any Ok() leaving only the DataFusionErrors
240279
futures::stream::iter(match result {

0 commit comments

Comments
 (0)