-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Moves logic from
CanonicalWorkflow
to core.Workflow
and `ConfigWo…
…rkflow` The validation of `cycles` and `tasks` in `list_not_empty` is moved to the `ConfigWorkflow`. This subsequently required a modification of the tests that initalize a `ConfigWorkflow` with empty `cycles` and `tasks` as this is not anymore allowed through the tests. We switched to `BeforeValidator` as the check can be happen before pydantic validation. The `data_dict` and `task_dict` member variables are moved to the constructor of the `core.Workflow`. The constructor of `core.Workflow` is split into two: `from_config_workflow` constructor, which replicates the behavir of the previous constructor and the default construcor now accepts all required that are extracted from the passed `ConfigWorkflow` in the previous constructor as individual parameters. The introduction of the `from_config_file` constructor in ConfigWorkflow, which replicates the behavior of `load_workflow_config`, allows the `rootdir` to become a part of `ConfigWorkflow`. This approach eliminates the need for an external utility function for workflow creation from a file. Since the utility function was essentially acting as a constructor for `ConfigWorkflow`, it simplifies the interface by enabling direct access to the `rootdir` within `core.Workflow`. In addition we make `rootdir` and `name` not optional as these parameters cane determined in the new `from_config_file` and passed to the default constructor. Furthermore, We introduce the util function `validate_yaml_content` that allows a more generic usage of creating an instance from a `Conig*` class from a yaml string, especially used in the docstring tests.
- Loading branch information
1 parent
c57a890
commit f913fa4
Showing
8 changed files
with
155 additions
and
137 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
from ._yaml_data_models import ( | ||
load_workflow_config, | ||
ConfigWorkflow, | ||
) | ||
|
||
__all__ = [ | ||
"load_workflow_config", | ||
"ConfigWorkflow", | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,22 @@ | ||
import pathlib | ||
|
||
import pytest | ||
|
||
from sirocco.parsing import _yaml_data_models as models | ||
|
||
pytest_plugins = ["aiida.tools.pytest_fixtures"] | ||
|
||
|
||
@pytest.fixture(scope="session") | ||
def minimal_config() -> models.ConfigWorkflow: | ||
return models.ConfigWorkflow( | ||
name="minimal", | ||
rootdir=pathlib.Path("minimal"), | ||
cycles=[models.ConfigCycle(minimal={"tasks": [models.ConfigCycleTask(some_task={})]})], | ||
tasks=[models.ConfigShellTask(some_task={"plugin": "shell"})], | ||
data=models.ConfigData( | ||
available=[models.ConfigAvailableData(name="foo", type=models.DataType.FILE, src="foo.txt")], | ||
generated=[models.ConfigGeneratedData(name="bar", type=models.DataType.DIR, src="bar")], | ||
), | ||
parameters={}, | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.