Skip to content

Commit

Permalink
Issue #1548: Fix improper display of 'run command' text (#1569)
Browse files Browse the repository at this point in the history
* Add conditional statement, prevent None values being added automatically

Signed-off-by: mehdinv <mehdinv@hotmail.com>

* Added new test for task_nodes w/ no namespace

Signed-off-by: mehdinv <mehdinv@hotmail.com>

* Updated Release.md file with bug fix mention

Signed-off-by: mehdinv <mehdinv@hotmail.com>

* Update RELEASE.md w/ PR number instead of Issue

Co-authored-by: Tynan DeBold <thdebold@gmail.com>

---------

Signed-off-by: mehdinv <mehdinv@hotmail.com>
Co-authored-by: Tynan DeBold <thdebold@gmail.com>
  • Loading branch information
MehdiNV and tynandebold authored Oct 12, 2023
1 parent cbdfb24 commit c43fb03
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 0 deletions.
5 changes: 5 additions & 0 deletions RELEASE.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@ Please follow the established format:
- Include the ID number for the related PR (or PRs) in parentheses
-->

# Next Release

## Bug fixes and other changes
- Fix improper display of 'run-command' inside the metadata panel. (#1569)

# Release 6.6.0

## Major features and improvements
Expand Down
2 changes: 2 additions & 0 deletions package/kedro_viz/models/flowchart.py
Original file line number Diff line number Diff line change
Expand Up @@ -411,6 +411,8 @@ def __post_init__(self, task_node: TaskNode):
if kedro_node._name is not None:
self.run_command = (
f"kedro run --to-nodes={task_node.namespace}.{kedro_node._name}"
if task_node.namespace is not None
else f"kedro run --to-nodes={kedro_node._name}"
)


Expand Down
22 changes: 22 additions & 0 deletions package/tests/test_models/test_flowchart.py
Original file line number Diff line number Diff line change
Expand Up @@ -304,6 +304,28 @@ def identity(x):
== "kedro run --to-nodes=namespace.identity_node"
)

def test_task_node_metadata_no_namespace(self):
kedro_node = node(
identity,
inputs="x",
outputs="y",
name="identity_node",
tags={"tag"},
)
task_node = GraphNode.create_task_node(kedro_node)
task_node_metadata = TaskNodeMetadata(task_node=task_node)
assert task_node_metadata.code == dedent(
"""\
def identity(x):
return x
"""
)
assert task_node_metadata.filepath == str(
Path(__file__).relative_to(Path.cwd().parent).expanduser()
)
assert task_node_metadata.parameters == {}
assert task_node_metadata.run_command == "kedro run --to-nodes=identity_node"

def test_task_node_metadata_no_run_command(self):
kedro_node = node(
identity,
Expand Down

0 comments on commit c43fb03

Please sign in to comment.