Skip to content

Commit

Permalink
Kedro CLI startup time made shorter
Browse files Browse the repository at this point in the history
- server.py: Moved `DEFAULT_HOST` and `DEFAULT_PORT` to `constants.py`
- launchers/cli.py: Moved `from kedro_viz.server ...` statement to
  viz function

Signed-off-by: Konrad Sikorski <znfgnu@gmail.com>
  • Loading branch information
znfgnu committed Dec 7, 2022
1 parent e1c3a99 commit 6189acb
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
3 changes: 3 additions & 0 deletions package/kedro_viz/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,6 @@
DEFAULT_REGISTERED_PIPELINE_ID = "__default__"
KEDRO_VERSION = VersionInfo.parse(kedro.__version__)
ROOT_MODULAR_PIPELINE_ID = "__root__"

DEFAULT_HOST = "127.0.0.1"
DEFAULT_PORT = 4141
3 changes: 2 additions & 1 deletion package/kedro_viz/launchers/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
from watchgod import RegExpWatcher, run_process

from kedro_viz import __version__
from kedro_viz.constants import DEFAULT_HOST, DEFAULT_PORT
from kedro_viz.integrations.pypi import get_latest_version, is_running_outdated_version
from kedro_viz.server import DEFAULT_HOST, DEFAULT_PORT, is_localhost, run_server


@click.group(name="Kedro-Viz")
Expand Down Expand Up @@ -82,6 +82,7 @@ def commands(): # pylint: disable=missing-function-docstring
)
def viz(host, port, browser, load_file, save_file, pipeline, env, autoreload, params):
"""Visualise a Kedro pipeline using Kedro viz."""
from kedro_viz.server import is_localhost, run_server
installed_version = VersionInfo.parse(__version__)
latest_version = get_latest_version()

Expand Down
3 changes: 1 addition & 2 deletions package/kedro_viz/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,12 @@

from kedro_viz.api import apps
from kedro_viz.api.rest.responses import EnhancedORJSONResponse, get_default_response
from kedro_viz.constants import DEFAULT_HOST, DEFAULT_PORT
from kedro_viz.data_access import DataAccessManager, data_access_manager
from kedro_viz.database import create_db_engine
from kedro_viz.integrations.kedro import data_loader as kedro_data_loader
from kedro_viz.models.experiment_tracking import Base

DEFAULT_HOST = "127.0.0.1"
DEFAULT_PORT = 4141
DEV_PORT = 4142


Expand Down

0 comments on commit 6189acb

Please sign in to comment.