PyWorkflowApp / visual-programming

A Python Visual Programming Workspace for Data Science
MIT License
31 stars 12 forks source link

Allow option overrides with global flow variables #78

Closed reddigari closed 4 years ago

reddigari commented 4 years ago

Any non-file parameters in the node configuration form have a checkbox indicating whether to override with a flow variable (if any exist). Checking the box disables the normal parameter input, and displays a dropdown to select the flow node to use as the override.

Currently no verification that the selected flow var has the same type as the option being overridden, but I think I'll handle that as I do local flow nodes tomorrow.

I've tested by overriding the sep option of ReadCsvNode to read a CSV where I swapped the commas for semicolons, and it works fine. There is a problem that @reelmatt is looking into where if you try to use a flow variable to override the WriteCsvNode output file, the server doesn't know how to construct the correct path.

Screen Shot 2020-04-29 at 9 37 14 PM
reddigari commented 4 years ago

@reelmatt Great catch, both resolved by the last two commits.

reddigari commented 4 years ago

@reelmatt your commit got it to execute properly, but the downloaded file was named download.csv rather than the value in the global flow variable. Any ideas?

reelmatt commented 4 years ago

We had something like this earlier, adding the filename in the response like: response['Content-Disposition'] = f"attachment; filename={f.name}" I wasn't sure the best way to parse that on the front-end, so I just passed the filename in the header and used that directly.

That should work now, but feel free to tweak that as you see fit. In general, I think that's a lot cleaner/simpler than trying to re-derive the filename from the node.config info on the front-end.