Tools for logging simulation information for later reproductions.
Project description
simutils
Note that this package is not yet implemented.
Usage
It logs the argument of the function and other relevant information to a JSON file.
>>> from simutils import log_function
>>> @log_function
... def double_val(x):
... return x * 2
...
>>> double_val(4)
8
Then the content of the JSON file will be:
{
"simulation_name": "double_val_20210216_141001",
"status": "success",
"computer_name": "MyComputer",
"python_version": "3.8.6 (tags/v3.8.6:db45529, Sep 23 2020, 15:52:53) [MSC v.1927 64 bit (AMD64)]",
"cwd": "current/working/directory",
"output_directory": "logs/double_val_20210216_141001",
"summary_filepath": "path/to/this/file",
"called_function": "double_val",
"start_time": "2021-02-16 14:10:02",
"end_time": "2021-02-16 14:10:03",
"simulation_time": "0:00:01.012345",
"args": {
"x": 4
}
}
You can pass arguments to the decorator, and you can also decorate functions in a Python script.
@log_function(
git_repo=os.path.join(os.path.dirname(__file__), '..', '..'), # git repository to log
)
def triple_val(x):
return x * 3
To-Do's
- Send a notification when a function execution is finished.
- Integrate with a native Python logger.
- Reproduce the original environment
Project details
Release history Release notifications | RSS feed
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
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file simutils-0.0.2.tar.gz.
File metadata
- Download URL: simutils-0.0.2.tar.gz
- Upload date:
- Size: 2.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.56.2 CPython/3.9.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7f046aece3da43fc8b8046326df5f2eb16fa2f6e7ebd55e2d3f2ed0cce38b2b9
|
|
| MD5 |
df6183a54f9c0332e0195ea4da36fcfb
|
|
| BLAKE2b-256 |
bddcbaab9263ee5b865f53cbc38513ab7879b62f2839953b2e3a62dd6bb2479d
|
File details
Details for the file simutils-0.0.2-py3-none-any.whl.
File metadata
- Download URL: simutils-0.0.2-py3-none-any.whl
- Upload date:
- Size: 2.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.56.2 CPython/3.9.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8c0658ebc752e4699a9f17a664a5e81db72b115ecea5731c94228f75f8f3daad
|
|
| MD5 |
8abb9f5f4ff5fb94c519375e6e6a4b98
|
|
| BLAKE2b-256 |
7fcea298d67be65084dcf026ad710eb5c484ee2008681b08aac6ee64e342e99e
|