hydroflows.workflow.Method#
- class hydroflows.workflow.Method[source]#
Bases:
ABC
Base method for all methods.
The method class defines the structure of a method in a HydroFlow workflow. It should have a name, input, output and params, and implement a _run and __init__ method.
Methods
Check if input exists and output parent directory exists.
Check if output files exist.
Run method with dummy outputs.
Create a new method instance from the method name and its initialization arguments.
Run the method with input/output checks.
Run all tests on the method.
Return a serialized dictionary representation of the method input, output and params.
Return flattened keyword-arguments which result in the same method parametrization.
Attributes
Return a dictionary representation of the method input, output and params.
Return the input parameters of the method.
name
Return the output parameters of the method.
Return the additional parameters of the method.
- property input: Parameters#
Return the input parameters of the method.
- property output: Parameters#
Return the output parameters of the method.
- property params: Parameters#
Return the additional parameters of the method.
- to_kwargs(mode='json', exclude_defaults=True, posix_path=False, return_refs=False, **kwargs) Dict[str, Any] [source]#
Return flattened keyword-arguments which result in the same method parametrization.
- property dict: Dict[str, Dict]#
Return a dictionary representation of the method input, output and params.
- to_dict(**kwargs) Dict [source]#
Return a serialized dictionary representation of the method input, output and params.
- classmethod from_kwargs(method_name: str | None = None, **kwargs) Method [source]#
Create a new method instance from the method name and its initialization arguments.
- dryrun(input_files: List[Path], missing_file_error: bool = False, touch_output: bool = False) List[Path] [source]#
Run method with dummy outputs.
- Parameters:
input_files (List[Path]) – List of input paths to check, by default None.
missing_file_error (bool, optional) – Raise an error if a missing file is encountered, by default False.
- Returns:
List of output paths.
- Return type:
List[Path]
- run(check_output: bool = True) None [source]#
Run the method with input/output checks.
- Parameters:
check_output (bool, optional) – Check if output files are created, by default True.