Skip to content

Commit 5de80a1

Browse files
committed
Merge remote-tracking branch 'refs/remotes/upstream/main' into on-error-abort
# Conflicts: # cwltool/executors.py
2 parents 1e4b9ca + 048eb55 commit 5de80a1

File tree

12 files changed

+279
-18
lines changed

12 files changed

+279
-18
lines changed

.circleci/config.yml

Lines changed: 101 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
1+
version: 2.1
2+
3+
parameters:
4+
REF:
5+
type: string
6+
default: ''
7+
description: Optional tag to build
8+
9+
jobs:
10+
arm-wheels:
11+
parameters:
12+
build:
13+
type: string
14+
image:
15+
type: string
16+
17+
machine:
18+
image: ubuntu-2404:current
19+
resource_class: arm.medium # 2 vCPUs
20+
21+
environment:
22+
CIBW_ARCHS: "aarch64"
23+
CIBW_MANYLINUX_AARCH64_IMAGE: "<< parameters.image >>"
24+
CIBW_MUSLLINUX_AARCH64_IMAGE: "<< parameters.image >>"
25+
CIBW_BUILD: "<< parameters.build >>"
26+
27+
steps:
28+
- checkout
29+
- when:
30+
condition: << pipeline.parameters.REF >>
31+
steps:
32+
- run:
33+
name: Checkout branch/tag << pipeline.parameters.REF >>
34+
command: |
35+
echo "Switching to branch/tag << pipeline.parameters.REF >> if it exists"
36+
git checkout << pipeline.parameters.REF >> || true
37+
git pull origin << pipeline.parameters.REF >> || true
38+
- run:
39+
name: install cibuildwheel and other build reqs
40+
command: |
41+
python3 -m pip install --upgrade pip setuptools setuptools_scm[toml]
42+
python3 -m pip install -rcibw-requirements.txt
43+
44+
- run:
45+
name: pip freeze
46+
command: |
47+
python3 -m pip freeze
48+
49+
- run:
50+
name: list wheels
51+
command: |
52+
python3 -m cibuildwheel . --print-build-identifiers
53+
54+
- run:
55+
name: cibuildwheel
56+
command: |
57+
python3 -m cibuildwheel .
58+
59+
- store_test_results:
60+
path: test-results/
61+
62+
- store_artifacts:
63+
path: wheelhouse/
64+
65+
# - when:
66+
# condition:
67+
# or:
68+
# - matches:
69+
# pattern: ".+"
70+
# value: "<< pipeline.git.tag >>"
71+
# - << pipeline.parameters.REF >>
72+
# steps:
73+
# - run:
74+
# environment:
75+
# TWINE_NONINTERACTIVE: "1"
76+
# command: |
77+
# python3 -m pip install twine
78+
# python3 -m twine upload --verbose --skip-existing wheelhouse/*
79+
80+
workflows:
81+
wheels: # This is the name of the workflow, feel free to change it to better match your workflow.
82+
# Inside the workflow, you define the jobs you want to run.
83+
jobs:
84+
- arm-wheels:
85+
name: arm-wheels-manylinux_2_28
86+
filters:
87+
branches:
88+
only: main
89+
tags:
90+
only: /.*/
91+
build: "*manylinux*"
92+
image: quay.io/pypa/manylinux_2_28_aarch64
93+
- arm-wheels:
94+
name: arm-wheels-musllinux_1_2
95+
filters:
96+
branches:
97+
only: main
98+
tags:
99+
only: /.*/
100+
build: "*musllinux*"
101+
image: quay.io/pypa/musllinux_1_2_aarch64

.github/workflows/ci-tests.yml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -44,11 +44,11 @@ jobs:
4444
with:
4545
fetch-depth: 0
4646

47-
- name: Set up Singularity
47+
- name: Set up Singularity and environment-modules
4848
if: ${{ matrix.step == 'unit' || matrix.step == 'mypy' }}
4949
run: |
5050
wget --no-verbose https://github.com/sylabs/singularity/releases/download/v3.10.4/singularity-ce_3.10.4-focal_amd64.deb
51-
sudo apt-get install -y ./singularity-ce_3.10.4-focal_amd64.deb
51+
sudo apt-get install -y ./singularity-ce_3.10.4-focal_amd64.deb environment-modules
5252
5353
- name: Give the test runner user a name to make provenance happy.
5454
if: ${{ matrix.step == 'unit' || matrix.step == 'mypy' }}
@@ -132,10 +132,10 @@ jobs:
132132
with:
133133
fetch-depth: 0
134134

135-
- name: Set up Singularity
135+
- name: Set up Singularity and environment-modules
136136
run: |
137137
wget --no-verbose https://github.com/sylabs/singularity/releases/download/v3.10.4/singularity-ce_3.10.4-focal_amd64.deb
138-
sudo apt-get install -y ./singularity-ce_3.10.4-focal_amd64.deb
138+
sudo apt-get install -y ./singularity-ce_3.10.4-focal_amd64.deb environment-modules
139139
140140
- name: Give the test runner user a name to make provenance happy.
141141
run: sudo usermod -c 'CI Runner' "$(whoami)"
@@ -180,11 +180,11 @@ jobs:
180180
steps:
181181
- uses: actions/checkout@v4
182182

183-
- name: Set up Singularity
183+
- name: Set up Singularity and environment-modules
184184
if: ${{ matrix.container == 'singularity' }}
185185
run: |
186186
wget --no-verbose https://github.com/sylabs/singularity/releases/download/v3.10.4/singularity-ce_3.10.4-jammy_amd64.deb
187-
sudo apt-get install -y ./singularity-ce_3.10.4-jammy_amd64.deb
187+
sudo apt-get install -y ./singularity-ce_3.10.4-jammy_amd64.deb environment-modules
188188
189189
- name: Singularity cache
190190
if: ${{ matrix.container == 'singularity' }}
@@ -229,10 +229,10 @@ jobs:
229229
steps:
230230
- uses: actions/checkout@v4
231231

232-
- name: Set up Singularity
232+
- name: Set up Singularity and environment-modules
233233
run: |
234234
wget --no-verbose https://github.com/sylabs/singularity/releases/download/v3.10.4/singularity-ce_3.10.4-jammy_amd64.deb
235-
sudo apt-get install -y ./singularity-ce_3.10.4-jammy_amd64.deb
235+
sudo apt-get install -y ./singularity-ce_3.10.4-jammy_amd64.deb environment-modules
236236
237237
- name: Set up Python
238238
uses: actions/setup-python@v5

.github/workflows/wheels.yml

Lines changed: 127 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,127 @@
1+
name: Python package build and publish
2+
3+
on:
4+
release:
5+
types: [published]
6+
workflow_dispatch: {}
7+
repository_dispatch: {}
8+
push:
9+
branches:
10+
- main
11+
12+
concurrency:
13+
group: wheels-${{ github.event.pull_request.number || github.ref }}
14+
cancel-in-progress: true
15+
16+
jobs:
17+
build_wheels:
18+
name: ${{ matrix.image }} wheels
19+
runs-on: ubuntu-24.04
20+
strategy:
21+
matrix:
22+
include:
23+
- image: manylinux_2_28_x86_64
24+
build: "*manylinux*"
25+
- image: musllinux_1_2_x86_64
26+
build: "*musllinux*"
27+
28+
steps:
29+
- uses: actions/checkout@v4
30+
if: ${{ github.event_name != 'repository_dispatch' }}
31+
with:
32+
fetch-depth: 0 # slow, but gets all the tags
33+
- uses: actions/checkout@v4
34+
if: ${{ github.event_name == 'repository_dispatch' }}
35+
with:
36+
fetch-depth: 0 # slow, but gets all the tags
37+
ref: ${{ github.event.client_payload.ref }}
38+
39+
# - name: Set up QEMU
40+
# if: runner.os == 'Linux'
41+
# uses: docker/setup-qemu-action@v2
42+
# with:
43+
# platforms: all
44+
45+
- name: Build wheels
46+
uses: pypa/[email protected]
47+
env:
48+
CIBW_BUILD: ${{ matrix.build }}
49+
CIBW_MANYLINUX_X86_64_IMAGE: quay.io/pypa/${{ matrix.image }}
50+
CIBW_MUSLLINUX_X86_64_IMAGE: quay.io/pypa/${{ matrix.image }}
51+
# configure cibuildwheel to build native 64-bit archs ('auto64'), and some
52+
# emulated ones
53+
# Linux arm64 wheels are built on circleci
54+
CIBW_ARCHS_LINUX: auto64 # ppc64le s390x
55+
56+
- uses: actions/upload-artifact@v4
57+
with:
58+
name: artifact-${{ matrix.image }}
59+
path: ./wheelhouse/*.whl
60+
61+
build_sdist:
62+
name: Build source distribution
63+
runs-on: ubuntu-24.04
64+
steps:
65+
- uses: actions/checkout@v4
66+
if: ${{ github.event_name != 'repository_dispatch' }}
67+
with:
68+
fetch-depth: 0 # slow, but gets all the tags
69+
- uses: actions/checkout@v4
70+
if: ${{ github.event_name == 'repository_dispatch' }}
71+
with:
72+
fetch-depth: 0 # slow, but gets all the tags
73+
ref: ${{ github.event.client_payload.ref }}
74+
75+
- name: Build sdist
76+
run: pipx run build --sdist
77+
78+
- uses: actions/upload-artifact@v4
79+
with:
80+
name: artifact-source
81+
path: dist/*.tar.gz
82+
83+
build_wheels_macos:
84+
name: Build wheels on ${{ matrix.os }}
85+
runs-on: ${{ matrix.os }}
86+
strategy:
87+
matrix:
88+
# macos-13 is an intel runner, macos-14 is apple silicon
89+
os: [macos-13, macos-14]
90+
steps:
91+
- uses: actions/checkout@v4
92+
if: ${{ github.event_name != 'repository_dispatch' }}
93+
with:
94+
fetch-depth: 0 # slow, but gets all the tags
95+
- uses: actions/checkout@v4
96+
if: ${{ github.event_name == 'repository_dispatch' }}
97+
with:
98+
fetch-depth: 0 # slow, but gets all the tags
99+
ref: ${{ github.event.client_payload.ref }}
100+
101+
- name: Build wheels
102+
uses: pypa/[email protected]
103+
104+
- uses: actions/upload-artifact@v4
105+
with:
106+
name: artifact-${{ matrix.os }}-${{ strategy.job-index }}
107+
path: ./wheelhouse/*.whl
108+
109+
# upload_pypi:
110+
# needs: [build_wheels, build_sdist]
111+
# runs-on: ubuntu-24.04
112+
# environment: deploy
113+
# permissions:
114+
# id-token: write
115+
# if: (github.event_name == 'release' && github.event.action == 'published') || (github.event_name == 'repository_dispatch' && github.event.client_payload.publish_wheel == true)
116+
# steps:
117+
# - uses: actions/download-artifact@v4
118+
# with:
119+
# # unpacks default artifact into dist/
120+
# pattern: artifact-*
121+
# merge-multiple: true
122+
# path: dist
123+
124+
# - name: Publish package distributions to PyPI
125+
# uses: pypa/gh-action-pypi-publish@release/v1
126+
# with:
127+
# skip-existing: true

MANIFEST.in

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ include tests/reloc/dir2/*
1919
include tests/checker_wf/*
2020
include tests/subgraph/*
2121
include tests/input_deps/*
22+
recursive-include tests/test_deps_env
2223
include tests/trs/*
2324
include tests/wf/generator/*
2425
include cwltool/py.typed

README.rst

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,22 @@ and ``--tmp-outdir-prefix`` to somewhere under ``/Users``::
189189

190190
$ cwl-runner --tmp-outdir-prefix=/Users/username/project --tmpdir-prefix=/Users/username/project wc-tool.cwl wc-job.json
191191

192+
193+
Docker default platform on macOS with Apple Silicon
194+
===================================================
195+
196+
If macOS users want to run CWL tools/workflows using ``cwltool`` with Docker and their software containers only have support for amd64 (64-bit x86) CPUs, but they have an Apple Silicon (aarch64/arm64) CPU,
197+
they run into the error:
198+
199+
WARNING: The requested image's platform (linux/amd64) does not match the detected host platform (linux/arm64/v8) and no specific platform was requested.
200+
201+
To fix this, export the following environment variable before executing `cwltool`:
202+
203+
``export DOCKER_DEFAULT_PLATFORM=linux/amd64``
204+
205+
To automatically have this variable set in the future, add the same command to ones respective shell profile (e.g. ``~/.zshrc``, ``~/.bash_profile``).
206+
207+
192208
Using uDocker
193209
=============
194210

cibw-requirements.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
cibuildwheel==2.21.3

cwltool/executors.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -278,7 +278,7 @@ def __init__(self) -> None:
278278
self.pending_jobs_lock = threading.Lock()
279279

280280
self.max_ram = int(psutil.virtual_memory().available / 2**20)
281-
self.max_cores = float(psutil.cpu_count())
281+
self.max_cores = float(psutil.cpu_count() or 1)
282282
self.max_cuda = cuda_version_and_device_count()[1]
283283
self.allocated_ram = float(0)
284284
self.allocated_cores = float(0)
@@ -439,7 +439,7 @@ def run_jobs(
439439
logger: logging.Logger,
440440
runtime_context: RuntimeContext,
441441
) -> None:
442-
self.taskqueue: TaskQueue = TaskQueue(threading.Lock(), psutil.cpu_count(), runtime_context)
442+
self.taskqueue: TaskQueue = TaskQueue(threading.Lock(), int(math.ceil(self.max_cores)), runtime_context)
443443
try:
444444
jobiter = process.job(job_order_object, self.output_callback, runtime_context)
445445

cwltool/software_requirements.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,8 @@ class DependenciesConfiguration:
5050

5151
def __init__(self, args: argparse.Namespace) -> None:
5252
"""Initialize."""
53+
self.tool_dependency_dir: Optional[str] = None
54+
self.dependency_resolvers_config_file: Optional[str] = None
5355
conf_file = getattr(args, "beta_dependency_resolvers_configuration", None)
5456
tool_dependency_dir = getattr(args, "beta_dependencies_directory", None)
5557
conda_dependencies = getattr(args, "beta_conda_dependencies", None)

lint-requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
flake8-bugbear<24.9
1+
flake8-bugbear<24.11
22
black==24.*
33
codespell

pyproject.toml

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ requires = [
66
"types-requests",
77
"types-psutil",
88
"importlib_resources>=1.4;python_version<'3.9'",
9-
"ruamel.yaml>=0.16.0,<0.18",
9+
"ruamel.yaml>=0.16.0,<0.19",
1010
"schema-salad>=8.7,<9",
1111
"cwl-utils>=0.32",
1212
"toml",
@@ -17,6 +17,19 @@ build-backend = "setuptools.build_meta"
1717
[tool.setuptools_scm]
1818
write_to = "cwltool/_version.py"
1919

20+
[tool.cibuildwheel]
21+
test-command = "python -m pytest --ignore cwltool/schemas -n logical --dist worksteal --junitxml={project}/test-results/junit_$(python -V | awk '{print $2}')_${AUDITWHEEL_PLAT}.xml -k 'not (test_bioconda or test_env_filtering or test_udocker)' --pyargs cwltool"
22+
test-requires = "-r test-requirements.txt"
23+
test-extras = "deps"
24+
skip = "pp*"
25+
# ^ skip building wheels on PyPy (any version)
26+
build-verbosity = 1
27+
environment = { CWLTOOL_USE_MYPYC="1", MYPYPATH="$(pwd)/mypy-stubs" }
28+
29+
# Install system library
30+
[tool.cibuildwheel.linux]
31+
before-all = "apk add libxml2-dev libxslt-dev nodejs || yum install -y libxml2-devel libxslt-devel nodejs environment-modules || apt-get install -y --no-install-recommends libxml2-dev libxslt-dev nodejs environment-modules"
32+
2033
[tool.black]
2134
line-length = 100
2235
target-version = [ "py39" ]

0 commit comments

Comments
 (0)