Skip to content

Commit

Permalink
Feature/remove session store (#2219)
Browse files Browse the repository at this point in the history
* remove session store

Signed-off-by: Huong Nguyen <huong.nguyen@mckinsey.com>

* remove relateds tests

Signed-off-by: Huong Nguyen <huong.nguyen@mckinsey.com>

* remove doc about session store

Signed-off-by: Huong Nguyen <huong.nguyen@mckinsey.com>

* lint formatting

Signed-off-by: Huong Nguyen <huong.nguyen@mckinsey.com>

* remove session store from tests

Signed-off-by: Huong Nguyen <huong.nguyen@mckinsey.com>

* update docs reference

Signed-off-by: Huong Nguyen <huong.nguyen@mckinsey.com>

* update test_server

Signed-off-by: Huong Nguyen <huong.nguyen@mckinsey.com>

* remove sessions store from load_data

Signed-off-by: Huong Nguyen <huong.nguyen@mckinsey.com>

* remove make_db_session_factory

Signed-off-by: Huong Nguyen <huong.nguyen@mckinsey.com>

* remove session store from _load_data_helper

Signed-off-by: Huong Nguyen <huong.nguyen@mckinsey.com>

* remove database.py entirely

Signed-off-by: Huong Nguyen <huong.nguyen@mckinsey.com>

* remove test graphql folder

Signed-off-by: Huong Nguyen <huong.nguyen@mckinsey.com>

* remove cy test related to ET tab

Signed-off-by: Huong Nguyen <huong.nguyen@mckinsey.com>

* Revert changes for .md as it will be done separately

Signed-off-by: Huong Nguyen <huong.nguyen@mckinsey.com>

* revert contributing.md

Signed-off-by: Huong Nguyen <huong.nguyen@mckinsey.com>

* remove e2e test failed from ET

Signed-off-by: Huong Nguyen <huong.nguyen@mckinsey.com>

---------

Signed-off-by: Huong Nguyen <huong.nguyen@mckinsey.com>
Co-authored-by: Huong Nguyen <huong.nguyen@mckinsey.com>
  • Loading branch information
Huongg and Huong Nguyen authored Dec 9, 2024
1 parent 734f0be commit 7ca0bd0
Show file tree
Hide file tree
Showing 16 changed files with 11 additions and 1,642 deletions.
13 changes: 0 additions & 13 deletions demo-project/src/demo_project/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,6 @@
# List the installed plugins for which to disable auto-registry
# DISABLE_HOOKS_FOR_PLUGINS = ("kedro-viz",)

from pathlib import Path

# Define where to store data from a KedroSession. Defaults to BaseSessionStore.
# from kedro.framework.session.store import ShelveStore
from kedro_viz.integrations.kedro.sqlite_store import SQLiteStore

SESSION_STORE_CLASS = SQLiteStore
SESSION_STORE_ARGS = {"path": str(Path(__file__).parents[2] / "data")}

# Setup for collaborative experiment tracking.
# SESSION_STORE_ARGS = {"path": str(Path(__file__).parents[2] / "data"),
# "remote_path": "s3://{path-to-session_store}" }

# Define custom context class. Defaults to `KedroContext`
# CONTEXT_CLASS = KedroContext

Expand Down
2 changes: 1 addition & 1 deletion docs/source/experiment_tracking.md
Original file line number Diff line number Diff line change
Expand Up @@ -357,4 +357,4 @@ Additionally, you can monitor the changes to metrics over time from the pipeline

Clicking on any `MetricsDataset` node opens a side panel displaying how the metric value has changed over time:

![](./images/pipeline_show_metrics.gif)
![](./images/pipeline_show_metrics.gif)
2 changes: 1 addition & 1 deletion docs/source/kedro-viz_visualisation.md
Original file line number Diff line number Diff line change
Expand Up @@ -326,4 +326,4 @@ Press `Cmd` + `Shift` + `P` (on macOS) or `Ctrl` + `Shift` + `P` (on Windows/Lin
Type `kedro: Run Kedro Viz` and select the command.
This will launch Kedro-Viz and display your pipeline visually within the extension.

![Kedro Viz in VSCode](./images/viz-in-vscode.gif)
![Kedro Viz in VSCode](./images/viz-in-vscode.gif)
2 changes: 1 addition & 1 deletion package/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -307,4 +307,4 @@ Kedro-Viz is licensed under the [Apache 2.0](https://github.com/kedro-org/kedro-
## Citation
If you're an academic, Kedro-Viz can also help you, for example, as a tool to visualise how your publication's pipeline is structured. Find our citation reference on [Zenodo](https://doi.org/10.5281/zenodo.4277218).
If you're an academic, Kedro-Viz can also help you, for example, as a tool to visualise how your publication's pipeline is structured. Find our citation reference on [Zenodo](https://doi.org/10.5281/zenodo.4277218).
41 changes: 0 additions & 41 deletions package/kedro_viz/database.py

This file was deleted.

12 changes: 4 additions & 8 deletions package/kedro_viz/integrations/kedro/data_loader.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
from kedro import __version__
from kedro.framework.project import configure_project, pipelines
from kedro.framework.session import KedroSession
from kedro.framework.session.store import BaseSessionStore
from kedro.framework.startup import bootstrap_project
from kedro.io import DataCatalog
from kedro.pipeline import Pipeline
Expand Down Expand Up @@ -73,8 +72,7 @@ def _load_data_helper(
configuration.
is_lite: A flag to run Kedro-Viz in lite mode.
Returns:
A tuple containing the data catalog, pipeline dictionary, session store
and dataset stats dictionary.
A tuple containing the data catalog, pipeline dictionary and dataset stats dictionary.
"""

with KedroSession.create(
Expand All @@ -88,7 +86,6 @@ def _load_data_helper(
session._hook_manager = _VizNullPluginManager() # type: ignore

context = session.load_context()
session_store = session._store

# patch the AbstractDataset class for a custom
# implementation to handle kedro.io.core.DatasetError
Expand All @@ -110,7 +107,7 @@ def _load_data_helper(
# Useful for users who have `get_current_session` in their `register_pipelines()`.
pipelines_dict = dict(pipelines)
stats_dict = _get_dataset_stats(project_path)
return catalog, pipelines_dict, session_store, stats_dict
return catalog, pipelines_dict, stats_dict


def load_data(
Expand All @@ -120,7 +117,7 @@ def load_data(
package_name: Optional[str] = None,
extra_params: Optional[Dict[str, Any]] = None,
is_lite: bool = False,
) -> Tuple[DataCatalog, Dict[str, Pipeline], BaseSessionStore, Dict]:
) -> Tuple[DataCatalog, Dict[str, Pipeline], Dict]:
"""Load data from a Kedro project.
Args:
project_path: the path where the Kedro project is located.
Expand All @@ -134,8 +131,7 @@ def load_data(
configuration.
is_lite: A flag to run Kedro-Viz in lite mode.
Returns:
A tuple containing the data catalog, pipeline dictionary, session store
and dataset stats dictionary.
A tuple containing the data catalog, pipeline dictionary,and dataset stats dictionary.
"""
if package_name:
configure_project(package_name)
Expand Down
201 changes: 0 additions & 201 deletions package/kedro_viz/integrations/kedro/sqlite_store.py

This file was deleted.

13 changes: 2 additions & 11 deletions package/kedro_viz/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,13 @@
from pathlib import Path
from typing import Any, Dict, Optional

from kedro.framework.session.store import BaseSessionStore
from kedro.io import DataCatalog
from kedro.pipeline import Pipeline

from kedro_viz.autoreload_file_filter import AutoreloadFileFilter
from kedro_viz.constants import DEFAULT_HOST, DEFAULT_PORT
from kedro_viz.data_access import DataAccessManager, data_access_manager
from kedro_viz.database import make_db_session_factory
from kedro_viz.integrations.kedro import data_loader as kedro_data_loader
from kedro_viz.integrations.kedro.sqlite_store import SQLiteStore
from kedro_viz.launchers.utils import _check_viz_up, _wait_for, display_cli_message

DEV_PORT = 4142
Expand All @@ -23,18 +20,12 @@ def populate_data(
data_access_manager: DataAccessManager,
catalog: DataCatalog,
pipelines: Dict[str, Pipeline],
session_store: BaseSessionStore,
stats_dict: Dict,
):
"""Populate data repositories. Should be called once on application start
if creating an api app from project.
"""

if isinstance(session_store, SQLiteStore):
session_store.sync()
session_class = make_db_session_factory(session_store.location)
data_access_manager.set_db_session(session_class)

data_access_manager.add_catalog(catalog, pipelines)

# add dataset stats before adding pipelines as the data nodes
Expand All @@ -56,7 +47,7 @@ def load_and_populate_data(
"""Loads underlying Kedro project data and populates Kedro Viz Repositories"""

# Loads data from underlying Kedro Project
catalog, pipelines, session_store, stats_dict = kedro_data_loader.load_data(
catalog, pipelines, stats_dict = kedro_data_loader.load_data(
path, env, include_hooks, package_name, extra_params, is_lite
)

Expand All @@ -67,7 +58,7 @@ def load_and_populate_data(
)

# Creates data repositories which are used by Kedro Viz Backend APIs
populate_data(data_access_manager, catalog, pipelines, session_store, stats_dict)
populate_data(data_access_manager, catalog, pipelines, stats_dict)


def run_server(
Expand Down
Loading

0 comments on commit 7ca0bd0

Please sign in to comment.