Skip to content

Process

abc

Abstract base class for flepimop2 processing steps.

ProcessABC

Bases: ModuleABC

Abstract base class for flepimop2 processing steps.

execute(*, dry_run=False)

Execute a processing step.

Parameters:

Name Type Description Default
dry_run bool

If True, the process will not actually execute but will simulate execution.

False

Raises:

Type Description
Flepimop2ValidationError

If validation fails during a dry run.

Source code in src/flepimop2/process/abc/__init__.py
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
def execute(self, *, dry_run: bool = False) -> None:
    """
    Execute a processing step.

    Args:
        dry_run: If True, the process will not actually execute but will simulate
            execution.

    Raises:
        Flepimop2ValidationError: If validation fails during a dry run.
    """
    if dry_run and (result := self._process_validate()) is not None:
        if result:
            raise Flepimop2ValidationError(result)
        return None
    return self._process(dry_run=dry_run)

build(config)

Build a ProcessABC from a configuration dictionary.

Parameters:

Name Type Description Default
config dict[str, Any] | ModuleModel

Configuration dictionary. The dict should contain a 'module' key, which will be used to lookup the Process module path. The module will have "flepimop2.process." prepended.

required

Returns:

Name Type Description
ProcessABC ProcessABC

The constructed process object.

Source code in src/flepimop2/process/abc/__init__.py
50
51
52
53
54
55
56
57
58
59
60
61
62
def build(config: dict[str, Any] | ModuleModel) -> ProcessABC:
    """Build a `ProcessABC` from a configuration dictionary.

    Args:
        config: Configuration dictionary. The dict should contain a
            'module' key, which will be used to lookup the Process module path.
            The module will have "flepimop2.process." prepended.

    Returns:
        ProcessABC: The constructed process object.

    """
    return _build(config, "process", "flepimop2.process.shell", ProcessABC)  # type: ignore[type-abstract]

shell

Shell process for flepimop2.

ShellProcess

Bases: ModuleModel, ProcessABC

Shell process for executing commands.

Attributes:

Name Type Description
module Literal['flepimop2.process.shell']

The module type, fixed to "flepimop2.process.shell".

command str

The shell command to execute.

args list[str]

Arguments to pass to the shell command.