Skip to content

Commit

Permalink
Run parser functions in run dir.
Browse files Browse the repository at this point in the history
  • Loading branch information
jendrikseipp committed Oct 2, 2024
1 parent ad2a32c commit aa64f34
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
1 change: 1 addition & 0 deletions docs/news.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ v8.3 (unreleased)
Lab
^^^
* Add support for Python 3.12 and 3.13 (Jendrik Seipp).
* Run parser functions in run directories (Jendrik Seipp).
* Open ``run.log`` and ``run.err`` in binary mode to avoid decoding byte strings (Jendrik Seipp).

Downward Lab
Expand Down
6 changes: 6 additions & 0 deletions lab/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
"""

import logging
import os
import re
from collections import defaultdict
from pathlib import Path
Expand Down Expand Up @@ -200,4 +201,9 @@ def get_content(path):
path = run_dir / function.filename
# Call function with empty string if file is missing.
content = get_content(path) or ""

# Run function in the run directory.
old_cwd = Path.cwd()
os.chdir(run_dir)
function.function(content, props)
os.chdir(old_cwd)

0 comments on commit aa64f34

Please sign in to comment.