Skip to content

Commit 638423f

Browse files
committed
[tools] Fix hanging of docs.modm.io generator
1 parent 0588172 commit 638423f

File tree

3 files changed

+27
-18
lines changed

3 files changed

+27
-18
lines changed

.github/workflows/deploy-docs.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,9 @@ jobs:
4949
5050
# Niklas: Running on the old container until I can figure out why the doc generator hangs
5151
api-docs-all:
52-
runs-on: ubuntu-24.04
52+
runs-on: ubuntu-20.04
5353
container:
54-
image: ghcr.io/modm-ext/modm-build-base:2024-12-01
54+
image: ghcr.io/modm-ext/modm-build-base:2022-09-27
5555
steps:
5656
- name: Check out repository
5757
uses: actions/checkout@v4
@@ -62,7 +62,7 @@ jobs:
6262
git config --global --add safe.directory /__w/modm/modm
6363
- name: Update lbuild
6464
run: |
65-
pip3 install --upgrade --upgrade-strategy=eager --break-system-packages modm
65+
pip3 install --upgrade --upgrade-strategy=eager modm
6666
- name: Full run of docs.modm.io-generator-script
6767
run: |
6868
export TERM=xterm-256color

.github/workflows/linux.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -393,9 +393,18 @@ jobs:
393393
- name: Fix Git permission/ownership problem
394394
run: |
395395
git config --global --add safe.directory /__w/modm/modm
396+
- name: Check environment
397+
run: |
398+
env
399+
locale -a
400+
python --version || true
401+
python3 --version || true
402+
python3 -c "import os; print(os.cpu_count())"
396403
- name: Update lbuild
397404
run: |
398405
pip3 install --upgrade --upgrade-strategy=eager modm
406+
which lbuild
407+
lbuild --version
399408
- name: Install mkdocs mkdocs-material (pip)
400409
run: |
401410
pip3 install --upgrade --upgrade-strategy=eager mkdocs mkdocs-material

tools/scripts/docs_modm_io_generator.py

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -145,17 +145,17 @@ def main():
145145
print("Starting to generate documentation...")
146146
template_overview(output_dir, device_list, board_list, template_path)
147147
print(f"... for {len(device_list) + len(board_list)} devices, estimated memory footprint is {len(device_list)*70+2000} MB")
148+
# We can only pass one argument to pool.map
149+
devices = [f'python3 {filepath} --target-job "{modm_path}|{tempdir}|{dev}||{args.deduplicate}|{args.compress}"' for dev in device_list]
150+
devices += [f'python3 {filepath} --target-job "{modm_path}|{tempdir}|{dev}|{brd}|{args.deduplicate}|{args.compress}"' for (brd, dev) in board_list]
151+
devices = list(set(devices))
152+
# Run the first generation first so that the other jobs can already deduplicate properly
153+
results = [subprocess.call(devices[0], shell=True)]
148154
with ThreadPool(args.jobs) as pool:
149-
# We can only pass one argument to pool.map
150-
devices = [f'python3 {filepath} --target-job "{modm_path}|{tempdir}|{dev}||{args.deduplicate}|{args.compress}"' for dev in device_list]
151-
devices += [f'python3 {filepath} --target-job "{modm_path}|{tempdir}|{dev}|{brd}|{args.deduplicate}|{args.compress}"' for (brd, dev) in board_list]
152-
devices = list(set(devices))
153-
# Run the first generation first so that the other jobs can already deduplicate properly
154-
results = [subprocess.call(devices[0], shell=True)]
155155
results += pool.map(lambda d: subprocess.call(d, shell=True), devices[1:])
156-
# remove all the hash files
157-
for file in (output_dir / "develop/api").glob("*.hash"):
158-
file.unlink()
156+
# remove all the hash files
157+
for file in (output_dir / "develop/api").glob("*.hash"):
158+
file.unlink()
159159
if args.compress:
160160
print("Zipping docs ...")
161161
# Zipping is *much* faster via command line than via python!
@@ -180,7 +180,7 @@ def create_target(argument):
180180
tempdir = Path(tempdir)
181181
output_dir = board if board else device
182182
try:
183-
print(f"Generating documentation for {output_dir}...")
183+
print(f"Generating documentation for {output_dir}...", flush=True)
184184

185185
options = [f"modm:target={device}"]
186186
if device.startswith("at"):
@@ -202,19 +202,19 @@ def create_target(argument):
202202

203203
builder.build(output_dir, modules)
204204

205-
print(f"Executing: (cd {output_dir}/modm/docs/ && doxypress doxypress.json)")
205+
print(f"Executing: (cd {output_dir}/modm/docs/ && doxypress doxypress.json)", flush=True)
206206
retval = subprocess.call(f"(cd {output_dir}/modm/docs/ && doxypress doxypress.json > /dev/null 2>&1)", shell=True)
207207
# retval = subprocess.call(f"(cd {output_dir}/modm/docs/ && doxygen doxyfile.cfg > /dev/null 2>&1)", shell=True)
208208
if retval != 0:
209-
print(f"Error {retval} generating documentation for device {output_dir}.")
209+
print(f"Error {retval} generating documentation for device {output_dir}.", flush=True)
210210
return False
211-
print(f"Finished generating documentation for device {output_dir}.")
211+
print(f"Finished generating documentation for device {output_dir}.", flush=True)
212212

213213
srcdir = (tempdir / output_dir / "modm/docs/html")
214214
destdir = tempdir / "output/develop/api" / output_dir
215215

216216
if deduplicate == "True":
217-
print(f"Deduplicating files for {device}...")
217+
print(f"Deduplicating files for {device}...", flush=True)
218218
# Find and build the hash symlink database
219219
hashdb = {}
220220
for hashes in tempdir.glob("output/develop/api/*.hash"):
@@ -266,7 +266,7 @@ def create_target(argument):
266266
srcdir.rename(destdir)
267267
return True
268268
except Exception as e:
269-
print(f"Error generating documentation for device {output_dir}: {e}")
269+
print(f"Error generating documentation for device {output_dir}: {e}", flush=True)
270270
return False
271271

272272

0 commit comments

Comments
 (0)