Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Drop AppPipeline in favor of pipeline namespaces #14

Merged
merged 1 commit into from
Jan 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -158,4 +158,6 @@ kedro.db

.vscode/

.ruff_cache/
.ruff_cache/

notebooks/
1 change: 1 addition & 0 deletions kedro_boot/app/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from .app import AbstractKedroBootApp, CompileApp # noqa: F401
44 changes: 22 additions & 22 deletions kedro_boot/app.py → kedro_boot/app/app.py
Original file line number Diff line number Diff line change
@@ -1,27 +1,33 @@
"""``AbstractKedroBootApp`` is the base class for all kedro boot app implementations.
"""
from abc import ABC, abstractmethod
from typing import Any
from typing import Any, List

from kedro.config import OmegaConfigLoader
from kedro.config import ConfigLoader
from kedro.io import DataCatalog
from pluggy import PluginManager

from kedro_boot.pipeline import AppPipeline
from kedro_boot.session import KedroBootSession
from kedro.pipeline.pipeline import Pipeline
from kedro_boot.framework.session import KedroBootSession
from kedro_boot.framework.compiler.specs import CompilationSpec


class AbstractKedroBootApp(ABC):
"""``AbstractKedroBootApp`` is the base class for all kedro boot app implementations"""

LAZY_COMPILE = False

def __init__(self, compilation_specs: List[CompilationSpec] = None) -> None:
self._compilation_specs = compilation_specs

def run(
self,
pipeline: AppPipeline,
pipeline: Pipeline,
catalog: DataCatalog,
hook_manager: PluginManager,
session_id: str,
config_loader: OmegaConfigLoader,
lazy_compile: bool,
runtime_app_params: dict,
config_loader: ConfigLoader,
) -> Any:
"""Create a ``KedroBootSession`` then run the kedro boot app

Expand All @@ -30,21 +36,26 @@ def run(
catalog: The base ``DataCatalog`` from which to fetch data.
hook_manager: The ``PluginManager`` to activate hooks.
session_id: The id of the kedro session.
runtime_app_params (dict): params given by an App specific CLI
config_loader (OmegaConfigLoader): kedro ``OmegaConfigLoader`` object

Returns:
Any: the return value of the kedro boot app run method
"""

config_loader.update({"application": ["application*/"]})

session = KedroBootSession(
pipeline=pipeline,
catalog=catalog,
hook_manager=hook_manager,
session_id=session_id,
runtime_app_params=runtime_app_params,
config_loader=config_loader,
)

if not lazy_compile:
session.compile_catalog()
if not self.LAZY_COMPILE:
session.compile(compilation_specs=self._compilation_specs)

return self._run(session)

Expand All @@ -54,7 +65,7 @@ def _run(self, session: KedroBootSession) -> Any:
``KedrobootSession`` have already be created by run().

Args:
session (KedroBootSession): is the object that is responsible for managing the kedro boot app lifecycle
session (KedroBootSession): A user facing interface that expose kedro's resource to the kedro boot apps
"""
pass

Expand All @@ -71,7 +82,7 @@ def _run(self, session: KedroBootSession) -> Any:
return session.run()


class DryRunApp(AbstractKedroBootApp):
class CompileApp(AbstractKedroBootApp):
"""An App used to perform Dry Run.

Args:
Expand All @@ -80,14 +91,3 @@ class DryRunApp(AbstractKedroBootApp):

def _run(self, session: KedroBootSession) -> Any:
pass


class BridgeApp(AbstractKedroBootApp):
"""An App used by the booter to pass the instantiated kedro boot session.

Args:
AbstractKedroBootApp (_type_): _description_
"""

def _run(self, session: KedroBootSession) -> KedroBootSession:
return session
2 changes: 0 additions & 2 deletions kedro_boot/booter/__init__.py

This file was deleted.

62 changes: 0 additions & 62 deletions kedro_boot/booter/boot.py

This file was deleted.

181 changes: 0 additions & 181 deletions kedro_boot/booter/cli.py

This file was deleted.

1 change: 0 additions & 1 deletion kedro_boot/catalog/__init__.py

This file was deleted.

Loading
Loading