-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactor `core.py` in order to allow for `Task` subclassing. - `core.py` becomes a module containing `graph_items.py`, `workflow.py` and `_tasks` - `Task` has a metaclass called `Plugin` to register all its subclasses - `Task` subclasses are stored in core._tasks - `Task.from_config` generates the right instance of the `Task` subclass - The logic for iterating over dates and parameters when constructing the IR has been moved to `workflow.py` - Pydantic checking for `Task` subclasses is not yet implemented. It will either go to the parsing part, like for the `Task` baseclass or the class itself to avoid code duplication.
- Loading branch information
Showing
9 changed files
with
202 additions
and
169 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
from . import parsing | ||
from . import core, parsing | ||
|
||
__all__ = ["parsing"] | ||
__all__ = ["parsing", "core"] | ||
|
||
__version__ = "0.0.0-dev0" |
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 |
---|---|---|
@@ -0,0 +1,4 @@ | ||
from .graph_items import Cycle, Data, GraphItem, Task | ||
from .workflow import Workflow | ||
|
||
__all__ = ["Workflow", "GraphItem", "Data", "Task", "Cycle"] |
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 |
---|---|---|
@@ -0,0 +1,3 @@ | ||
from . import icon_task, shell_task | ||
|
||
__all__ = ["icon_task", "shell_task"] |
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 |
---|---|---|
@@ -0,0 +1,13 @@ | ||
from __future__ import annotations | ||
|
||
from dataclasses import dataclass, field | ||
from typing import ClassVar | ||
|
||
from sirocco.core.graph_items import Task | ||
|
||
|
||
@dataclass | ||
class IconTask(Task): | ||
plugin: ClassVar[str] = "icon" | ||
|
||
namelists: dict = field(default_factory=dict) |
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 |
---|---|---|
@@ -0,0 +1,16 @@ | ||
from __future__ import annotations | ||
|
||
from dataclasses import dataclass | ||
from typing import ClassVar | ||
|
||
from sirocco.core.graph_items import Task | ||
|
||
|
||
@dataclass | ||
class ShellTask(Task): | ||
plugin: ClassVar[str] = "shell" | ||
|
||
command: str | None = None | ||
command_option: str | None = None | ||
input_arg_options: dict[str, str] | None = None | ||
src: str | None = None |
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.