experimaestro 1.13.0__tar.gz → 1.15.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.
Potentially problematic release.
This version of experimaestro might be problematic. Click here for more details.
- {experimaestro-1.13.0 → experimaestro-1.15.0}/PKG-INFO +1 -1
- {experimaestro-1.13.0 → experimaestro-1.15.0}/pyproject.toml +2 -2
- {experimaestro-1.13.0 → experimaestro-1.15.0}/src/experimaestro/core/arguments.py +10 -1
- {experimaestro-1.13.0 → experimaestro-1.15.0}/src/experimaestro/core/identifier.py +11 -6
- {experimaestro-1.13.0 → experimaestro-1.15.0}/src/experimaestro/core/objects/config.py +89 -181
- {experimaestro-1.13.0 → experimaestro-1.15.0}/src/experimaestro/core/objects/config_walk.py +4 -6
- {experimaestro-1.13.0 → experimaestro-1.15.0}/src/experimaestro/core/objects.pyi +2 -6
- {experimaestro-1.13.0 → experimaestro-1.15.0}/src/experimaestro/core/serializers.py +1 -8
- {experimaestro-1.13.0 → experimaestro-1.15.0}/src/experimaestro/tests/test_dependencies.py +0 -6
- experimaestro-1.15.0/src/experimaestro/tests/test_generators.py +93 -0
- {experimaestro-1.13.0 → experimaestro-1.15.0}/src/experimaestro/tests/test_identifier.py +87 -76
- {experimaestro-1.13.0 → experimaestro-1.15.0}/src/experimaestro/tests/test_instance.py +0 -12
- experimaestro-1.15.0/src/experimaestro/tests/test_serializers.py +54 -0
- {experimaestro-1.13.0 → experimaestro-1.15.0}/src/experimaestro/tests/test_tasks.py +0 -20
- {experimaestro-1.13.0 → experimaestro-1.15.0}/src/experimaestro/tests/test_types.py +2 -2
- experimaestro-1.13.0/src/experimaestro/tests/test_generators.py +0 -33
- experimaestro-1.13.0/src/experimaestro/tests/test_serializers.py +0 -113
- {experimaestro-1.13.0 → experimaestro-1.15.0}/LICENSE +0 -0
- {experimaestro-1.13.0 → experimaestro-1.15.0}/README.md +0 -0
- {experimaestro-1.13.0 → experimaestro-1.15.0}/src/experimaestro/__init__.py +0 -0
- {experimaestro-1.13.0 → experimaestro-1.15.0}/src/experimaestro/__main__.py +0 -0
- {experimaestro-1.13.0 → experimaestro-1.15.0}/src/experimaestro/annotations.py +0 -0
- {experimaestro-1.13.0 → experimaestro-1.15.0}/src/experimaestro/checkers.py +0 -0
- {experimaestro-1.13.0 → experimaestro-1.15.0}/src/experimaestro/cli/__init__.py +0 -0
- {experimaestro-1.13.0 → experimaestro-1.15.0}/src/experimaestro/cli/filter.py +0 -0
- {experimaestro-1.13.0 → experimaestro-1.15.0}/src/experimaestro/cli/jobs.py +0 -0
- {experimaestro-1.13.0 → experimaestro-1.15.0}/src/experimaestro/click.py +0 -0
- {experimaestro-1.13.0 → experimaestro-1.15.0}/src/experimaestro/commandline.py +0 -0
- {experimaestro-1.13.0 → experimaestro-1.15.0}/src/experimaestro/compat.py +0 -0
- {experimaestro-1.13.0 → experimaestro-1.15.0}/src/experimaestro/connectors/__init__.py +0 -0
- {experimaestro-1.13.0 → experimaestro-1.15.0}/src/experimaestro/connectors/local.py +0 -0
- {experimaestro-1.13.0 → experimaestro-1.15.0}/src/experimaestro/connectors/ssh.py +0 -0
- {experimaestro-1.13.0 → experimaestro-1.15.0}/src/experimaestro/core/__init__.py +0 -0
- {experimaestro-1.13.0 → experimaestro-1.15.0}/src/experimaestro/core/callbacks.py +0 -0
- {experimaestro-1.13.0 → experimaestro-1.15.0}/src/experimaestro/core/context.py +0 -0
- {experimaestro-1.13.0 → experimaestro-1.15.0}/src/experimaestro/core/objects/__init__.py +0 -0
- {experimaestro-1.13.0 → experimaestro-1.15.0}/src/experimaestro/core/objects/config_utils.py +0 -0
- {experimaestro-1.13.0 → experimaestro-1.15.0}/src/experimaestro/core/serialization.py +0 -0
- {experimaestro-1.13.0 → experimaestro-1.15.0}/src/experimaestro/core/types.py +0 -0
- {experimaestro-1.13.0 → experimaestro-1.15.0}/src/experimaestro/core/utils.py +0 -0
- {experimaestro-1.13.0 → experimaestro-1.15.0}/src/experimaestro/exceptions.py +0 -0
- {experimaestro-1.13.0 → experimaestro-1.15.0}/src/experimaestro/experiments/__init__.py +0 -0
- {experimaestro-1.13.0 → experimaestro-1.15.0}/src/experimaestro/experiments/cli.py +0 -0
- {experimaestro-1.13.0 → experimaestro-1.15.0}/src/experimaestro/experiments/configuration.py +0 -0
- {experimaestro-1.13.0 → experimaestro-1.15.0}/src/experimaestro/generators.py +0 -0
- {experimaestro-1.13.0 → experimaestro-1.15.0}/src/experimaestro/huggingface.py +0 -0
- {experimaestro-1.13.0 → experimaestro-1.15.0}/src/experimaestro/ipc.py +0 -0
- {experimaestro-1.13.0 → experimaestro-1.15.0}/src/experimaestro/launcherfinder/__init__.py +0 -0
- {experimaestro-1.13.0 → experimaestro-1.15.0}/src/experimaestro/launcherfinder/base.py +0 -0
- {experimaestro-1.13.0 → experimaestro-1.15.0}/src/experimaestro/launcherfinder/parser.py +0 -0
- {experimaestro-1.13.0 → experimaestro-1.15.0}/src/experimaestro/launcherfinder/registry.py +0 -0
- {experimaestro-1.13.0 → experimaestro-1.15.0}/src/experimaestro/launcherfinder/specs.py +0 -0
- {experimaestro-1.13.0 → experimaestro-1.15.0}/src/experimaestro/launchers/__init__.py +0 -0
- {experimaestro-1.13.0 → experimaestro-1.15.0}/src/experimaestro/launchers/direct.py +0 -0
- {experimaestro-1.13.0 → experimaestro-1.15.0}/src/experimaestro/launchers/oar.py +0 -0
- {experimaestro-1.13.0 → experimaestro-1.15.0}/src/experimaestro/launchers/slurm/__init__.py +0 -0
- {experimaestro-1.13.0 → experimaestro-1.15.0}/src/experimaestro/launchers/slurm/base.py +0 -0
- {experimaestro-1.13.0 → experimaestro-1.15.0}/src/experimaestro/locking.py +0 -0
- {experimaestro-1.13.0 → experimaestro-1.15.0}/src/experimaestro/mkdocs/__init__.py +0 -0
- {experimaestro-1.13.0 → experimaestro-1.15.0}/src/experimaestro/mkdocs/annotations.py +0 -0
- {experimaestro-1.13.0 → experimaestro-1.15.0}/src/experimaestro/mkdocs/base.py +0 -0
- {experimaestro-1.13.0 → experimaestro-1.15.0}/src/experimaestro/mkdocs/metaloader.py +0 -0
- {experimaestro-1.13.0 → experimaestro-1.15.0}/src/experimaestro/mkdocs/style.css +0 -0
- {experimaestro-1.13.0 → experimaestro-1.15.0}/src/experimaestro/mypy.py +0 -0
- {experimaestro-1.13.0 → experimaestro-1.15.0}/src/experimaestro/notifications.py +0 -0
- {experimaestro-1.13.0 → experimaestro-1.15.0}/src/experimaestro/py.typed +0 -0
- {experimaestro-1.13.0 → experimaestro-1.15.0}/src/experimaestro/rpyc.py +0 -0
- {experimaestro-1.13.0 → experimaestro-1.15.0}/src/experimaestro/run.py +0 -0
- {experimaestro-1.13.0 → experimaestro-1.15.0}/src/experimaestro/scheduler/__init__.py +0 -0
- {experimaestro-1.13.0 → experimaestro-1.15.0}/src/experimaestro/scheduler/base.py +0 -0
- {experimaestro-1.13.0 → experimaestro-1.15.0}/src/experimaestro/scheduler/dependencies.py +0 -0
- {experimaestro-1.13.0 → experimaestro-1.15.0}/src/experimaestro/scheduler/dynamic_outputs.py +0 -0
- {experimaestro-1.13.0 → experimaestro-1.15.0}/src/experimaestro/scheduler/services.py +0 -0
- {experimaestro-1.13.0 → experimaestro-1.15.0}/src/experimaestro/scheduler/state.py +0 -0
- {experimaestro-1.13.0 → experimaestro-1.15.0}/src/experimaestro/scheduler/workspace.py +0 -0
- {experimaestro-1.13.0 → experimaestro-1.15.0}/src/experimaestro/scriptbuilder.py +0 -0
- {experimaestro-1.13.0 → experimaestro-1.15.0}/src/experimaestro/server/__init__.py +0 -0
- {experimaestro-1.13.0 → experimaestro-1.15.0}/src/experimaestro/server/data/0c35d18bf06992036b69.woff2 +0 -0
- {experimaestro-1.13.0 → experimaestro-1.15.0}/src/experimaestro/server/data/1815e00441357e01619e.ttf +0 -0
- {experimaestro-1.13.0 → experimaestro-1.15.0}/src/experimaestro/server/data/219aa9140e099e6c72ed.woff2 +0 -0
- {experimaestro-1.13.0 → experimaestro-1.15.0}/src/experimaestro/server/data/2463b90d9a316e4e5294.woff2 +0 -0
- {experimaestro-1.13.0 → experimaestro-1.15.0}/src/experimaestro/server/data/2582b0e4bcf85eceead0.ttf +0 -0
- {experimaestro-1.13.0 → experimaestro-1.15.0}/src/experimaestro/server/data/3a4004a46a653d4b2166.woff +0 -0
- {experimaestro-1.13.0 → experimaestro-1.15.0}/src/experimaestro/server/data/3baa5b8f3469222b822d.woff +0 -0
- {experimaestro-1.13.0 → experimaestro-1.15.0}/src/experimaestro/server/data/4d73cb90e394b34b7670.woff +0 -0
- {experimaestro-1.13.0 → experimaestro-1.15.0}/src/experimaestro/server/data/4ef4218c522f1eb6b5b1.woff2 +0 -0
- {experimaestro-1.13.0 → experimaestro-1.15.0}/src/experimaestro/server/data/5d681e2edae8c60630db.woff +0 -0
- {experimaestro-1.13.0 → experimaestro-1.15.0}/src/experimaestro/server/data/6f420cf17cc0d7676fad.woff2 +0 -0
- {experimaestro-1.13.0 → experimaestro-1.15.0}/src/experimaestro/server/data/89999bdf5d835c012025.woff2 +0 -0
- {experimaestro-1.13.0 → experimaestro-1.15.0}/src/experimaestro/server/data/914997e1bdfc990d0897.ttf +0 -0
- {experimaestro-1.13.0 → experimaestro-1.15.0}/src/experimaestro/server/data/c210719e60948b211a12.woff2 +0 -0
- {experimaestro-1.13.0 → experimaestro-1.15.0}/src/experimaestro/server/data/c380809fd3677d7d6903.woff2 +0 -0
- {experimaestro-1.13.0 → experimaestro-1.15.0}/src/experimaestro/server/data/f882956fd323fd322f31.woff +0 -0
- {experimaestro-1.13.0 → experimaestro-1.15.0}/src/experimaestro/server/data/favicon.ico +0 -0
- {experimaestro-1.13.0 → experimaestro-1.15.0}/src/experimaestro/server/data/index.css +0 -0
- {experimaestro-1.13.0 → experimaestro-1.15.0}/src/experimaestro/server/data/index.css.map +0 -0
- {experimaestro-1.13.0 → experimaestro-1.15.0}/src/experimaestro/server/data/index.html +0 -0
- {experimaestro-1.13.0 → experimaestro-1.15.0}/src/experimaestro/server/data/index.js +0 -0
- {experimaestro-1.13.0 → experimaestro-1.15.0}/src/experimaestro/server/data/index.js.map +0 -0
- {experimaestro-1.13.0 → experimaestro-1.15.0}/src/experimaestro/server/data/login.html +0 -0
- {experimaestro-1.13.0 → experimaestro-1.15.0}/src/experimaestro/server/data/manifest.json +0 -0
- {experimaestro-1.13.0 → experimaestro-1.15.0}/src/experimaestro/settings.py +0 -0
- {experimaestro-1.13.0 → experimaestro-1.15.0}/src/experimaestro/sphinx/__init__.py +0 -0
- {experimaestro-1.13.0 → experimaestro-1.15.0}/src/experimaestro/sphinx/static/experimaestro.css +0 -0
- {experimaestro-1.13.0 → experimaestro-1.15.0}/src/experimaestro/taskglobals.py +0 -0
- {experimaestro-1.13.0 → experimaestro-1.15.0}/src/experimaestro/tests/__init__.py +0 -0
- {experimaestro-1.13.0 → experimaestro-1.15.0}/src/experimaestro/tests/conftest.py +0 -0
- {experimaestro-1.13.0 → experimaestro-1.15.0}/src/experimaestro/tests/connectors/bin/executable.py +0 -0
- {experimaestro-1.13.0 → experimaestro-1.15.0}/src/experimaestro/tests/connectors/test_local.py +0 -0
- {experimaestro-1.13.0 → experimaestro-1.15.0}/src/experimaestro/tests/connectors/utils.py +0 -0
- {experimaestro-1.13.0 → experimaestro-1.15.0}/src/experimaestro/tests/core/__init__.py +0 -0
- {experimaestro-1.13.0 → experimaestro-1.15.0}/src/experimaestro/tests/core/test_generics.py +0 -0
- {experimaestro-1.13.0 → experimaestro-1.15.0}/src/experimaestro/tests/definitions_types.py +0 -0
- {experimaestro-1.13.0 → experimaestro-1.15.0}/src/experimaestro/tests/launchers/__init__.py +0 -0
- {experimaestro-1.13.0 → experimaestro-1.15.0}/src/experimaestro/tests/launchers/bin/sacct +0 -0
- {experimaestro-1.13.0 → experimaestro-1.15.0}/src/experimaestro/tests/launchers/bin/sbatch +0 -0
- {experimaestro-1.13.0 → experimaestro-1.15.0}/src/experimaestro/tests/launchers/bin/srun +0 -0
- {experimaestro-1.13.0 → experimaestro-1.15.0}/src/experimaestro/tests/launchers/bin/test.py +0 -0
- {experimaestro-1.13.0 → experimaestro-1.15.0}/src/experimaestro/tests/launchers/common.py +0 -0
- {experimaestro-1.13.0 → experimaestro-1.15.0}/src/experimaestro/tests/launchers/config_slurm/__init__.py +0 -0
- {experimaestro-1.13.0 → experimaestro-1.15.0}/src/experimaestro/tests/launchers/config_slurm/launchers.py +0 -0
- {experimaestro-1.13.0 → experimaestro-1.15.0}/src/experimaestro/tests/launchers/test_local.py +0 -0
- {experimaestro-1.13.0 → experimaestro-1.15.0}/src/experimaestro/tests/launchers/test_slurm.py +0 -0
- {experimaestro-1.13.0 → experimaestro-1.15.0}/src/experimaestro/tests/restart.py +0 -0
- {experimaestro-1.13.0 → experimaestro-1.15.0}/src/experimaestro/tests/restart_main.py +0 -0
- {experimaestro-1.13.0 → experimaestro-1.15.0}/src/experimaestro/tests/scripts/notifyandwait.py +0 -0
- {experimaestro-1.13.0 → experimaestro-1.15.0}/src/experimaestro/tests/scripts/waitforfile.py +0 -0
- {experimaestro-1.13.0 → experimaestro-1.15.0}/src/experimaestro/tests/task_tokens.py +0 -0
- {experimaestro-1.13.0 → experimaestro-1.15.0}/src/experimaestro/tests/tasks/__init__.py +0 -0
- {experimaestro-1.13.0 → experimaestro-1.15.0}/src/experimaestro/tests/tasks/all.py +0 -0
- {experimaestro-1.13.0 → experimaestro-1.15.0}/src/experimaestro/tests/tasks/foreign.py +0 -0
- {experimaestro-1.13.0 → experimaestro-1.15.0}/src/experimaestro/tests/test_checkers.py +0 -0
- {experimaestro-1.13.0 → experimaestro-1.15.0}/src/experimaestro/tests/test_experiment.py +0 -0
- {experimaestro-1.13.0 → experimaestro-1.15.0}/src/experimaestro/tests/test_findlauncher.py +0 -0
- {experimaestro-1.13.0 → experimaestro-1.15.0}/src/experimaestro/tests/test_forward.py +0 -0
- {experimaestro-1.13.0 → experimaestro-1.15.0}/src/experimaestro/tests/test_objects.py +0 -0
- {experimaestro-1.13.0 → experimaestro-1.15.0}/src/experimaestro/tests/test_outputs.py +0 -0
- {experimaestro-1.13.0 → experimaestro-1.15.0}/src/experimaestro/tests/test_param.py +0 -0
- {experimaestro-1.13.0 → experimaestro-1.15.0}/src/experimaestro/tests/test_progress.py +0 -0
- {experimaestro-1.13.0 → experimaestro-1.15.0}/src/experimaestro/tests/test_snippets.py +0 -0
- {experimaestro-1.13.0 → experimaestro-1.15.0}/src/experimaestro/tests/test_ssh.py +0 -0
- {experimaestro-1.13.0 → experimaestro-1.15.0}/src/experimaestro/tests/test_tags.py +0 -0
- {experimaestro-1.13.0 → experimaestro-1.15.0}/src/experimaestro/tests/test_tokens.py +0 -0
- {experimaestro-1.13.0 → experimaestro-1.15.0}/src/experimaestro/tests/test_validation.py +0 -0
- {experimaestro-1.13.0 → experimaestro-1.15.0}/src/experimaestro/tests/token_reschedule.py +0 -0
- {experimaestro-1.13.0 → experimaestro-1.15.0}/src/experimaestro/tests/utils.py +0 -0
- {experimaestro-1.13.0 → experimaestro-1.15.0}/src/experimaestro/tokens.py +0 -0
- {experimaestro-1.13.0 → experimaestro-1.15.0}/src/experimaestro/tools/__init__.py +0 -0
- {experimaestro-1.13.0 → experimaestro-1.15.0}/src/experimaestro/tools/diff.py +0 -0
- {experimaestro-1.13.0 → experimaestro-1.15.0}/src/experimaestro/tools/documentation.py +0 -0
- {experimaestro-1.13.0 → experimaestro-1.15.0}/src/experimaestro/tools/jobs.py +0 -0
- {experimaestro-1.13.0 → experimaestro-1.15.0}/src/experimaestro/typingutils.py +0 -0
- {experimaestro-1.13.0 → experimaestro-1.15.0}/src/experimaestro/utils/__init__.py +0 -0
- {experimaestro-1.13.0 → experimaestro-1.15.0}/src/experimaestro/utils/asyncio.py +0 -0
- {experimaestro-1.13.0 → experimaestro-1.15.0}/src/experimaestro/utils/jobs.py +0 -0
- {experimaestro-1.13.0 → experimaestro-1.15.0}/src/experimaestro/utils/jupyter.py +0 -0
- {experimaestro-1.13.0 → experimaestro-1.15.0}/src/experimaestro/utils/multiprocessing.py +0 -0
- {experimaestro-1.13.0 → experimaestro-1.15.0}/src/experimaestro/utils/resources.py +0 -0
- {experimaestro-1.13.0 → experimaestro-1.15.0}/src/experimaestro/utils/settings.py +0 -0
- {experimaestro-1.13.0 → experimaestro-1.15.0}/src/experimaestro/xpmutils.py +0 -0
|
@@ -48,7 +48,7 @@ dependencies = [
|
|
|
48
48
|
"typing-extensions >=4.2; python_version < \"3.12\"",
|
|
49
49
|
"watchdog >=2"
|
|
50
50
|
]
|
|
51
|
-
version = "1.
|
|
51
|
+
version = "1.15.0"
|
|
52
52
|
|
|
53
53
|
[tool.poetry-dynamic-versioning]
|
|
54
54
|
enable = false
|
|
@@ -140,7 +140,7 @@ warn_unused_ignores = true
|
|
|
140
140
|
|
|
141
141
|
[tool.commitizen]
|
|
142
142
|
name = "cz_conventional_commits"
|
|
143
|
-
version = "1.
|
|
143
|
+
version = "1.15.0"
|
|
144
144
|
changelog_start_rev = "v1.0.0"
|
|
145
145
|
tag_format = "v$major.$minor.$patch$prerelease"
|
|
146
146
|
# update_changelog_on_bump = true
|
|
@@ -80,10 +80,12 @@ class Argument:
|
|
|
80
80
|
|
|
81
81
|
self.generator = generator
|
|
82
82
|
self.default = None
|
|
83
|
+
self.ignore_generated = False
|
|
83
84
|
|
|
84
85
|
if default is not None:
|
|
85
86
|
assert self.generator is None, "generator and default are exclusive options"
|
|
86
87
|
if isinstance(default, field):
|
|
88
|
+
self.ignore_generated = default.ignore_generated
|
|
87
89
|
if default.default is not None:
|
|
88
90
|
self.default = default.default
|
|
89
91
|
elif default.default_factory is not None:
|
|
@@ -184,13 +186,20 @@ DataPath = Annotated[Path, dataHint]
|
|
|
184
186
|
class field:
|
|
185
187
|
"""Extra information for a given experimaestro field (param or meta)"""
|
|
186
188
|
|
|
187
|
-
def __init__(
|
|
189
|
+
def __init__(
|
|
190
|
+
self,
|
|
191
|
+
*,
|
|
192
|
+
default: Any = None,
|
|
193
|
+
default_factory: Callable = None,
|
|
194
|
+
ignore_generated=False,
|
|
195
|
+
):
|
|
188
196
|
assert not (
|
|
189
197
|
(default is not None) and (default_factory is not None)
|
|
190
198
|
), "default and default_factory are mutually exclusive options"
|
|
191
199
|
|
|
192
200
|
self.default_factory = default_factory
|
|
193
201
|
self.default = default
|
|
202
|
+
self.ignore_generated = ignore_generated
|
|
194
203
|
|
|
195
204
|
|
|
196
205
|
class help(TypeAnnotation):
|
|
@@ -6,7 +6,7 @@ import logging
|
|
|
6
6
|
import os
|
|
7
7
|
import struct
|
|
8
8
|
from typing import Optional
|
|
9
|
-
from experimaestro.core.objects import Config
|
|
9
|
+
from experimaestro.core.objects import Config, ConfigMixin
|
|
10
10
|
|
|
11
11
|
|
|
12
12
|
class ConfigPath:
|
|
@@ -116,7 +116,7 @@ class IdentifierComputer:
|
|
|
116
116
|
CYCLE_REFERENCE = b"\x0b"
|
|
117
117
|
INIT_TASKS = b"\x0c"
|
|
118
118
|
|
|
119
|
-
def __init__(self, config: "
|
|
119
|
+
def __init__(self, config: "ConfigMixin", config_path: ConfigPath, *, version=None):
|
|
120
120
|
# Hasher for parameters
|
|
121
121
|
self._hasher = hashlib.sha256()
|
|
122
122
|
self.config = config
|
|
@@ -170,7 +170,7 @@ class IdentifierComputer:
|
|
|
170
170
|
self._hashupdate(IdentifierComputer.ENUM_ID)
|
|
171
171
|
k = value.__class__
|
|
172
172
|
self._hashupdate(
|
|
173
|
-
f"{k.__module__}.{k.__qualname__
|
|
173
|
+
f"{k.__module__}.{k.__qualname__}:{value.name}".encode("utf-8"),
|
|
174
174
|
)
|
|
175
175
|
elif isinstance(value, dict):
|
|
176
176
|
self._hashupdate(IdentifierComputer.DICT_ID)
|
|
@@ -183,7 +183,7 @@ class IdentifierComputer:
|
|
|
183
183
|
self.update(value)
|
|
184
184
|
|
|
185
185
|
# Handles configurations
|
|
186
|
-
elif isinstance(value,
|
|
186
|
+
elif isinstance(value, ConfigMixin):
|
|
187
187
|
# Encodes the identifier
|
|
188
188
|
self._hashupdate(IdentifierComputer.OBJECT_ID)
|
|
189
189
|
|
|
@@ -264,12 +264,17 @@ class IdentifierComputer:
|
|
|
264
264
|
self._hashupdate(IdentifierComputer.NAME_ID)
|
|
265
265
|
self.update(argvalue)
|
|
266
266
|
|
|
267
|
+
# Add init tasks
|
|
268
|
+
if value.__xpm__.init_tasks:
|
|
269
|
+
self._hashupdate(IdentifierComputer.INIT_TASKS)
|
|
270
|
+
for init_task in value.__xpm__.init_tasks:
|
|
271
|
+
self.update(init_task)
|
|
267
272
|
else:
|
|
268
273
|
raise NotImplementedError("Cannot compute hash of type %s" % type(value))
|
|
269
274
|
|
|
270
275
|
@staticmethod
|
|
271
276
|
def compute(
|
|
272
|
-
config: "
|
|
277
|
+
config: "ConfigMixin", config_path: ConfigPath | None = None, version=None
|
|
273
278
|
) -> Identifier:
|
|
274
279
|
"""Compute the identifier for a configuration
|
|
275
280
|
|
|
@@ -281,7 +286,7 @@ class IdentifierComputer:
|
|
|
281
286
|
# Try to use the cached value first
|
|
282
287
|
# (if there are no loops)
|
|
283
288
|
if config.__xpm__._sealed:
|
|
284
|
-
identifier = config.__xpm__.
|
|
289
|
+
identifier = config.__xpm__._identifier
|
|
285
290
|
if identifier is not None and not identifier.has_loops:
|
|
286
291
|
return identifier
|
|
287
292
|
|
|
@@ -9,7 +9,6 @@ from experimaestro import taskglobals
|
|
|
9
9
|
|
|
10
10
|
from termcolor import cprint
|
|
11
11
|
from pathlib import Path
|
|
12
|
-
import hashlib
|
|
13
12
|
import logging
|
|
14
13
|
import io
|
|
15
14
|
from enum import Enum
|
|
@@ -20,7 +19,6 @@ from typing import (
|
|
|
20
19
|
Callable,
|
|
21
20
|
ClassVar,
|
|
22
21
|
Dict,
|
|
23
|
-
Iterator,
|
|
24
22
|
List,
|
|
25
23
|
Optional,
|
|
26
24
|
Set,
|
|
@@ -49,7 +47,6 @@ from .config_walk import ConfigWalk, ConfigWalkContext
|
|
|
49
47
|
from .config_utils import (
|
|
50
48
|
getqualattr,
|
|
51
49
|
add_to_path,
|
|
52
|
-
SealedError,
|
|
53
50
|
TaggedValue,
|
|
54
51
|
ObjectStore,
|
|
55
52
|
classproperty,
|
|
@@ -149,9 +146,6 @@ class ConfigInformation:
|
|
|
149
146
|
# This is used to check typevars coherence
|
|
150
147
|
self.concrete_typevars: Dict[TypeVar, type] = {}
|
|
151
148
|
|
|
152
|
-
# Lightweight tasks
|
|
153
|
-
self.pre_tasks: List["LightweightTask"] = []
|
|
154
|
-
|
|
155
149
|
# Initialization tasks
|
|
156
150
|
self.init_tasks: List["LightweightTask"] = []
|
|
157
151
|
|
|
@@ -160,20 +154,40 @@ class ConfigInformation:
|
|
|
160
154
|
|
|
161
155
|
# Cached information
|
|
162
156
|
|
|
163
|
-
self.
|
|
164
|
-
"""The
|
|
165
|
-
|
|
166
|
-
self._raw_identifier = None
|
|
167
|
-
"""The identifier without taking into account pre-tasks"""
|
|
157
|
+
self._identifier = None
|
|
158
|
+
"""The configuration identifier (cached when sealed)"""
|
|
168
159
|
|
|
169
160
|
self._validated = False
|
|
170
161
|
self._sealed = False
|
|
171
162
|
self._meta = None
|
|
172
163
|
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
self.
|
|
164
|
+
# This contains the list of generated values (using context) in this
|
|
165
|
+
# configuration or any sub-configuration, is generated. This prevents
|
|
166
|
+
# problem when a configuration with generated values is re-used.
|
|
167
|
+
self._generated_values = []
|
|
168
|
+
|
|
169
|
+
def get_generated_paths(
|
|
170
|
+
self, path: list[str] = None, paths: list[str] = None
|
|
171
|
+
) -> list[str]:
|
|
172
|
+
"""Get the list of generated paths, useful to track down those
|
|
173
|
+
|
|
174
|
+
:param path: The current path
|
|
175
|
+
:param paths: The list of generated paths so far, defaults to None
|
|
176
|
+
:return: The full list of generated paths
|
|
177
|
+
"""
|
|
178
|
+
paths = [] if paths is None else paths
|
|
179
|
+
path = [] if path is None else path
|
|
180
|
+
|
|
181
|
+
for key in self._generated_values:
|
|
182
|
+
value = self.values[key]
|
|
183
|
+
if isinstance(value, ConfigMixin) and value.__xpm__._generated_values:
|
|
184
|
+
path.append(key)
|
|
185
|
+
value.__xpm__.get_generated_paths(path, paths)
|
|
186
|
+
path.pop()
|
|
187
|
+
else:
|
|
188
|
+
paths.append(".".join(path + [key]))
|
|
189
|
+
|
|
190
|
+
return paths
|
|
177
191
|
|
|
178
192
|
def set_meta(self, value: Optional[bool]):
|
|
179
193
|
"""Sets the meta flag"""
|
|
@@ -192,6 +206,31 @@ class ConfigInformation:
|
|
|
192
206
|
# Not an argument, bypass
|
|
193
207
|
return object.__getattribute__(self.pyobject, name)
|
|
194
208
|
|
|
209
|
+
@staticmethod
|
|
210
|
+
def is_generated_value(argument, value):
|
|
211
|
+
if argument.ignore_generated:
|
|
212
|
+
return False
|
|
213
|
+
|
|
214
|
+
if value is None:
|
|
215
|
+
return False
|
|
216
|
+
|
|
217
|
+
if isinstance(value, (int, str, float, bool, Path)):
|
|
218
|
+
return False
|
|
219
|
+
|
|
220
|
+
if isinstance(value, ConfigMixin):
|
|
221
|
+
return value.__xpm__._generated_values and value.__xpm__.task is None
|
|
222
|
+
|
|
223
|
+
if isinstance(value, list):
|
|
224
|
+
return any(ConfigInformation.is_generated_value(argument, x) for x in value)
|
|
225
|
+
|
|
226
|
+
if isinstance(value, dict):
|
|
227
|
+
return any(
|
|
228
|
+
ConfigInformation.is_generated_value(argument, x)
|
|
229
|
+
for x in value.values()
|
|
230
|
+
)
|
|
231
|
+
|
|
232
|
+
return False
|
|
233
|
+
|
|
195
234
|
def set(self, k, v, bypass=False):
|
|
196
235
|
from experimaestro.generators import Generator
|
|
197
236
|
|
|
@@ -208,18 +247,16 @@ class ConfigInformation:
|
|
|
208
247
|
"Configuration (and not objects) should be used. Consider using .C(...)"
|
|
209
248
|
)
|
|
210
249
|
|
|
211
|
-
if (
|
|
212
|
-
isinstance(v, ConfigMixin)
|
|
213
|
-
and v.__xpm__._has_generated_value
|
|
214
|
-
and v.__xpm__.task is None
|
|
215
|
-
):
|
|
216
|
-
raise AttributeError(
|
|
217
|
-
f"Cannot set {k} to a configuration with generated values"
|
|
218
|
-
)
|
|
219
|
-
|
|
220
250
|
try:
|
|
221
251
|
argument = self.xpmtype.arguments.get(k, None)
|
|
222
252
|
if argument:
|
|
253
|
+
if ConfigInformation.is_generated_value(argument, v):
|
|
254
|
+
raise AttributeError(
|
|
255
|
+
f"Cannot set {k} to a configuration with generated values. "
|
|
256
|
+
"Here is the list of paths to help you: "
|
|
257
|
+
f"""{', '.join(v.__xpm__.get_generated_paths([k]))}"""
|
|
258
|
+
)
|
|
259
|
+
|
|
223
260
|
if not bypass and (
|
|
224
261
|
(isinstance(argument.generator, Generator)) or argument.constant
|
|
225
262
|
):
|
|
@@ -321,10 +358,6 @@ class ConfigInformation:
|
|
|
321
358
|
% (k, self.xpmtype, self._initinfo)
|
|
322
359
|
)
|
|
323
360
|
|
|
324
|
-
# Validate pre-tasks
|
|
325
|
-
for pre_task in self.pre_tasks:
|
|
326
|
-
pre_task.__xpm__.validate()
|
|
327
|
-
|
|
328
361
|
# Validate init tasks
|
|
329
362
|
for init_task in self.init_tasks:
|
|
330
363
|
init_task.__xpm__.validate()
|
|
@@ -345,6 +378,15 @@ class ConfigInformation:
|
|
|
345
378
|
Arguments:
|
|
346
379
|
- context: the generation context
|
|
347
380
|
"""
|
|
381
|
+
if generated_keys := [
|
|
382
|
+
k
|
|
383
|
+
for k, v in self.values.items()
|
|
384
|
+
if ConfigInformation.is_generated_value(self.xpmtype.arguments[k], v)
|
|
385
|
+
]:
|
|
386
|
+
raise AttributeError(
|
|
387
|
+
"Cannot seal a configuration with generated values:"
|
|
388
|
+
f"""{",".join(generated_keys)} in {context.currentpath}"""
|
|
389
|
+
)
|
|
348
390
|
|
|
349
391
|
class Sealer(ConfigWalk):
|
|
350
392
|
def preprocess(self, config: ConfigMixin):
|
|
@@ -368,13 +410,15 @@ class ConfigInformation:
|
|
|
368
410
|
if len(sig.parameters) == 0:
|
|
369
411
|
value = argument.generator()
|
|
370
412
|
elif len(sig.parameters) == 2:
|
|
413
|
+
# Only in that case do we need to flag this configuration
|
|
414
|
+
# as containing generated values
|
|
415
|
+
config.__xpm__._generated_values.append(k)
|
|
371
416
|
value = argument.generator(self.context, config)
|
|
372
417
|
else:
|
|
373
418
|
assert (
|
|
374
419
|
False
|
|
375
420
|
), "generator has either two parameters (context and config), or none"
|
|
376
421
|
config.__xpm__.set(k, value, bypass=True)
|
|
377
|
-
config.__xpm__._has_generated_value = True
|
|
378
422
|
else:
|
|
379
423
|
value = config.__xpm__.values.get(k)
|
|
380
424
|
except Exception:
|
|
@@ -387,9 +431,9 @@ class ConfigInformation:
|
|
|
387
431
|
if (
|
|
388
432
|
(value is not None)
|
|
389
433
|
and isinstance(value, ConfigMixin)
|
|
390
|
-
and value.__xpm__.
|
|
434
|
+
and value.__xpm__._generated_values
|
|
391
435
|
):
|
|
392
|
-
|
|
436
|
+
config.__xpm__._generated_values.append(k)
|
|
393
437
|
|
|
394
438
|
config.__xpm__._sealed = True
|
|
395
439
|
|
|
@@ -403,90 +447,29 @@ class ConfigInformation:
|
|
|
403
447
|
context = ConfigWalkContext()
|
|
404
448
|
|
|
405
449
|
class Unsealer(ConfigWalk):
|
|
406
|
-
def preprocess(self, config:
|
|
450
|
+
def preprocess(self, config: ConfigMixin):
|
|
407
451
|
return config.__xpm__._sealed, config
|
|
408
452
|
|
|
409
|
-
def postprocess(self, stub, config:
|
|
453
|
+
def postprocess(self, stub, config: ConfigMixin, values):
|
|
410
454
|
config.__xpm__._sealed = False
|
|
411
455
|
config.__xpm__._identifier = None
|
|
412
456
|
|
|
413
457
|
Unsealer(context, recurse_task=True)(self.pyobject)
|
|
414
458
|
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
pre_tasks: Dict[int, "Config"] = {}
|
|
418
|
-
|
|
419
|
-
class PreTaskCollect(ConfigWalk):
|
|
420
|
-
def preprocess(self, config: Config):
|
|
421
|
-
# Do not cross tasks
|
|
422
|
-
return not isinstance(config.__xpm__, Task), config
|
|
423
|
-
|
|
424
|
-
def postprocess(self, stub, config: Config, values):
|
|
425
|
-
pre_tasks.update(
|
|
426
|
-
{id(pre_task): pre_task for pre_task in config.__xpm__.pre_tasks}
|
|
427
|
-
)
|
|
428
|
-
|
|
429
|
-
PreTaskCollect(context, recurse_task=True)(self.pyobject)
|
|
430
|
-
return pre_tasks.values()
|
|
431
|
-
|
|
432
|
-
def identifiers(self, only_raw: bool):
|
|
459
|
+
@property
|
|
460
|
+
def identifier(self):
|
|
433
461
|
"""Computes the unique identifier"""
|
|
434
|
-
from ..identifier import IdentifierComputer
|
|
435
|
-
|
|
436
|
-
raw_identifier = self._raw_identifier
|
|
437
|
-
full_identifier = self._full_identifier
|
|
462
|
+
from ..identifier import IdentifierComputer
|
|
438
463
|
|
|
439
464
|
# Computes raw identifier if needed
|
|
440
|
-
if
|
|
441
|
-
|
|
442
|
-
raw_identifier = IdentifierComputer.compute(self.pyobject)
|
|
443
|
-
if self._sealed:
|
|
444
|
-
self._raw_identifier = raw_identifier
|
|
445
|
-
|
|
446
|
-
if only_raw:
|
|
447
|
-
return raw_identifier, full_identifier
|
|
448
|
-
|
|
449
|
-
# OK, let's compute the full identifier
|
|
450
|
-
if full_identifier is None or not self._sealed:
|
|
451
|
-
# Compute the full identifier by including the pre-tasks
|
|
452
|
-
hasher = hashlib.sha256()
|
|
453
|
-
hasher.update(raw_identifier.all)
|
|
454
|
-
pre_tasks_ids = [
|
|
455
|
-
pre_task.__xpm__.raw_identifier.all
|
|
456
|
-
for pre_task in self.collect_pre_tasks()
|
|
457
|
-
]
|
|
458
|
-
for task_id in sorted(pre_tasks_ids):
|
|
459
|
-
hasher.update(task_id)
|
|
460
|
-
|
|
461
|
-
# Adds init tasks
|
|
462
|
-
if self.init_tasks:
|
|
463
|
-
hasher.update(IdentifierComputer.INIT_TASKS)
|
|
464
|
-
for init_task in self.init_tasks:
|
|
465
|
-
hasher.update(init_task.__xpm__.raw_identifier.all)
|
|
466
|
-
|
|
467
|
-
full_identifier = Identifier(hasher.digest())
|
|
468
|
-
full_identifier.has_loops = raw_identifier.has_loops
|
|
469
|
-
|
|
470
|
-
# Only cache the identifier if sealed
|
|
471
|
-
if self._sealed:
|
|
472
|
-
self._full_identifier = full_identifier
|
|
465
|
+
if self._identifier is not None:
|
|
466
|
+
return self._identifier
|
|
473
467
|
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
raw_identifier, _ = self.identifiers(True)
|
|
480
|
-
return raw_identifier
|
|
481
|
-
|
|
482
|
-
@property
|
|
483
|
-
def full_identifier(self) -> "Identifier":
|
|
484
|
-
"""Computes the unique identifier (with task modifiers)"""
|
|
485
|
-
_, full_identifier = self.identifiers(False)
|
|
486
|
-
return full_identifier
|
|
487
|
-
|
|
488
|
-
identifier = full_identifier
|
|
489
|
-
"""Deprecated: use full_identifier"""
|
|
468
|
+
# Get the main identifier
|
|
469
|
+
identifier = IdentifierComputer.compute(self.pyobject)
|
|
470
|
+
if self._sealed:
|
|
471
|
+
self._identifier = identifier
|
|
472
|
+
return identifier
|
|
490
473
|
|
|
491
474
|
def dependency(self):
|
|
492
475
|
"""Returns a dependency"""
|
|
@@ -501,12 +484,6 @@ class ConfigInformation:
|
|
|
501
484
|
path: List[str],
|
|
502
485
|
taskids: Set[int],
|
|
503
486
|
):
|
|
504
|
-
# Add pre-tasks
|
|
505
|
-
for pre_task in self.pre_tasks:
|
|
506
|
-
pre_task.__xpm__.updatedependencies(
|
|
507
|
-
dependencies, path + ["__pre_tasks__"], taskids
|
|
508
|
-
)
|
|
509
|
-
|
|
510
487
|
# Add initialization tasks
|
|
511
488
|
for init_task in self.init_tasks:
|
|
512
489
|
init_task.__xpm__.updatedependencies(
|
|
@@ -776,9 +753,6 @@ class ConfigInformation:
|
|
|
776
753
|
if self.task is not None and self.task is not self:
|
|
777
754
|
ConfigInformation.__collect_objects__(self.task, objects, context)
|
|
778
755
|
|
|
779
|
-
# Serialize pre-tasks
|
|
780
|
-
ConfigInformation.__collect_objects__(self.pre_tasks, objects, context)
|
|
781
|
-
|
|
782
756
|
# Serialize initialization tasks
|
|
783
757
|
ConfigInformation.__collect_objects__(self.init_tasks, objects, context)
|
|
784
758
|
|
|
@@ -792,8 +766,6 @@ class ConfigInformation:
|
|
|
792
766
|
}
|
|
793
767
|
|
|
794
768
|
# Add pre/init tasks
|
|
795
|
-
if self.pre_tasks:
|
|
796
|
-
state_dict["pre-tasks"] = [id(pre_task) for pre_task in self.pre_tasks]
|
|
797
769
|
if self.init_tasks:
|
|
798
770
|
state_dict["init-tasks"] = [id(init_task) for init_task in self.init_tasks]
|
|
799
771
|
|
|
@@ -1125,12 +1097,6 @@ class ConfigInformation:
|
|
|
1125
1097
|
o.__post_init__()
|
|
1126
1098
|
|
|
1127
1099
|
else:
|
|
1128
|
-
# Sets pre-tasks
|
|
1129
|
-
o.__xpm__.pre_tasks = [
|
|
1130
|
-
objects[pre_task_id]
|
|
1131
|
-
for pre_task_id in definition.get("pre-tasks", [])
|
|
1132
|
-
]
|
|
1133
|
-
|
|
1134
1100
|
if task_id := definition.get("task", None):
|
|
1135
1101
|
o.__xpm__.task = objects[task_id]
|
|
1136
1102
|
|
|
@@ -1164,15 +1130,6 @@ class ConfigInformation:
|
|
|
1164
1130
|
|
|
1165
1131
|
# Run pre-task (or returns them)
|
|
1166
1132
|
if as_instance or return_tasks:
|
|
1167
|
-
# Collect pre-tasks (just once)
|
|
1168
|
-
completed_pretasks = set()
|
|
1169
|
-
pre_tasks = []
|
|
1170
|
-
for definition in definitions:
|
|
1171
|
-
for pre_task_id in definition.get("pre-tasks", []):
|
|
1172
|
-
if pre_task_id not in completed_pretasks:
|
|
1173
|
-
completed_pretasks.add(pre_task_id)
|
|
1174
|
-
pre_tasks.append(objects[pre_task_id])
|
|
1175
|
-
|
|
1176
1133
|
# Collect init tasks
|
|
1177
1134
|
init_tasks = []
|
|
1178
1135
|
for init_task_id in definitions[-1].get("init-tasks", []):
|
|
@@ -1180,14 +1137,11 @@ class ConfigInformation:
|
|
|
1180
1137
|
init_tasks.append(init_task)
|
|
1181
1138
|
|
|
1182
1139
|
if as_instance:
|
|
1183
|
-
for pre_task in pre_tasks:
|
|
1184
|
-
logger.info("Executing pre-task %s", type(pre_task))
|
|
1185
|
-
pre_task.execute()
|
|
1186
1140
|
for init_task in init_tasks:
|
|
1187
1141
|
logger.info("Executing init task %s", type(init_task))
|
|
1188
1142
|
init_task.execute()
|
|
1189
1143
|
else:
|
|
1190
|
-
return o,
|
|
1144
|
+
return o, init_tasks
|
|
1191
1145
|
|
|
1192
1146
|
return o
|
|
1193
1147
|
|
|
@@ -1195,7 +1149,6 @@ class ConfigInformation:
|
|
|
1195
1149
|
def __init__(self, context: ConfigWalkContext, *, objects: ObjectStore = None):
|
|
1196
1150
|
super().__init__(context)
|
|
1197
1151
|
self.objects = ObjectStore() if objects is None else objects
|
|
1198
|
-
self.pre_tasks = {}
|
|
1199
1152
|
|
|
1200
1153
|
def preprocess(self, config: "Config"):
|
|
1201
1154
|
if self.objects.is_constructed(id(config)):
|
|
@@ -1222,10 +1175,6 @@ class ConfigInformation:
|
|
|
1222
1175
|
# Call __post_init__
|
|
1223
1176
|
stub.__post_init__()
|
|
1224
1177
|
|
|
1225
|
-
# Gather pre-tasks
|
|
1226
|
-
for pre_task in config.__xpm__.pre_tasks:
|
|
1227
|
-
self.pre_tasks[id(pre_task)] = self.stub(pre_task)
|
|
1228
|
-
|
|
1229
1178
|
self.objects.set_constructed(id(config))
|
|
1230
1179
|
return stub
|
|
1231
1180
|
|
|
@@ -1239,10 +1188,6 @@ class ConfigInformation:
|
|
|
1239
1188
|
processor = ConfigInformation.FromPython(context, objects=objects)
|
|
1240
1189
|
last_object = processor(self.pyobject)
|
|
1241
1190
|
|
|
1242
|
-
# Execute pre-tasks
|
|
1243
|
-
for pre_task in processor.pre_tasks.values():
|
|
1244
|
-
pre_task.execute()
|
|
1245
|
-
|
|
1246
1191
|
return last_object
|
|
1247
1192
|
|
|
1248
1193
|
def add_dependencies(self, *dependencies):
|
|
@@ -1428,29 +1373,7 @@ class ConfigMixin:
|
|
|
1428
1373
|
attributes)"""
|
|
1429
1374
|
return clone(self)
|
|
1430
1375
|
|
|
1431
|
-
def
|
|
1432
|
-
assert all(
|
|
1433
|
-
[isinstance(task, LightweightTask) for task in tasks]
|
|
1434
|
-
), "One of the pre-tasks are not lightweight tasks"
|
|
1435
|
-
if self.__xpm__._sealed:
|
|
1436
|
-
raise SealedError("Cannot add pre-tasks to a sealed configuration")
|
|
1437
|
-
self.__xpm__.pre_tasks.extend(tasks)
|
|
1438
|
-
return self
|
|
1439
|
-
|
|
1440
|
-
def add_pretasks_from(self, *configs: "Config"):
|
|
1441
|
-
assert all(
|
|
1442
|
-
[isinstance(config, ConfigMixin) for config in configs]
|
|
1443
|
-
), "One of the parameters is not a configuration object"
|
|
1444
|
-
for config in configs:
|
|
1445
|
-
self.add_pretasks(*config.__xpm__.pre_tasks)
|
|
1446
|
-
return self
|
|
1447
|
-
|
|
1448
|
-
@property
|
|
1449
|
-
def pre_tasks(self) -> List["LightweightTask"]:
|
|
1450
|
-
"""Access pre-tasks"""
|
|
1451
|
-
return self.__xpm__.pre_tasks
|
|
1452
|
-
|
|
1453
|
-
def copy_dependencies(self, other: "Config"):
|
|
1376
|
+
def copy_dependencies(self, other: "ConfigMixin"):
|
|
1454
1377
|
"""Add all the dependencies from other configuration"""
|
|
1455
1378
|
|
|
1456
1379
|
# Add task dependency
|
|
@@ -1587,27 +1510,12 @@ class Config:
|
|
|
1587
1510
|
def __identifier__(self) -> "Identifier":
|
|
1588
1511
|
return self.__xpm__.full_identifier
|
|
1589
1512
|
|
|
1590
|
-
def add_pretasks(self, *tasks: "LightweightTask"):
|
|
1591
|
-
"""Add pre-tasks"""
|
|
1592
|
-
raise AssertionError("This method can only be used during configuration")
|
|
1593
|
-
|
|
1594
|
-
def add_pretasks_from(self, *configs: "Config"):
|
|
1595
|
-
"""Add pre-tasks from the listed configurations"""
|
|
1596
|
-
raise AssertionError(
|
|
1597
|
-
"The 'add_pretasks_from' can only be used during configuration"
|
|
1598
|
-
)
|
|
1599
|
-
|
|
1600
1513
|
def copy_dependencies(self, other: "Config"):
|
|
1601
1514
|
"""Add pre-tasks from the listed configurations"""
|
|
1602
1515
|
raise AssertionError(
|
|
1603
1516
|
"The 'copy_dependencies' method can only be used during configuration"
|
|
1604
1517
|
)
|
|
1605
1518
|
|
|
1606
|
-
@property
|
|
1607
|
-
def pre_tasks(self) -> List["LightweightTask"]:
|
|
1608
|
-
"""Access pre-tasks"""
|
|
1609
|
-
raise AssertionError("Pre-tasks can be accessed only during configuration")
|
|
1610
|
-
|
|
1611
1519
|
def register_task_output(self, method, *args, **kwargs):
|
|
1612
1520
|
# Determine the path for this...
|
|
1613
1521
|
path = taskglobals.Env.instance().xpm_path / "task-outputs.jsonl"
|
|
@@ -71,6 +71,7 @@ class ConfigWalk:
|
|
|
71
71
|
return self.context.push(str(i))
|
|
72
72
|
|
|
73
73
|
def map(self, k: str):
|
|
74
|
+
"""Provides a path context when processing a tree"""
|
|
74
75
|
return self.context.push(k)
|
|
75
76
|
|
|
76
77
|
def stub(self, config):
|
|
@@ -108,11 +109,7 @@ class ConfigWalk:
|
|
|
108
109
|
else:
|
|
109
110
|
result[arg.name] = None
|
|
110
111
|
|
|
111
|
-
# Deals with
|
|
112
|
-
if info.pre_tasks:
|
|
113
|
-
with self.map("__pre_tasks__"):
|
|
114
|
-
self(info.pre_tasks)
|
|
115
|
-
|
|
112
|
+
# Deals with init tasks
|
|
116
113
|
if info.init_tasks:
|
|
117
114
|
with self.map("__init_tasks__"):
|
|
118
115
|
self(info.init_tasks)
|
|
@@ -123,7 +120,8 @@ class ConfigWalk:
|
|
|
123
120
|
and self.recurse_task
|
|
124
121
|
and x.__xpm__.task is not x
|
|
125
122
|
):
|
|
126
|
-
self(
|
|
123
|
+
with self.map("__task__"):
|
|
124
|
+
self(x.__xpm__.task)
|
|
127
125
|
|
|
128
126
|
processed = self.postprocess(stub, x, result)
|
|
129
127
|
self.visited[xid] = processed
|
|
@@ -168,7 +168,7 @@ class ConfigMixin:
|
|
|
168
168
|
*,
|
|
169
169
|
workspace: Incomplete | None = ...,
|
|
170
170
|
launcher: Incomplete | None = ...,
|
|
171
|
-
run_mode: RunMode =
|
|
171
|
+
run_mode: RunMode = ...,
|
|
172
172
|
): ...
|
|
173
173
|
def stdout(self): ...
|
|
174
174
|
def stderr(self): ...
|
|
@@ -195,11 +195,7 @@ class Config:
|
|
|
195
195
|
def __post_init__(self) -> None: ...
|
|
196
196
|
def __json__(self): ...
|
|
197
197
|
def __identifier__(self) -> Identifier: ...
|
|
198
|
-
def add_pretasks(self, *tasks: "LightweightTask"): ...
|
|
199
|
-
def add_pretasks_from(self, configs: "Config"): ...
|
|
200
198
|
def copy_dependencies(self, other: "Config"): ...
|
|
201
|
-
@property
|
|
202
|
-
def pre_tasks(self) -> List["LightweightTask"]: ...
|
|
203
199
|
|
|
204
200
|
class LightweightTask(Config):
|
|
205
201
|
def execute(self) -> None: ...
|
|
@@ -213,7 +209,7 @@ class Task(LightweightTask):
|
|
|
213
209
|
workspace: Incomplete | None = ...,
|
|
214
210
|
launcher: Incomplete | None = ...,
|
|
215
211
|
run_mode: RunMode = ...,
|
|
216
|
-
init_tasks: List["LightweightTask"] = []
|
|
212
|
+
init_tasks: List["LightweightTask"] = [],
|
|
217
213
|
): ...
|
|
218
214
|
def task_outputs(self, dep: Callable[[Config], None]) -> Any: ...
|
|
219
215
|
|
|
@@ -1,10 +1,8 @@
|
|
|
1
|
-
from typing import List, TypeVar
|
|
2
|
-
from pathlib import Path
|
|
1
|
+
from typing import List, TypeVar
|
|
3
2
|
from experimaestro import Param
|
|
4
3
|
|
|
5
4
|
from .objects import Config, LightweightTask
|
|
6
5
|
from .arguments import DataPath
|
|
7
|
-
from experimaestro import copyconfig
|
|
8
6
|
|
|
9
7
|
|
|
10
8
|
class SerializationLWTask(LightweightTask):
|
|
@@ -39,8 +37,3 @@ class PathSerializationLWTask(SerializationLWTask):
|
|
|
39
37
|
|
|
40
38
|
path: DataPath
|
|
41
39
|
"""Path containing the data"""
|
|
42
|
-
|
|
43
|
-
@classmethod
|
|
44
|
-
def construct(cls, value: T, path: Path, dep: Callable[[Config], Any]) -> T:
|
|
45
|
-
value = copyconfig(value)
|
|
46
|
-
return value.add_pretasks(dep(cls(value=value, path=path)))
|
|
@@ -85,9 +85,3 @@ def test_dependencies_inner_task_output(xp):
|
|
|
85
85
|
a = task_a.submit()
|
|
86
86
|
b = Inner_TaskB(param_a=a).submit()
|
|
87
87
|
check_dependencies(b, task_a)
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
def test_dependencies_pre_task(xp):
|
|
91
|
-
a = TaskA().submit()
|
|
92
|
-
a2 = TaskA().add_pretasks(a).submit()
|
|
93
|
-
check_dependencies(a2, a)
|