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

Feature/remove session store #2219

Merged
Merged
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`
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you can keep the code from line 18-23 as is, as this is not related to ET

# 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 @@
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)

Check warning on line 329 in docs/source/kedro-viz_visualisation.md

View workflow job for this annotation

GitHub Actions / vale

[vale] docs/source/kedro-viz_visualisation.md#L329

[Kedro-viz.Spellings] Did you really mean 'VSCode'?
Raw output
{"message": "[Kedro-viz.Spellings] Did you really mean 'VSCode'?", "location": {"path": "docs/source/kedro-viz_visualisation.md", "range": {"start": {"line": 329, "column": 16}}}, "severity": "WARNING"}
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 @@

## 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).

Check warning on line 310 in package/README.md

View workflow job for this annotation

GitHub Actions / vale

[vale] package/README.md#L310

[Kedro-viz.Spellings] Did you really mean 'Zenodo'?
Raw output
{"message": "[Kedro-viz.Spellings] Did you really mean 'Zenodo'?", "location": {"path": "package/README.md", "range": {"start": {"line": 310, "column": 168}}}, "severity": "WARNING"}
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
Loading