Skip to content

Commit

Permalink
[KED-2319] Check None on loading params (#326)
Browse files Browse the repository at this point in the history
* Check None on loading params
  • Loading branch information
limdauto authored Dec 8, 2020
1 parent 1427896 commit a68ba25
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions package/kedro_viz/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
from contextlib import closing
from functools import partial
from pathlib import Path
from typing import Dict, List, Set, Union
from typing import Any, Dict, List, Set, Union

import click
import kedro
Expand Down Expand Up @@ -455,6 +455,15 @@ def _get_dataset_data_params(namespace: str):
return node_data


def _get_parameter_values(node: Dict) -> Any:
"""Get parameter values from a stored node."""
if node["obj"] is not None:
parameter_values = node["obj"].load()
else: # pragma: no cover
parameter_values = {}
return parameter_values


@app.route("/api/main")
def nodes_json():
"""Serve the data from all Kedro pipelines in the project.
Expand Down Expand Up @@ -508,7 +517,8 @@ def nodes_metadata(node_id):
dataset_metadata = _get_dataset_metadata(node)
return jsonify(dataset_metadata)

parameter_values = node["obj"].load()
parameter_values = _get_parameter_values(node)

if "parameter_name" in node:
# In case of 'params:' prefix
parameters_metadata = {"parameters": {node["parameter_name"]: parameter_values}}
Expand Down

0 comments on commit a68ba25

Please sign in to comment.