Multiple File Parser for monitoring and processing updates to a given set of output files.
Project description
Multiparser
Multiparser is module for performing functionality across a set of output files. Given a set of files, and optionally a list of output parameter names or regex filters the module keeps track of changes by monitoring the "last modified" timestamp of each file and executing the assigned callback.
For example, in the case where a set of model outputs were written to a set of files the user is able to specify which files are of importance, the variables to be noted within these files, and a function to execute whenever a change is made to one of these files.
Installation
The module is available in PyPi:
pip install ukaea-multiparser
To install optional extras arrow
and fortran
list them during the install, e.g.:
pip install ukaea-multiparser[fortran,arrow]
Example
with FileMonitor(
per_thread_callback=callback_function,
lock_callback=True,
interval=10.0,
flatten_data=True
) as monitor:
monitor.track(
path_glob_exprs=["file_of_interest.toml", "out_dir/*.other"],
tracked_values=[
"list", "of", "interesting", "values",
re.compile(r"^list"),
re.compile(r"of\s"),
re.compile(r"regular"),
re.compile(r"Expressions")
],
static=True
)
monitor.run()
...
monitor.terminate()
Documentation
For information on use and functionality please see the documentation.
Licensing
Multiparser is provided under the MIT license allowing reuse within both open source and proprietary software.
Contributing
For contributions and development towards improving Multiparser please see the included CONTRIBUTING.md file.
Copyright (c) 2024 UK Atomic Energy Authority
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for ukaea_multiparser-1.0.2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 849cda897e2ac9d3ea0f83245984d7531544284e87abfc5329502de477bebe8a |
|
MD5 | 107ef85cbc7a96d5ffef19e190946a75 |
|
BLAKE2b-256 | 9f0eb4cfc73b475692c4696ffbea66e30b058e48971de4d1277c700a474d298f |