Skip to content

Commit cb4172b

Browse files
authored
Merge pull request #510 from PSLmodels/fix-pipeline-output-buffering
Restore real-time terminal output during pipeline stages (fixes regression introduced in PR 497)
2 parents af9dfb7 + 0460b64 commit cb4172b

1 file changed

Lines changed: 12 additions & 5 deletions

File tree

Makefile

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,25 +22,32 @@ clean:
2222
# etc.) can be reviewed afterward via `make warnings`. Per-stage
2323
# (rather than shared) log files avoid interleaving when the recipes
2424
# are run with `make -j`.
25+
#
26+
# `python -u` forces unbuffered stdout/stderr. Without it, piping
27+
# python through `tee` causes python to switch from line buffering
28+
# (its default when stdout is a terminal) to block buffering (its
29+
# default when stdout is a pipe), which makes long-running stages
30+
# appear silent on the terminal until the buffer flushes. The `-u`
31+
# flag preserves the pre-tee behavior of seeing progress in real time.
2532

2633
tmd/storage/output/tmd.csv.gz:
27-
python tmd/create_taxcalc_input_variables.py 2>&1 \
34+
python -u tmd/create_taxcalc_input_variables.py 2>&1 \
2835
| tee tmd/storage/output/make_data_tmd.log
2936

3037
tmd/storage/output/tmd_weights.csv.gz:
31-
python tmd/create_taxcalc_sampling_weights.py 2>&1 \
38+
python -u tmd/create_taxcalc_sampling_weights.py 2>&1 \
3239
| tee tmd/storage/output/make_data_weights.log
3340

3441
tmd/storage/output/tmd_growfactors.csv:
35-
python tmd/create_taxcalc_growth_factors.py 2>&1 \
42+
python -u tmd/create_taxcalc_growth_factors.py 2>&1 \
3643
| tee tmd/storage/output/make_data_growfactors.log
3744

3845
tmd/storage/output/cached_files:
39-
python tmd/create_taxcalc_cached_files.py 2>&1 \
46+
python -u tmd/create_taxcalc_cached_files.py 2>&1 \
4047
| tee tmd/storage/output/make_data_cached.log
4148

4249
tmd/storage/output/preimpute_tmd.csv.gz:
43-
python tmd/create_taxcalc_imputed_variables.py 2>&1 \
50+
python -u tmd/create_taxcalc_imputed_variables.py 2>&1 \
4451
| tee tmd/storage/output/make_data_preimpute.log
4552

4653
.PHONY=tmd_files

0 commit comments

Comments
 (0)