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

Clarify --save-file #1681

Closed
1 task done
astrojuanlu opened this issue Dec 13, 2023 · 11 comments · Fixed by #2173
Closed
1 task done

Clarify --save-file #1681

astrojuanlu opened this issue Dec 13, 2023 · 11 comments · Fixed by #2173

Comments

@astrojuanlu
Copy link
Member

astrojuanlu commented Dec 13, 2023

Description

I was just trying the --save-file option and discovered that it produces a directory, rather than a file:

$ kedro viz --save-file viz.json --env demo
...
Kedro Viz Backend Server started successfully...

^C
$ tree viz.json
viz.json
└── api
    ├── main
    ├── nodes
    │   ├── 00bf9601
    │   ├── 080067ed

Expected Result

A file was saved, as explained in the docs https://docs.kedro.org/projects/kedro-viz/en/latest/kedro-viz_visualisation.html#share-a-pipeline-visualisation

Actual Result

A directory was created.

Your Environment

I used Kedro Viz 6.7.0.

Checklist

  • Include labels so that we can categorise your issue
@astrojuanlu
Copy link
Member Author

By the way, I tried --load-file viz.json immediately after that and I got an ugly

                             FileNotFoundError: [Errno 2] No such file or directory:                                                    
                             '/Users/juan_cano/Projects/QuantumBlack Labs/talk-kedro-huggingface/output.json/main'

turns out I had to do --load-file viz.json/api instead.

@ravi-kumar-pilla
Copy link
Contributor

ravi-kumar-pilla commented Dec 15, 2023

Hi @astrojuanlu , Thank you for raising this. We have addressed a part of the issue here. But we plan to do a refactor on kedro viz run --save-file and --load-file options in coming sprints. Thank you

@rashidakanchwala
Copy link
Contributor

This is done.

@github-project-automation github-project-automation bot moved this from Inbox to Done in Kedro-Viz Jan 15, 2024
@astrojuanlu
Copy link
Member Author

I just tested --save-file with Kedro-Viz 7.0.0 and I still get the same: a directory is created instead of a file.

What has changed @rashidakanchwala ? Am I doing something wrong?

@rashidakanchwala
Copy link
Contributor

rashidakanchwala commented Jan 16, 2024

hi Juanlu, that's correct. Earlier --save-file and --load-file only saved the main pipeline json which is the default pipeline flowchart. If you went to click on any nodes or switch pipeline from dropdown view nothing would work because that information is under nodes and pipeline folder.
We recently fixed this so now when you do --save-file a directory is created which has main.json (for default pipeline) a pipeline folder with other pipeline.json and nodes folder which has metadata of all nodes.

@rashidakanchwala
Copy link
Contributor

Having said that, we need to update this in the docs

This command will save a visualisation of the __default__ pipeline as a JSON file called my_shareable_pipeline.json. It doesn’t share data, such as that in the code panel, nor can you share images or charts.

i had missed this. Thanks for flagging

@astrojuanlu
Copy link
Member Author

I think we didn't quite address this in a satisfactory way. I'm reopening.

@astrojuanlu
Copy link
Member Author

$ find exportation2/ -name "*.json"
$

there are no JSON files in the result of --save-file

@astrojuanlu astrojuanlu moved this from Done to Todo in Kedro-Viz Apr 11, 2024
@astrojuanlu
Copy link
Member Author

TIL: The JSON file is there, it's just that it doesn't have a .json extension:

❯ head exportation/api/main 
{
  "nodes": [
    {
      "id": "d75ec4b0",
      "name": "create_confusion_matrix",
      "tags": [],
      "pipelines": [
        "reporting",
        "__default__"
      ],
...

This is less than ideal. It's might look like a petty thing but is there a chance to rename the file?

@rashidakanchwala
Copy link
Contributor

rashidakanchwala commented Apr 11, 2024

I guess we could -- But I think in general users usually don't interact directly with the files.
They load it directly using --load-file, and in the javascript code, it reads it this way ... because even the json content of this file won't make sense to them.

@astrojuanlu
Copy link
Member Author

Could be addressed with #1705 ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

3 participants