py-modelrunner 0.18.2__tar.gz → 0.19.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {py_modelrunner-0.18.2 → py_modelrunner-0.19.0}/.github/workflows/build.yml +3 -3
- {py_modelrunner-0.18.2 → py_modelrunner-0.19.0}/.github/workflows/check_docs.yml +1 -1
- {py_modelrunner-0.18.2 → py_modelrunner-0.19.0}/.github/workflows/coverage_report.yml +2 -2
- {py_modelrunner-0.18.2 → py_modelrunner-0.19.0}/.github/workflows/release_pip.yml +2 -2
- {py_modelrunner-0.18.2 → py_modelrunner-0.19.0}/PKG-INFO +4 -5
- {py_modelrunner-0.18.2 → py_modelrunner-0.19.0}/README.md +0 -2
- {py_modelrunner-0.18.2 → py_modelrunner-0.19.0}/docs/source/conf.py +3 -3
- {py_modelrunner-0.18.2 → py_modelrunner-0.19.0}/docs/source/run_autodoc.py +7 -6
- {py_modelrunner-0.18.2 → py_modelrunner-0.19.0}/docs/source/sphinx_simplify_typehints.py +18 -15
- {py_modelrunner-0.18.2 → py_modelrunner-0.19.0}/examples/read_many.py +3 -3
- {py_modelrunner-0.18.2 → py_modelrunner-0.19.0}/examples/submit_many_func.py +0 -1
- {py_modelrunner-0.18.2 → py_modelrunner-0.19.0}/examples/submit_many_iter.py +0 -1
- {py_modelrunner-0.18.2 → py_modelrunner-0.19.0}/modelrunner/_version.py +2 -2
- {py_modelrunner-0.18.2 → py_modelrunner-0.19.0}/modelrunner/config.py +3 -3
- {py_modelrunner-0.18.2 → py_modelrunner-0.19.0}/modelrunner/model/base.py +13 -4
- {py_modelrunner-0.18.2 → py_modelrunner-0.19.0}/modelrunner/model/factory.py +1 -1
- {py_modelrunner-0.18.2 → py_modelrunner-0.19.0}/modelrunner/model/parameters.py +10 -7
- {py_modelrunner-0.18.2 → py_modelrunner-0.19.0}/modelrunner/run/compatibility/triage.py +2 -2
- {py_modelrunner-0.18.2 → py_modelrunner-0.19.0}/modelrunner/run/compatibility/version0.py +2 -2
- {py_modelrunner-0.18.2 → py_modelrunner-0.19.0}/modelrunner/run/compatibility/version1.py +4 -6
- {py_modelrunner-0.18.2 → py_modelrunner-0.19.0}/modelrunner/run/job.py +3 -3
- {py_modelrunner-0.18.2 → py_modelrunner-0.19.0}/modelrunner/run/launch.py +3 -2
- {py_modelrunner-0.18.2 → py_modelrunner-0.19.0}/modelrunner/run/results.py +17 -13
- {py_modelrunner-0.18.2 → py_modelrunner-0.19.0}/modelrunner/storage/__init__.py +1 -1
- {py_modelrunner-0.18.2 → py_modelrunner-0.19.0}/modelrunner/storage/access_modes.py +3 -7
- {py_modelrunner-0.18.2 → py_modelrunner-0.19.0}/modelrunner/storage/backend/__init__.py +3 -1
- {py_modelrunner-0.18.2 → py_modelrunner-0.19.0}/modelrunner/storage/backend/hdf.py +10 -8
- {py_modelrunner-0.18.2 → py_modelrunner-0.19.0}/modelrunner/storage/backend/memory.py +4 -4
- {py_modelrunner-0.18.2 → py_modelrunner-0.19.0}/modelrunner/storage/backend/text_base.py +13 -12
- {py_modelrunner-0.18.2 → py_modelrunner-0.19.0}/modelrunner/storage/backend/yaml.py +4 -4
- {py_modelrunner-0.18.2 → py_modelrunner-0.19.0}/modelrunner/storage/backend/zarr.py +10 -11
- {py_modelrunner-0.18.2 → py_modelrunner-0.19.0}/modelrunner/storage/base.py +31 -9
- {py_modelrunner-0.18.2 → py_modelrunner-0.19.0}/modelrunner/storage/group.py +10 -11
- {py_modelrunner-0.18.2 → py_modelrunner-0.19.0}/modelrunner/storage/tools.py +1 -1
- {py_modelrunner-0.18.2 → py_modelrunner-0.19.0}/modelrunner/storage/trajectory.py +4 -6
- {py_modelrunner-0.18.2 → py_modelrunner-0.19.0}/modelrunner/storage/utils.py +8 -6
- {py_modelrunner-0.18.2 → py_modelrunner-0.19.0}/modelrunner/utils.py +3 -4
- {py_modelrunner-0.18.2 → py_modelrunner-0.19.0}/py_modelrunner.egg-info/PKG-INFO +4 -5
- {py_modelrunner-0.18.2 → py_modelrunner-0.19.0}/py_modelrunner.egg-info/requires.txt +1 -1
- {py_modelrunner-0.18.2 → py_modelrunner-0.19.0}/pyproject.toml +39 -2
- {py_modelrunner-0.18.2 → py_modelrunner-0.19.0}/requirements_full.txt +1 -1
- {py_modelrunner-0.18.2 → py_modelrunner-0.19.0}/scripts/create_compatibility_files.py +5 -5
- py_modelrunner-0.19.0/scripts/format_code.sh +11 -0
- {py_modelrunner-0.18.2 → py_modelrunner-0.19.0}/scripts/run_tests.py +5 -5
- {py_modelrunner-0.18.2 → py_modelrunner-0.19.0}/tests/compatibility/test_compatibility.py +1 -1
- py_modelrunner-0.19.0/tests/conftest.py +4 -0
- {py_modelrunner-0.18.2 → py_modelrunner-0.19.0}/tests/helpers/storage.py +3 -1
- {py_modelrunner-0.18.2 → py_modelrunner-0.19.0}/tests/model/test_model.py +3 -1
- {py_modelrunner-0.18.2 → py_modelrunner-0.19.0}/tests/model/test_parameters.py +1 -1
- {py_modelrunner-0.18.2 → py_modelrunner-0.19.0}/tests/requirements.txt +1 -3
- py_modelrunner-0.19.0/tests/run/scripts/function.py +5 -0
- {py_modelrunner-0.18.2 → py_modelrunner-0.19.0}/tests/run/test_job.py +2 -2
- {py_modelrunner-0.18.2 → py_modelrunner-0.19.0}/tests/run/test_results.py +13 -1
- {py_modelrunner-0.18.2 → py_modelrunner-0.19.0}/tests/run/test_run_main.py +2 -2
- {py_modelrunner-0.18.2 → py_modelrunner-0.19.0}/tests/storage/test_register_action.py +19 -11
- {py_modelrunner-0.18.2 → py_modelrunner-0.19.0}/tests/storage/test_storage_generic.py +8 -3
- {py_modelrunner-0.18.2 → py_modelrunner-0.19.0}/tests/storage/test_storage_special.py +2 -2
- {py_modelrunner-0.18.2 → py_modelrunner-0.19.0}/tests/storage/test_trajectory.py +8 -12
- {py_modelrunner-0.18.2 → py_modelrunner-0.19.0}/tests/test_config.py +2 -2
- {py_modelrunner-0.18.2 → py_modelrunner-0.19.0}/tests/test_examples.py +2 -2
- py_modelrunner-0.18.2/scripts/format_code.sh +0 -16
- py_modelrunner-0.18.2/tests/conftest.py +0 -4
- py_modelrunner-0.18.2/tests/run/scripts/function.py +0 -3
- {py_modelrunner-0.18.2 → py_modelrunner-0.19.0}/.gitignore +0 -0
- {py_modelrunner-0.18.2 → py_modelrunner-0.19.0}/.readthedocs.yaml +0 -0
- {py_modelrunner-0.18.2 → py_modelrunner-0.19.0}/LICENSE +0 -0
- {py_modelrunner-0.18.2 → py_modelrunner-0.19.0}/docs/Makefile +0 -0
- {py_modelrunner-0.18.2 → py_modelrunner-0.19.0}/docs/build_all.sh +0 -0
- {py_modelrunner-0.18.2 → py_modelrunner-0.19.0}/docs/requirements.txt +0 -0
- {py_modelrunner-0.18.2 → py_modelrunner-0.19.0}/docs/source/.gitignore +0 -0
- {py_modelrunner-0.18.2 → py_modelrunner-0.19.0}/docs/source/examples.rst +0 -0
- {py_modelrunner-0.18.2 → py_modelrunner-0.19.0}/docs/source/index.rst +0 -0
- {py_modelrunner-0.18.2 → py_modelrunner-0.19.0}/docs/source/installation.rst +0 -0
- {py_modelrunner-0.18.2 → py_modelrunner-0.19.0}/docs/source/parse_examples.py +0 -0
- {py_modelrunner-0.18.2 → py_modelrunner-0.19.0}/docs/source/user_manual.rst +0 -0
- {py_modelrunner-0.18.2 → py_modelrunner-0.19.0}/examples/io_hdf.py +0 -0
- {py_modelrunner-0.18.2 → py_modelrunner-0.19.0}/examples/io_json.py +0 -0
- {py_modelrunner-0.18.2 → py_modelrunner-0.19.0}/examples/io_yaml.py +0 -0
- {py_modelrunner-0.18.2 → py_modelrunner-0.19.0}/examples/model_class.py +0 -0
- {py_modelrunner-0.18.2 → py_modelrunner-0.19.0}/examples/model_decorator.py +0 -0
- {py_modelrunner-0.18.2 → py_modelrunner-0.19.0}/examples/model_function.py +0 -0
- {py_modelrunner-0.18.2 → py_modelrunner-0.19.0}/examples/model_storage_output.py +0 -0
- {py_modelrunner-0.18.2 → py_modelrunner-0.19.0}/examples/script_custom_func.py +0 -0
- {py_modelrunner-0.18.2 → py_modelrunner-0.19.0}/examples/script_function.py +0 -0
- {py_modelrunner-0.18.2 → py_modelrunner-0.19.0}/examples/script_many_classes.py +0 -0
- {py_modelrunner-0.18.2 → py_modelrunner-0.19.0}/examples/script_minimal.py +0 -0
- {py_modelrunner-0.18.2 → py_modelrunner-0.19.0}/examples/script_model_class.py +0 -0
- {py_modelrunner-0.18.2 → py_modelrunner-0.19.0}/examples/submit_function.py +0 -0
- {py_modelrunner-0.18.2 → py_modelrunner-0.19.0}/examples/submit_shebang.py +0 -0
- {py_modelrunner-0.18.2 → py_modelrunner-0.19.0}/modelrunner/.gitignore +0 -0
- {py_modelrunner-0.18.2 → py_modelrunner-0.19.0}/modelrunner/__init__.py +0 -0
- {py_modelrunner-0.18.2 → py_modelrunner-0.19.0}/modelrunner/__main__.py +0 -0
- {py_modelrunner-0.18.2 → py_modelrunner-0.19.0}/modelrunner/model/__init__.py +0 -0
- {py_modelrunner-0.18.2 → py_modelrunner-0.19.0}/modelrunner/py.typed +0 -0
- {py_modelrunner-0.18.2 → py_modelrunner-0.19.0}/modelrunner/run/__init__.py +0 -0
- {py_modelrunner-0.18.2 → py_modelrunner-0.19.0}/modelrunner/run/__main__.py +0 -0
- {py_modelrunner-0.18.2 → py_modelrunner-0.19.0}/modelrunner/run/compatibility/__init__.py +0 -0
- {py_modelrunner-0.18.2 → py_modelrunner-0.19.0}/modelrunner/run/compatibility/version2.py +0 -0
- {py_modelrunner-0.18.2 → py_modelrunner-0.19.0}/modelrunner/run/templates/background.jinja +0 -0
- {py_modelrunner-0.18.2 → py_modelrunner-0.19.0}/modelrunner/run/templates/foreground.jinja +0 -0
- {py_modelrunner-0.18.2 → py_modelrunner-0.19.0}/modelrunner/run/templates/qsub.jinja +0 -0
- {py_modelrunner-0.18.2 → py_modelrunner-0.19.0}/modelrunner/run/templates/srun.jinja +0 -0
- {py_modelrunner-0.18.2 → py_modelrunner-0.19.0}/modelrunner/storage/attributes.py +0 -0
- {py_modelrunner-0.18.2 → py_modelrunner-0.19.0}/modelrunner/storage/backend/json.py +0 -0
- {py_modelrunner-0.18.2 → py_modelrunner-0.19.0}/modelrunner/storage/backend/utils.py +0 -0
- {py_modelrunner-0.18.2 → py_modelrunner-0.19.0}/py_modelrunner.egg-info/SOURCES.txt +0 -0
- {py_modelrunner-0.18.2 → py_modelrunner-0.19.0}/py_modelrunner.egg-info/dependency_links.txt +0 -0
- {py_modelrunner-0.18.2 → py_modelrunner-0.19.0}/py_modelrunner.egg-info/not-zip-safe +0 -0
- {py_modelrunner-0.18.2 → py_modelrunner-0.19.0}/py_modelrunner.egg-info/top_level.txt +0 -0
- {py_modelrunner-0.18.2 → py_modelrunner-0.19.0}/requirements.txt +0 -0
- {py_modelrunner-0.18.2 → py_modelrunner-0.19.0}/scripts/performance_hdf5_zarr.py +0 -0
- {py_modelrunner-0.18.2 → py_modelrunner-0.19.0}/scripts/tests_all.sh +0 -0
- {py_modelrunner-0.18.2 → py_modelrunner-0.19.0}/scripts/tests_codestyle.sh +0 -0
- {py_modelrunner-0.18.2 → py_modelrunner-0.19.0}/scripts/tests_coverage.sh +0 -0
- {py_modelrunner-0.18.2 → py_modelrunner-0.19.0}/scripts/tests_debug.sh +0 -0
- {py_modelrunner-0.18.2 → py_modelrunner-0.19.0}/scripts/tests_parallel.sh +0 -0
- {py_modelrunner-0.18.2 → py_modelrunner-0.19.0}/scripts/tests_run.sh +0 -0
- {py_modelrunner-0.18.2 → py_modelrunner-0.19.0}/scripts/tests_types.sh +0 -0
- {py_modelrunner-0.18.2 → py_modelrunner-0.19.0}/setup.cfg +0 -0
- {py_modelrunner-0.18.2 → py_modelrunner-0.19.0}/tests/compatibility/0/result.hdf +0 -0
- {py_modelrunner-0.18.2 → py_modelrunner-0.19.0}/tests/compatibility/0/result.json +0 -0
- {py_modelrunner-0.18.2 → py_modelrunner-0.19.0}/tests/compatibility/0/result.pkl +0 -0
- {py_modelrunner-0.18.2 → py_modelrunner-0.19.0}/tests/compatibility/0/result.yaml +0 -0
- {py_modelrunner-0.18.2 → py_modelrunner-0.19.0}/tests/compatibility/1/array.json +0 -0
- {py_modelrunner-0.18.2 → py_modelrunner-0.19.0}/tests/compatibility/1/array.pkl +0 -0
- {py_modelrunner-0.18.2 → py_modelrunner-0.19.0}/tests/compatibility/1/array.yaml +0 -0
- {py_modelrunner-0.18.2 → py_modelrunner-0.19.0}/tests/compatibility/1/array.zarr +0 -0
- {py_modelrunner-0.18.2 → py_modelrunner-0.19.0}/tests/compatibility/1/array_col.json +0 -0
- {py_modelrunner-0.18.2 → py_modelrunner-0.19.0}/tests/compatibility/1/array_col.pkl +0 -0
- {py_modelrunner-0.18.2 → py_modelrunner-0.19.0}/tests/compatibility/1/array_col.yaml +0 -0
- {py_modelrunner-0.18.2 → py_modelrunner-0.19.0}/tests/compatibility/1/array_col.zarr +0 -0
- {py_modelrunner-0.18.2 → py_modelrunner-0.19.0}/tests/compatibility/1/dict.json +0 -0
- {py_modelrunner-0.18.2 → py_modelrunner-0.19.0}/tests/compatibility/1/dict.pkl +0 -0
- {py_modelrunner-0.18.2 → py_modelrunner-0.19.0}/tests/compatibility/1/dict.yaml +0 -0
- {py_modelrunner-0.18.2 → py_modelrunner-0.19.0}/tests/compatibility/1/dict.zarr +0 -0
- {py_modelrunner-0.18.2 → py_modelrunner-0.19.0}/tests/compatibility/1/object.json +0 -0
- {py_modelrunner-0.18.2 → py_modelrunner-0.19.0}/tests/compatibility/1/object.pkl +0 -0
- {py_modelrunner-0.18.2 → py_modelrunner-0.19.0}/tests/compatibility/1/object.yaml +0 -0
- {py_modelrunner-0.18.2 → py_modelrunner-0.19.0}/tests/compatibility/1/object.zarr +0 -0
- {py_modelrunner-0.18.2 → py_modelrunner-0.19.0}/tests/compatibility/2/array.hdf +0 -0
- {py_modelrunner-0.18.2 → py_modelrunner-0.19.0}/tests/compatibility/2/array.json +0 -0
- {py_modelrunner-0.18.2 → py_modelrunner-0.19.0}/tests/compatibility/2/array.pkl +0 -0
- {py_modelrunner-0.18.2 → py_modelrunner-0.19.0}/tests/compatibility/2/array.yaml +0 -0
- {py_modelrunner-0.18.2 → py_modelrunner-0.19.0}/tests/compatibility/2/array.zip +0 -0
- {py_modelrunner-0.18.2 → py_modelrunner-0.19.0}/tests/compatibility/2/array_col.hdf +0 -0
- {py_modelrunner-0.18.2 → py_modelrunner-0.19.0}/tests/compatibility/2/array_col.json +0 -0
- {py_modelrunner-0.18.2 → py_modelrunner-0.19.0}/tests/compatibility/2/array_col.pkl +0 -0
- {py_modelrunner-0.18.2 → py_modelrunner-0.19.0}/tests/compatibility/2/array_col.yaml +0 -0
- {py_modelrunner-0.18.2 → py_modelrunner-0.19.0}/tests/compatibility/2/array_col.zip +0 -0
- {py_modelrunner-0.18.2 → py_modelrunner-0.19.0}/tests/compatibility/2/dict.hdf +0 -0
- {py_modelrunner-0.18.2 → py_modelrunner-0.19.0}/tests/compatibility/2/dict.json +0 -0
- {py_modelrunner-0.18.2 → py_modelrunner-0.19.0}/tests/compatibility/2/dict.pkl +0 -0
- {py_modelrunner-0.18.2 → py_modelrunner-0.19.0}/tests/compatibility/2/dict.yaml +0 -0
- {py_modelrunner-0.18.2 → py_modelrunner-0.19.0}/tests/compatibility/2/dict.zip +0 -0
- {py_modelrunner-0.18.2 → py_modelrunner-0.19.0}/tests/compatibility/2/nested.hdf +0 -0
- {py_modelrunner-0.18.2 → py_modelrunner-0.19.0}/tests/compatibility/2/nested.json +0 -0
- {py_modelrunner-0.18.2 → py_modelrunner-0.19.0}/tests/compatibility/2/nested.pkl +0 -0
- {py_modelrunner-0.18.2 → py_modelrunner-0.19.0}/tests/compatibility/2/nested.yaml +0 -0
- {py_modelrunner-0.18.2 → py_modelrunner-0.19.0}/tests/compatibility/2/nested.zip +0 -0
- {py_modelrunner-0.18.2 → py_modelrunner-0.19.0}/tests/compatibility/3/array.hdf +0 -0
- {py_modelrunner-0.18.2 → py_modelrunner-0.19.0}/tests/compatibility/3/array.json +0 -0
- {py_modelrunner-0.18.2 → py_modelrunner-0.19.0}/tests/compatibility/3/array.pkl +0 -0
- {py_modelrunner-0.18.2 → py_modelrunner-0.19.0}/tests/compatibility/3/array.yaml +0 -0
- {py_modelrunner-0.18.2 → py_modelrunner-0.19.0}/tests/compatibility/3/array.zip +0 -0
- {py_modelrunner-0.18.2 → py_modelrunner-0.19.0}/tests/compatibility/3/array_col.hdf +0 -0
- {py_modelrunner-0.18.2 → py_modelrunner-0.19.0}/tests/compatibility/3/array_col.json +0 -0
- {py_modelrunner-0.18.2 → py_modelrunner-0.19.0}/tests/compatibility/3/array_col.pkl +0 -0
- {py_modelrunner-0.18.2 → py_modelrunner-0.19.0}/tests/compatibility/3/array_col.yaml +0 -0
- {py_modelrunner-0.18.2 → py_modelrunner-0.19.0}/tests/compatibility/3/array_col.zip +0 -0
- {py_modelrunner-0.18.2 → py_modelrunner-0.19.0}/tests/compatibility/3/dict.hdf +0 -0
- {py_modelrunner-0.18.2 → py_modelrunner-0.19.0}/tests/compatibility/3/dict.json +0 -0
- {py_modelrunner-0.18.2 → py_modelrunner-0.19.0}/tests/compatibility/3/dict.pkl +0 -0
- {py_modelrunner-0.18.2 → py_modelrunner-0.19.0}/tests/compatibility/3/dict.yaml +0 -0
- {py_modelrunner-0.18.2 → py_modelrunner-0.19.0}/tests/compatibility/3/dict.zip +0 -0
- {py_modelrunner-0.18.2 → py_modelrunner-0.19.0}/tests/compatibility/3/model_array.hdf +0 -0
- {py_modelrunner-0.18.2 → py_modelrunner-0.19.0}/tests/compatibility/3/model_array.json +0 -0
- {py_modelrunner-0.18.2 → py_modelrunner-0.19.0}/tests/compatibility/3/model_array.pkl +0 -0
- {py_modelrunner-0.18.2 → py_modelrunner-0.19.0}/tests/compatibility/3/model_array.yaml +0 -0
- {py_modelrunner-0.18.2 → py_modelrunner-0.19.0}/tests/compatibility/3/model_array.zip +0 -0
- {py_modelrunner-0.18.2 → py_modelrunner-0.19.0}/tests/compatibility/3/model_array_col.hdf +0 -0
- {py_modelrunner-0.18.2 → py_modelrunner-0.19.0}/tests/compatibility/3/model_array_col.json +0 -0
- {py_modelrunner-0.18.2 → py_modelrunner-0.19.0}/tests/compatibility/3/model_array_col.pkl +0 -0
- {py_modelrunner-0.18.2 → py_modelrunner-0.19.0}/tests/compatibility/3/model_array_col.yaml +0 -0
- {py_modelrunner-0.18.2 → py_modelrunner-0.19.0}/tests/compatibility/3/model_array_col.zip +0 -0
- {py_modelrunner-0.18.2 → py_modelrunner-0.19.0}/tests/compatibility/3/model_dict.hdf +0 -0
- {py_modelrunner-0.18.2 → py_modelrunner-0.19.0}/tests/compatibility/3/model_dict.json +0 -0
- {py_modelrunner-0.18.2 → py_modelrunner-0.19.0}/tests/compatibility/3/model_dict.pkl +0 -0
- {py_modelrunner-0.18.2 → py_modelrunner-0.19.0}/tests/compatibility/3/model_dict.yaml +0 -0
- {py_modelrunner-0.18.2 → py_modelrunner-0.19.0}/tests/compatibility/3/model_dict.zip +0 -0
- {py_modelrunner-0.18.2 → py_modelrunner-0.19.0}/tests/compatibility/3/model_nested.hdf +0 -0
- {py_modelrunner-0.18.2 → py_modelrunner-0.19.0}/tests/compatibility/3/model_nested.json +0 -0
- {py_modelrunner-0.18.2 → py_modelrunner-0.19.0}/tests/compatibility/3/model_nested.pkl +0 -0
- {py_modelrunner-0.18.2 → py_modelrunner-0.19.0}/tests/compatibility/3/model_nested.yaml +0 -0
- {py_modelrunner-0.18.2 → py_modelrunner-0.19.0}/tests/compatibility/3/model_nested.zip +0 -0
- {py_modelrunner-0.18.2 → py_modelrunner-0.19.0}/tests/compatibility/3/nested.hdf +0 -0
- {py_modelrunner-0.18.2 → py_modelrunner-0.19.0}/tests/compatibility/3/nested.json +0 -0
- {py_modelrunner-0.18.2 → py_modelrunner-0.19.0}/tests/compatibility/3/nested.pkl +0 -0
- {py_modelrunner-0.18.2 → py_modelrunner-0.19.0}/tests/compatibility/3/nested.yaml +0 -0
- {py_modelrunner-0.18.2 → py_modelrunner-0.19.0}/tests/compatibility/3/nested.zip +0 -0
- {py_modelrunner-0.18.2 → py_modelrunner-0.19.0}/tests/helpers/__init__.py +0 -0
- {py_modelrunner-0.18.2 → py_modelrunner-0.19.0}/tests/helpers/asserts.py +0 -0
- {py_modelrunner-0.18.2 → py_modelrunner-0.19.0}/tests/model/scripts/empty.py +0 -0
- {py_modelrunner-0.18.2 → py_modelrunner-0.19.0}/tests/model/scripts/function.py +0 -0
- {py_modelrunner-0.18.2 → py_modelrunner-0.19.0}/tests/model/scripts/function_main.py +0 -0
- {py_modelrunner-0.18.2 → py_modelrunner-0.19.0}/tests/model/scripts/function_marked.py +0 -0
- {py_modelrunner-0.18.2 → py_modelrunner-0.19.0}/tests/model/scripts/make_model.py +0 -0
- {py_modelrunner-0.18.2 → py_modelrunner-0.19.0}/tests/model/scripts/make_model_class.py +0 -0
- {py_modelrunner-0.18.2 → py_modelrunner-0.19.0}/tests/model/scripts/make_model_marked.py +0 -0
- {py_modelrunner-0.18.2 → py_modelrunner-0.19.0}/tests/run/scripts/custom.jinja +0 -0
- {py_modelrunner-0.18.2 → py_modelrunner-0.19.0}/tests/run/scripts/fail.py +0 -0
- {py_modelrunner-0.18.2 → py_modelrunner-0.19.0}/tests/run/scripts/print.py +0 -0
- {py_modelrunner-0.18.2 → py_modelrunner-0.19.0}/tests/run/scripts/script.py +0 -0
- {py_modelrunner-0.18.2 → py_modelrunner-0.19.0}/tests/storage/test_group.py +0 -0
- {py_modelrunner-0.18.2 → py_modelrunner-0.19.0}/tests/storage/test_utils.py +0 -0
- {py_modelrunner-0.18.2 → py_modelrunner-0.19.0}/tests/test_main.py +0 -0
- {py_modelrunner-0.18.2 → py_modelrunner-0.19.0}/tests/test_version.py +0 -0
|
@@ -9,13 +9,13 @@ jobs:
|
|
|
9
9
|
strategy:
|
|
10
10
|
matrix:
|
|
11
11
|
os: [macos-latest, ubuntu-latest, windows-latest]
|
|
12
|
-
python-version: ['3.8', '3.
|
|
12
|
+
python-version: ['3.8', '3.13']
|
|
13
13
|
|
|
14
14
|
steps:
|
|
15
|
-
- uses: actions/checkout@
|
|
15
|
+
- uses: actions/checkout@v4
|
|
16
16
|
|
|
17
17
|
- name: Set up Python ${{ matrix.python-version }}
|
|
18
|
-
uses: actions/setup-python@
|
|
18
|
+
uses: actions/setup-python@v5
|
|
19
19
|
with:
|
|
20
20
|
python-version: ${{ matrix.python-version }}
|
|
21
21
|
|
|
@@ -11,9 +11,9 @@ jobs:
|
|
|
11
11
|
python-version: [3.8]
|
|
12
12
|
|
|
13
13
|
steps:
|
|
14
|
-
- uses: actions/checkout@
|
|
14
|
+
- uses: actions/checkout@v4
|
|
15
15
|
- name: Set up Python ${{ matrix.python-version }}
|
|
16
|
-
uses: actions/setup-python@
|
|
16
|
+
uses: actions/setup-python@v5
|
|
17
17
|
with:
|
|
18
18
|
python-version: ${{ matrix.python-version }}
|
|
19
19
|
- name: Install dependencies
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: py-modelrunner
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.19.0
|
|
4
4
|
Summary: Python classes for organizing (HPC) simulations
|
|
5
5
|
Author-email: David Zwicker <david.zwicker@ds.mpg.de>
|
|
6
6
|
License: MIT
|
|
@@ -19,7 +19,8 @@ Classifier: Programming Language :: Python :: 3.9
|
|
|
19
19
|
Classifier: Programming Language :: Python :: 3.10
|
|
20
20
|
Classifier: Programming Language :: Python :: 3.11
|
|
21
21
|
Classifier: Programming Language :: Python :: 3.12
|
|
22
|
-
|
|
22
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
23
|
+
Requires-Python: <3.14,>=3.8
|
|
23
24
|
Description-Content-Type: text/markdown
|
|
24
25
|
License-File: LICENSE
|
|
25
26
|
Requires-Dist: jinja2>=3
|
|
@@ -30,7 +31,7 @@ Provides-Extra: all
|
|
|
30
31
|
Requires-Dist: h5py>=3.5; extra == "all"
|
|
31
32
|
Requires-Dist: pandas>=1.3; extra == "all"
|
|
32
33
|
Requires-Dist: PyYAML>=5; extra == "all"
|
|
33
|
-
Requires-Dist: zarr
|
|
34
|
+
Requires-Dist: zarr<3,>=2; extra == "all"
|
|
34
35
|
Provides-Extra: test
|
|
35
36
|
Requires-Dist: black>=19; extra == "test"
|
|
36
37
|
Requires-Dist: isort>=5.1; extra == "test"
|
|
@@ -49,8 +50,6 @@ Requires-Dist: mypy>=0.770; extra == "test"
|
|
|
49
50
|
[](https://anaconda.org/conda-forge/py-modelrunner)
|
|
50
51
|
[](https://opensource.org/licenses/MIT)
|
|
51
52
|
[](https://codecov.io/gh/zwicker-group/py-modelrunner)
|
|
52
|
-
[](https://github.com/psf/black)
|
|
53
|
-
|
|
54
53
|
|
|
55
54
|
|
|
56
55
|
This package provides python classes for handling and running physical simulations.
|
|
@@ -7,8 +7,6 @@
|
|
|
7
7
|
[](https://anaconda.org/conda-forge/py-modelrunner)
|
|
8
8
|
[](https://opensource.org/licenses/MIT)
|
|
9
9
|
[](https://codecov.io/gh/zwicker-group/py-modelrunner)
|
|
10
|
-
[](https://github.com/psf/black)
|
|
11
|
-
|
|
12
10
|
|
|
13
11
|
|
|
14
12
|
This package provides python classes for handling and running physical simulations.
|
|
@@ -15,19 +15,19 @@
|
|
|
15
15
|
import os.path
|
|
16
16
|
import sys
|
|
17
17
|
|
|
18
|
-
sys.path.insert(0, os.path.abspath("../.."))
|
|
18
|
+
sys.path.insert(0, os.path.abspath("../..")) # noqa: PTH100
|
|
19
19
|
sys.path.insert(0, ".")
|
|
20
20
|
|
|
21
21
|
from datetime import date
|
|
22
22
|
|
|
23
|
-
import sphinx_simplify_typehints
|
|
23
|
+
import sphinx_simplify_typehints
|
|
24
24
|
|
|
25
25
|
# -- Project information -----------------------------------------------------
|
|
26
26
|
|
|
27
27
|
project = "py-modelrunner"
|
|
28
28
|
module_name = "modelrunner"
|
|
29
29
|
author = "David Zwicker"
|
|
30
|
-
copyright = f"{date.today().year}, {author}" #
|
|
30
|
+
copyright = f"{date.today().year}, {author}" # noqa: A001
|
|
31
31
|
|
|
32
32
|
# The short X.Y version
|
|
33
33
|
import modelrunner
|
|
@@ -4,13 +4,14 @@ import glob
|
|
|
4
4
|
import logging
|
|
5
5
|
import os
|
|
6
6
|
import subprocess as sp
|
|
7
|
+
from pathlib import Path
|
|
7
8
|
|
|
8
9
|
logging.basicConfig(level=logging.INFO)
|
|
9
10
|
|
|
10
11
|
OUTPUT_PATH = "packages"
|
|
11
12
|
|
|
12
13
|
|
|
13
|
-
def replace_in_file(infile, replacements, outfile=None):
|
|
14
|
+
def replace_in_file(infile: Path, replacements, outfile=None):
|
|
14
15
|
"""Reads in a file, replaces the given data using python formatting and writes back
|
|
15
16
|
the result to a file.
|
|
16
17
|
|
|
@@ -26,21 +27,21 @@ def replace_in_file(infile, replacements, outfile=None):
|
|
|
26
27
|
if outfile is None:
|
|
27
28
|
outfile = infile
|
|
28
29
|
|
|
29
|
-
with open(
|
|
30
|
+
with infile.open() as fp:
|
|
30
31
|
content = fp.read()
|
|
31
32
|
|
|
32
33
|
for key, value in replacements.items():
|
|
33
34
|
content = content.replace(key, value)
|
|
34
35
|
|
|
35
|
-
with open(
|
|
36
|
+
with outfile.open("w") as fp:
|
|
36
37
|
fp.write(content)
|
|
37
38
|
|
|
38
39
|
|
|
39
40
|
def main(package="modelrunner"):
|
|
40
41
|
# remove old files
|
|
41
|
-
for path in
|
|
42
|
+
for path in Path(OUTPUT_PATH).glob("*.rst"):
|
|
42
43
|
logging.info("Remove file `%s`", path)
|
|
43
|
-
|
|
44
|
+
path.unlink()
|
|
44
45
|
|
|
45
46
|
# run sphinx-apidoc
|
|
46
47
|
sp.check_call(
|
|
@@ -66,7 +67,7 @@ def main(package="modelrunner"):
|
|
|
66
67
|
}
|
|
67
68
|
|
|
68
69
|
# replace unwanted information
|
|
69
|
-
for path in
|
|
70
|
+
for path in Path(OUTPUT_PATH).glob("*.rst"):
|
|
70
71
|
logging.info("Patch file `%s`", path)
|
|
71
72
|
replace_in_file(path, REPLACEMENTS)
|
|
72
73
|
|
|
@@ -48,22 +48,25 @@ def sphinx_display_parameters(app, what, name, obj, options, lines):
|
|
|
48
48
|
|
|
49
49
|
app.connect('autodoc-process-docstring', sphinx_display_parameters)
|
|
50
50
|
"""
|
|
51
|
-
if
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
51
|
+
if (
|
|
52
|
+
what == "class"
|
|
53
|
+
and issubclass(obj, Parameterized)
|
|
54
|
+
and any(":param parameters:" in line for line in lines)
|
|
55
|
+
):
|
|
56
|
+
# parse parameters
|
|
57
|
+
parameters = obj.get_parameters(sort=False)
|
|
58
|
+
if parameters:
|
|
59
|
+
lines.append(".. admonition::")
|
|
60
|
+
lines.append(f" Parameters of {obj.__name__}:")
|
|
61
|
+
lines.append(" ")
|
|
62
|
+
for p in parameters.values():
|
|
63
|
+
lines.append(f" {p.name}")
|
|
64
|
+
text = p.description.splitlines()
|
|
65
|
+
text.append(f"(Default value: :code:`{p.default_value!r}`)")
|
|
66
|
+
text = [" " + t for t in text]
|
|
67
|
+
lines.extend(text)
|
|
66
68
|
lines.append("")
|
|
69
|
+
lines.append("")
|
|
67
70
|
|
|
68
71
|
|
|
69
72
|
def setup(app):
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
.. codeauthor:: David Zwicker <david.zwicker@ds.mpg.de>
|
|
5
5
|
"""
|
|
6
6
|
|
|
7
|
-
import
|
|
7
|
+
from pathlib import Path
|
|
8
8
|
|
|
9
9
|
from modelrunner import ResultCollection, make_model_class
|
|
10
10
|
|
|
@@ -19,11 +19,11 @@ if __name__ == "__main__":
|
|
|
19
19
|
model = make_model_class(multiply)
|
|
20
20
|
|
|
21
21
|
# write data
|
|
22
|
-
|
|
22
|
+
Path("data").mkdir(parents=True)
|
|
23
23
|
for n, a in enumerate(range(5, 10)):
|
|
24
24
|
result = model({"a": a}).get_result()
|
|
25
25
|
result.to_file(f"data/test_{n}.json")
|
|
26
26
|
|
|
27
27
|
# read data
|
|
28
28
|
rc = ResultCollection.from_folder("data")
|
|
29
|
-
print(rc.
|
|
29
|
+
print(rc.as_dataframe())
|
|
@@ -69,14 +69,14 @@ class Config(collections.UserDict):
|
|
|
69
69
|
"""Load configuration from yaml file."""
|
|
70
70
|
import yaml
|
|
71
71
|
|
|
72
|
-
with
|
|
72
|
+
with Path(path).open() as fp:
|
|
73
73
|
self.update(yaml.safe_load(fp))
|
|
74
74
|
|
|
75
75
|
def save(self, path: str | Path):
|
|
76
76
|
"""Save configuration to yaml file."""
|
|
77
77
|
import yaml
|
|
78
78
|
|
|
79
|
-
with open(
|
|
79
|
+
with Path(path).open("w") as fp:
|
|
80
80
|
yaml.dump(self.to_dict(), fp)
|
|
81
81
|
|
|
82
82
|
def __getitem__(self, key: str):
|
|
@@ -124,7 +124,7 @@ class Config(collections.UserDict):
|
|
|
124
124
|
Returns:
|
|
125
125
|
dict: A representation of the configuration in a normal :class:`dict`.
|
|
126
126
|
"""
|
|
127
|
-
return
|
|
127
|
+
return dict(self.items())
|
|
128
128
|
|
|
129
129
|
def __repr__(self) -> str:
|
|
130
130
|
"""Represent the configuration as a string."""
|
|
@@ -17,7 +17,10 @@ from ..utils import is_serial_or_mpi_root
|
|
|
17
17
|
from .parameters import DeprecatedParameter, HideParameter, Parameterized
|
|
18
18
|
|
|
19
19
|
if TYPE_CHECKING:
|
|
20
|
-
from ..run.results import Result
|
|
20
|
+
from ..run.results import Result
|
|
21
|
+
|
|
22
|
+
_base_logger = logging.getLogger(__name__.rsplit(".", 1)[0])
|
|
23
|
+
""":class:`logging.Logger`: Base logger for models."""
|
|
21
24
|
|
|
22
25
|
|
|
23
26
|
class ModelBase(Parameterized, metaclass=ABCMeta):
|
|
@@ -27,6 +30,7 @@ class ModelBase(Parameterized, metaclass=ABCMeta):
|
|
|
27
30
|
"""str: the name of the model"""
|
|
28
31
|
description: str | None = None
|
|
29
32
|
"""str: a longer description of the model"""
|
|
33
|
+
_logger: logging.Logger # logger instance to output information
|
|
30
34
|
|
|
31
35
|
def __init__(
|
|
32
36
|
self,
|
|
@@ -63,7 +67,12 @@ class ModelBase(Parameterized, metaclass=ABCMeta):
|
|
|
63
67
|
self.output = output # TODO: also allow already opened storages
|
|
64
68
|
self.mode = mode
|
|
65
69
|
self._storage: open_storage | None = None
|
|
66
|
-
|
|
70
|
+
|
|
71
|
+
def __init_subclass__(cls, **kwargs):
|
|
72
|
+
"""Initialize class-level attributes of subclasses."""
|
|
73
|
+
super().__init_subclass__(**kwargs)
|
|
74
|
+
# create logger for this specific field class
|
|
75
|
+
cls._logger = _base_logger.getChild(cls.__qualname__)
|
|
67
76
|
|
|
68
77
|
@property
|
|
69
78
|
def storage(self) -> StorageGroup:
|
|
@@ -97,7 +106,7 @@ class ModelBase(Parameterized, metaclass=ABCMeta):
|
|
|
97
106
|
Returns:
|
|
98
107
|
:class:`Result`: The result after the model is run
|
|
99
108
|
"""
|
|
100
|
-
from ..run.results import Result
|
|
109
|
+
from ..run.results import Result
|
|
101
110
|
|
|
102
111
|
if data is None:
|
|
103
112
|
data = self()
|
|
@@ -112,7 +121,7 @@ class ModelBase(Parameterized, metaclass=ABCMeta):
|
|
|
112
121
|
result:
|
|
113
122
|
The result data. If omitted, the model is run to obtain results
|
|
114
123
|
"""
|
|
115
|
-
from ..run.results import Result
|
|
124
|
+
from ..run.results import Result
|
|
116
125
|
|
|
117
126
|
if self.output is None:
|
|
118
127
|
raise RuntimeError("Output file needs to be specified")
|
|
@@ -14,7 +14,7 @@ from .base import ModelBase
|
|
|
14
14
|
from .parameters import NoValue, Parameter
|
|
15
15
|
|
|
16
16
|
if TYPE_CHECKING:
|
|
17
|
-
from ..run.results import Result
|
|
17
|
+
from ..run.results import Result
|
|
18
18
|
|
|
19
19
|
_DEFAULT_MODEL: Callable | ModelBase | None = None
|
|
20
20
|
"""Stores the default model that will be used automatically."""
|
|
@@ -26,6 +26,9 @@ import numpy as np
|
|
|
26
26
|
|
|
27
27
|
from ..utils import hybridmethod, import_class
|
|
28
28
|
|
|
29
|
+
_logger = logging.getLogger(__name__)
|
|
30
|
+
""":class:`logging.Logger`: Logger instance."""
|
|
31
|
+
|
|
29
32
|
|
|
30
33
|
class NoValueType:
|
|
31
34
|
"""Special value to indicate no value for a parameter."""
|
|
@@ -129,8 +132,10 @@ class Parameter:
|
|
|
129
132
|
)
|
|
130
133
|
|
|
131
134
|
if not valid_default:
|
|
132
|
-
|
|
133
|
-
|
|
135
|
+
_logger.warning(
|
|
136
|
+
"Default value `%s` is not of type `%s`",
|
|
137
|
+
self.name,
|
|
138
|
+
self.cls.__name__,
|
|
134
139
|
)
|
|
135
140
|
|
|
136
141
|
def __getstate__(self):
|
|
@@ -254,8 +259,6 @@ class Parameter:
|
|
|
254
259
|
class DeprecatedParameter(Parameter):
|
|
255
260
|
"""A parameter that can still be used normally but is deprecated."""
|
|
256
261
|
|
|
257
|
-
pass
|
|
258
|
-
|
|
259
262
|
|
|
260
263
|
class HideParameter:
|
|
261
264
|
"""A helper class that allows hiding parameters of the parent classes.
|
|
@@ -314,7 +317,7 @@ class Parameterized:
|
|
|
314
317
|
parameters, include_deprecated=True, check_validity=strict
|
|
315
318
|
)
|
|
316
319
|
|
|
317
|
-
def __init_subclass__(cls, **kwargs) -> None:
|
|
320
|
+
def __init_subclass__(cls, **kwargs) -> None:
|
|
318
321
|
"""Register all subclasses to reconstruct them later."""
|
|
319
322
|
# normalize the parameters_default attribute to be a list of `Parameter`
|
|
320
323
|
if hasattr(cls, "parameters_default") and isinstance(
|
|
@@ -470,7 +473,7 @@ class Parameterized:
|
|
|
470
473
|
return result
|
|
471
474
|
|
|
472
475
|
@classmethod
|
|
473
|
-
def get_parameter_default(cls, name):
|
|
476
|
+
def get_parameter_default(cls, name):
|
|
474
477
|
"""Return the default value for the parameter with `name`
|
|
475
478
|
|
|
476
479
|
Args:
|
|
@@ -551,7 +554,7 @@ class Parameterized:
|
|
|
551
554
|
yield template.format(**data)
|
|
552
555
|
|
|
553
556
|
@hybridmethod
|
|
554
|
-
def show_parameters(
|
|
557
|
+
def show_parameters(
|
|
555
558
|
cls,
|
|
556
559
|
description: bool = False,
|
|
557
560
|
sort: bool = False,
|
|
@@ -125,13 +125,13 @@ def _get_format_version(path: Path, label: str) -> int | None:
|
|
|
125
125
|
# check for compatibility
|
|
126
126
|
fmt = guess_format(path)
|
|
127
127
|
if fmt == "json":
|
|
128
|
-
with open(
|
|
128
|
+
with path.open() as fp:
|
|
129
129
|
format_version = _find_version(json.load(fp), label)
|
|
130
130
|
|
|
131
131
|
elif fmt == "yaml":
|
|
132
132
|
import yaml
|
|
133
133
|
|
|
134
|
-
with open(
|
|
134
|
+
with path.open() as fp:
|
|
135
135
|
format_version = _find_version(yaml.safe_load(fp), label)
|
|
136
136
|
|
|
137
137
|
elif fmt == "hdf":
|
|
@@ -79,14 +79,14 @@ def result_from_file_v0(path: Path, **kwargs) -> Result:
|
|
|
79
79
|
"""
|
|
80
80
|
fmt = guess_format(path)
|
|
81
81
|
if fmt == "json":
|
|
82
|
-
with open(
|
|
82
|
+
with path.open() as fp:
|
|
83
83
|
content = json.load(fp)
|
|
84
84
|
return _Result_from_simple_objects(content, **kwargs)
|
|
85
85
|
|
|
86
86
|
elif fmt == "yaml":
|
|
87
87
|
import yaml
|
|
88
88
|
|
|
89
|
-
with open(
|
|
89
|
+
with path.open() as fp:
|
|
90
90
|
content = yaml.safe_load(fp)
|
|
91
91
|
return _Result_from_simple_objects(content, **kwargs)
|
|
92
92
|
|
|
@@ -26,13 +26,11 @@ if TYPE_CHECKING:
|
|
|
26
26
|
class NoData:
|
|
27
27
|
"""Helper class that marks data omission."""
|
|
28
28
|
|
|
29
|
-
...
|
|
30
|
-
|
|
31
29
|
|
|
32
30
|
TState = TypeVar("TState", bound="StateBase")
|
|
33
31
|
|
|
34
32
|
|
|
35
|
-
class StateBase
|
|
33
|
+
class StateBase:
|
|
36
34
|
"""Base class for specifying the state of a simulation.
|
|
37
35
|
|
|
38
36
|
A state contains values of all degrees of freedom of a physical system (called the
|
|
@@ -224,19 +222,19 @@ def result_from_file_v1(store: Path, *, label: str = "data", **kwargs) -> Result
|
|
|
224
222
|
"""
|
|
225
223
|
fmt = guess_format(store)
|
|
226
224
|
if fmt == "json":
|
|
227
|
-
with open(
|
|
225
|
+
with store.open() as fp:
|
|
228
226
|
content = json.load(fp)
|
|
229
227
|
return _Result_from_simple_objects(content, **kwargs)
|
|
230
228
|
|
|
231
229
|
elif fmt == "yaml":
|
|
232
230
|
import yaml
|
|
233
231
|
|
|
234
|
-
with open(
|
|
232
|
+
with store.open() as fp:
|
|
235
233
|
content = yaml.safe_load(fp)
|
|
236
234
|
return _Result_from_simple_objects(content, **kwargs)
|
|
237
235
|
|
|
238
236
|
elif fmt == "zarr":
|
|
239
|
-
import zarr
|
|
237
|
+
import zarr
|
|
240
238
|
|
|
241
239
|
zarr_store = normalize_zarr_store(store, mode="r")
|
|
242
240
|
root = zarr.open_group(zarr_store, mode="r")
|
|
@@ -28,12 +28,12 @@ def escape_string(obj) -> str:
|
|
|
28
28
|
return shlex.quote(str(obj))
|
|
29
29
|
|
|
30
30
|
|
|
31
|
-
def ensure_directory_exists(folder):
|
|
31
|
+
def ensure_directory_exists(folder: str | Path) -> None:
|
|
32
32
|
"""Creates a folder if it not already exists."""
|
|
33
33
|
if folder == "":
|
|
34
34
|
return
|
|
35
35
|
try:
|
|
36
|
-
|
|
36
|
+
Path(folder).mkdir(parents=True)
|
|
37
37
|
except OSError as err:
|
|
38
38
|
if err.errno != errno.EEXIST:
|
|
39
39
|
raise
|
|
@@ -199,7 +199,7 @@ def submit_job(
|
|
|
199
199
|
else:
|
|
200
200
|
template_path = Path(template)
|
|
201
201
|
logger.info("Load template `%s`", template_path)
|
|
202
|
-
with open(
|
|
202
|
+
with template_path.open() as fp:
|
|
203
203
|
script_template = fp.read()
|
|
204
204
|
|
|
205
205
|
# prepare submission script
|
|
@@ -9,6 +9,7 @@ import importlib.util
|
|
|
9
9
|
import inspect
|
|
10
10
|
import logging
|
|
11
11
|
import os.path
|
|
12
|
+
from pathlib import Path
|
|
12
13
|
from typing import Callable, Sequence
|
|
13
14
|
|
|
14
15
|
from ..model import ModelBase, cleared_default_model, factory, make_model_class
|
|
@@ -35,7 +36,7 @@ def run_function_with_cmd_args(
|
|
|
35
36
|
|
|
36
37
|
|
|
37
38
|
@cleared_default_model
|
|
38
|
-
def run_script(script_path: str, model_args: Sequence[str]) -> Result:
|
|
39
|
+
def run_script(script_path: str | Path, model_args: Sequence[str]) -> Result:
|
|
39
40
|
"""Helper function that runs a model script.
|
|
40
41
|
|
|
41
42
|
The function detects models automatically by trying several methods until one yields
|
|
@@ -59,7 +60,7 @@ def run_script(script_path: str, model_args: Sequence[str]) -> Result:
|
|
|
59
60
|
logger = logging.getLogger("modelrunner")
|
|
60
61
|
|
|
61
62
|
# load the script as a module
|
|
62
|
-
filename =
|
|
63
|
+
filename = Path(script_path).name
|
|
63
64
|
spec = importlib.util.spec_from_file_location("model_code", script_path)
|
|
64
65
|
if spec is None:
|
|
65
66
|
raise OSError(f"Could not find job script `{script_path}`")
|
|
@@ -11,7 +11,7 @@ import itertools
|
|
|
11
11
|
import logging
|
|
12
12
|
import warnings
|
|
13
13
|
from pathlib import Path
|
|
14
|
-
from typing import Any, Iterator, List
|
|
14
|
+
from typing import Any, Collection, Iterator, List
|
|
15
15
|
|
|
16
16
|
import numpy as np
|
|
17
17
|
from tqdm.auto import tqdm
|
|
@@ -276,11 +276,11 @@ class ResultCollection(List[Result]):
|
|
|
276
276
|
progress (bool):
|
|
277
277
|
Flag indicating whether a progress bar is shown
|
|
278
278
|
"""
|
|
279
|
-
logger = logging.getLogger(cls.__name__)
|
|
279
|
+
logger = logging.getLogger("modelrunner." + cls.__name__)
|
|
280
280
|
|
|
281
281
|
folder = Path(folder)
|
|
282
282
|
if not folder.is_dir():
|
|
283
|
-
logger.warning(
|
|
283
|
+
logger.warning("%s is not a directory", folder)
|
|
284
284
|
|
|
285
285
|
# iterate over all files and load them as a Result
|
|
286
286
|
results = []
|
|
@@ -293,7 +293,7 @@ class ResultCollection(List[Result]):
|
|
|
293
293
|
err.args = (str(err) + f"\nError reading file `{path}`",)
|
|
294
294
|
raise
|
|
295
295
|
else:
|
|
296
|
-
logger.warning(
|
|
296
|
+
logger.warning("Error reading file `%s`", path)
|
|
297
297
|
else:
|
|
298
298
|
results.append(result)
|
|
299
299
|
|
|
@@ -303,7 +303,7 @@ class ResultCollection(List[Result]):
|
|
|
303
303
|
logger.warning("Did not find any files")
|
|
304
304
|
else:
|
|
305
305
|
logger.warning(
|
|
306
|
-
|
|
306
|
+
"Did not find any files. Is pattern `%s` too restrictive?", pattern
|
|
307
307
|
)
|
|
308
308
|
|
|
309
309
|
return cls(results)
|
|
@@ -316,6 +316,7 @@ class ResultCollection(List[Result]):
|
|
|
316
316
|
def __add__(self, other: ResultCollection) -> ResultCollection: # type: ignore
|
|
317
317
|
if isinstance(other, ResultCollection):
|
|
318
318
|
return ResultCollection(super().__add__(other))
|
|
319
|
+
return None
|
|
319
320
|
|
|
320
321
|
@property
|
|
321
322
|
def same_model(self) -> bool:
|
|
@@ -441,22 +442,21 @@ class ResultCollection(List[Result]):
|
|
|
441
442
|
seen.append(result.parameters)
|
|
442
443
|
return self.__class__(unique_results)
|
|
443
444
|
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
# deprecated on 2023-10-19
|
|
448
|
-
warnings.warn("Property `dataframe` deprecated; use method `as_dataframe`")
|
|
449
|
-
return self.as_dataframe()
|
|
450
|
-
|
|
451
|
-
def as_dataframe(self, *, enforce_same_model: bool = True):
|
|
445
|
+
def as_dataframe(
|
|
446
|
+
self, *, enforce_same_model: bool = True, drop_keys: Collection | None = None
|
|
447
|
+
):
|
|
452
448
|
"""Create a pandas dataframe summarizing the data.
|
|
453
449
|
|
|
454
450
|
Args:
|
|
455
451
|
enforce_same_model (bool):
|
|
456
452
|
If True, forces all model results to derive from the same model
|
|
453
|
+
drop_keys (sequence):
|
|
454
|
+
A list of items that will not be included in the final data frame
|
|
457
455
|
"""
|
|
458
456
|
import pandas as pd
|
|
459
457
|
|
|
458
|
+
drop_keys = set() if drop_keys is None else set(drop_keys)
|
|
459
|
+
|
|
460
460
|
if enforce_same_model and not self.same_model:
|
|
461
461
|
raise RuntimeError("Results are not from the same model")
|
|
462
462
|
|
|
@@ -476,10 +476,14 @@ class ResultCollection(List[Result]):
|
|
|
476
476
|
df_data["result"] = data
|
|
477
477
|
elif isinstance(data, dict):
|
|
478
478
|
for key, value in data.items():
|
|
479
|
+
if key in drop_keys:
|
|
480
|
+
continue
|
|
479
481
|
if np.isscalar(value):
|
|
480
482
|
df_data[key] = value
|
|
481
483
|
elif isinstance(value, (list, tuple, np.ndarray)):
|
|
482
484
|
df_data[key] = np.asarray(value)
|
|
485
|
+
else:
|
|
486
|
+
df_data[key] = value
|
|
483
487
|
else:
|
|
484
488
|
raise RuntimeError("Do not know how to interpret result")
|
|
485
489
|
return df_data
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
from .access_modes import AccessError, ModeType
|
|
14
14
|
from .attributes import Attrs
|
|
15
15
|
from .backend import *
|
|
16
|
-
from .base import StorageBase
|
|
16
|
+
from .base import StorageBase
|
|
17
17
|
from .group import StorageGroup
|
|
18
18
|
from .tools import StorageID, open_storage
|
|
19
19
|
from .trajectory import Trajectory, TrajectoryWriter
|