Skip to content

Commit 2c1e447

Browse files
mroeschkemeeseeksmachine
authored andcommitted
Backport PR pandas-dev#45995: CI: Add single_cpu build
1 parent dc460e3 commit 2c1e447

File tree

2 files changed

+47
-28
lines changed

2 files changed

+47
-28
lines changed

.github/workflows/posix.yml

+37-23
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ on:
1313
- "doc/**"
1414

1515
env:
16-
PYTEST_WORKERS: "auto"
1716
PANDAS_CI: 1
1817

1918
jobs:
@@ -25,33 +24,48 @@ jobs:
2524
timeout-minutes: 120
2625
strategy:
2726
matrix:
28-
settings: [
29-
[actions-38-downstream_compat.yaml, "not slow and not network and not single_cpu", "", "", "", "", ""],
30-
[actions-38-minimum_versions.yaml, "not single_cpu", "", "", "", "", ""],
31-
[actions-38.yaml, "not slow and not network and not single_cpu", "language-pack-it", "it_IT.utf8", "it_IT.utf8", "", ""],
32-
[actions-38.yaml, "not slow and not network and not single_cpu", "language-pack-zh-hans", "zh_CN.utf8", "zh_CN.utf8", "", ""],
33-
[actions-38.yaml, "not single_cpu", "", "", "", "", ""],
34-
[actions-pypy-38.yaml, "not slow and not single_cpu", "", "", "", "", "--max-worker-restart 0"],
35-
[actions-39.yaml, "not single_cpu", "", "", "", "", ""],
36-
[actions-310-numpydev.yaml, "not slow and not network and not single_cpu", "", "", "", "deprecate", "-W error"],
37-
[actions-310.yaml, "not single_cpu", "", "", "", "", ""],
38-
]
27+
env_file: [actions-38.yaml, actions-39.yaml, actions-310.yaml]
28+
pattern: ["not single_cpu", "single_cpu"]
29+
include:
30+
- env_file: actions-38-downstream_compat.yaml
31+
pattern: "not slow and not network and not single_cpu"
32+
pytest_target: "pandas/tests/test_downstream.py"
33+
- env_file: actions-38-minimum_versions.yaml
34+
pattern: "not slow and not network and not single_cpu"
35+
- env_file: actions-38.yaml
36+
pattern: "not slow and not network and not single_cpu"
37+
extra_apt: "language-pack-it"
38+
lang: "it_IT.utf8"
39+
lc_all: "it_IT.utf8"
40+
- env_file: actions-38.yaml
41+
pattern: "not slow and not network and not single_cpu"
42+
extra_apt: "language-pack-zh-hans"
43+
lang: "zh_CN.utf8"
44+
lc_all: "zh_CN.utf8"
45+
- env_file: actions-pypy-38.yaml
46+
pattern: "not slow and not network and not single_cpu"
47+
test_args: "--max-worker-restart 0"
48+
- env_file: actions-310-numpydev.yaml
49+
pattern: "not slow and not network and not single_cpu"
50+
pandas_testing_mode: "deprecate"
51+
test_args: "-W error"
3952
fail-fast: false
4053
env:
41-
ENV_FILE: ci/deps/${{ matrix.settings[0] }}
42-
PATTERN: ${{ matrix.settings[1] }}
43-
EXTRA_APT: ${{ matrix.settings[2] }}
44-
LANG: ${{ matrix.settings[3] }}
45-
LC_ALL: ${{ matrix.settings[4] }}
46-
PANDAS_TESTING_MODE: ${{ matrix.settings[5] }}
47-
TEST_ARGS: ${{ matrix.settings[6] }}
48-
PYTEST_TARGET: pandas
49-
IS_PYPY: ${{ contains(matrix.settings[0], 'pypy') }}
54+
ENV_FILE: ci/deps/${{ matrix.env_file }}
55+
PATTERN: ${{ matrix.pattern }}
56+
EXTRA_APT: ${{ matrix.extra_apt || '' }}
57+
LANG: ${{ matrix.lang || '' }}
58+
LC_ALL: ${{ matrix.lc_all || '' }}
59+
PANDAS_TESTING_MODE: ${{ matrix.pandas_testing_mode || '' }}
60+
TEST_ARGS: ${{ matrix.test_args || '' }}
61+
PYTEST_WORKERS: ${{ contains(matrix.pattern, 'not single_cpu') && 'auto' || '1' }}
62+
PYTEST_TARGET: ${{ matrix.pytest_target || 'pandas' }}
63+
IS_PYPY: ${{ contains(matrix.env_file, 'pypy') }}
5064
# TODO: re-enable coverage on pypy, its slow
51-
COVERAGE: ${{ !contains(matrix.settings[0], 'pypy') }}
65+
COVERAGE: ${{ !contains(matrix.env_file, 'pypy') }}
5266
concurrency:
5367
# https://github.community/t/concurrecy-not-work-for-push/183068/7
54-
group: ${{ github.event_name == 'push' && github.run_number || github.ref }}-${{ matrix.settings[0] }}-${{ matrix.settings[1] }}-${{ matrix.settings[2] }}
68+
group: ${{ github.event_name == 'push' && github.run_number || github.ref }}-${{ matrix.env_file }}-${{ matrix.pattern }}-${{ matrix.extra_apt || '' }}
5569
cancel-in-progress: true
5670

5771
services:

pandas/tests/io/parser/conftest.py

+10-5
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ def csv1(datapath):
8989

9090
_py_parsers_only = [_pythonParser]
9191
_c_parsers_only = [_cParserHighMemory, _cParserLowMemory]
92-
_pyarrow_parsers_only = [_pyarrowParser]
92+
_pyarrow_parsers_only = [pytest.param(_pyarrowParser, marks=pytest.mark.single_cpu)]
9393

9494
_all_parsers = [*_c_parsers_only, *_py_parsers_only, *_pyarrow_parsers_only]
9595

@@ -108,9 +108,8 @@ def all_parsers(request):
108108
parser = request.param()
109109
if parser.engine == "pyarrow":
110110
pytest.importorskip("pyarrow", VERSIONS["pyarrow"])
111-
# Try setting num cpus to 1 to avoid hangs on Azure MacOS/Windows builds
112-
# or better yet find a way to disable threads
113-
# TODO(GH#44584) pytest.mark.single_cpu these tests
111+
# Try finding a way to disable threads all together
112+
# for more stable CI runs
114113
import pyarrow
115114

116115
pyarrow.set_cpu_count(1)
@@ -149,8 +148,14 @@ def _get_all_parser_float_precision_combinations():
149148
params = []
150149
ids = []
151150
for parser, parser_id in zip(_all_parsers, _all_parser_ids):
151+
if hasattr(parser, "values"):
152+
# Wrapped in pytest.param, get the actual parser back
153+
parser = parser.values[0]
152154
for precision in parser.float_precision_choices:
153-
params.append((parser(), precision))
155+
# Re-wrap in pytest.param for pyarrow
156+
mark = pytest.mark.single_cpu if parser.engine == "pyarrow" else ()
157+
param = pytest.param((parser(), precision), marks=mark)
158+
params.append(param)
154159
ids.append(f"{parser_id}-{precision}")
155160

156161
return {"params": params, "ids": ids}

0 commit comments

Comments
 (0)