Skip to content
This repository has been archived by the owner on Jul 3, 2023. It is now read-only.

Stefan/refactor visualization #58

Merged
merged 8 commits into from
Feb 6, 2022
Merged

Conversation

skrawcz
Copy link
Collaborator

@skrawcz skrawcz commented Feb 6, 2022

Visualization was an afterthought we added quickly.
This change takes in feedback from #45 and makes
it more amenable for actual use.

We therefore expose new functions, and deprecate
the visualize parameter in driver.execute().

The new functions enable the user to pass in a dictionary that will
be used as key word arguments (kwargs) to the
render function -- thereby giving lots of control on
how things are visualized. We also mirror the changes
in display_all_functions().

Along the way I also refactored the cycle detection
using networkx. This again, was a quick hack,
now it's a standalone implementation. We do break graph
behavior, but not driver behavior with this refactor. I
believe that's fine, since we don't want people to
depend on FunctionGraph directly just yet.

Adds unit tests for these changes.

Additions

  • specific helper functions to create graphviz and networkx graphs.
  • new functions to display and enable passing

Removals

  • N/A

Changes

  • Deprecates driver.execute display parameter
  • changes display_all_functions in a backwards compatible manner.

Testing

  1. Locally
  2. via unit tests

Checklist

  • PR has an informative and human-readable title
  • Changes are limited to a single goal (no scope creep)
  • Code can be automatically merged (no conflicts)
  • Code follows the standards laid out in the TODO link to standards
  • Passes all existing automated tests
  • Any change in functionality is tested
  • New functions are documented (with a description, list of inputs, and expected output)
  • Placeholder code is flagged / future todos are captured in comments
  • Project documentation has been updated (including the "Unreleased" section of the CHANGELOG)
  • Reviewers requested with the Reviewers tool ➡️

Testing checklist

Python

Loosely tested across different python versions.

  • python 3.6
  • python 3.7
  • python 3.8
  • python 3.9

hamilton/driver.py Show resolved Hide resolved
hamilton/driver.py Outdated Show resolved Hide resolved
hamilton/driver.py Show resolved Hide resolved
hamilton/driver.py Outdated Show resolved Hide resolved
hamilton/driver.py Show resolved Hide resolved
hamilton/driver.py Show resolved Hide resolved
@elijahbenizzy elijahbenizzy mentioned this pull request Feb 6, 2022
11 tasks
Base automatically changed from distributed_prototype to main February 6, 2022 20:54
@skrawcz skrawcz force-pushed the stefan/refactor_visualization branch from 380c8a5 to b87c8bc Compare February 6, 2022 22:03
Stefan Krawczyk and others added 4 commits February 6, 2022 14:19
Visualization was an afterthought we added quickly.
This change takes in feedback from #45 and makes
it more amenable for actual use.

We therefore expose new functions, and deprecate
the `visualize` parameter  in `driver.execute()`.

The new functions enable the user to pass in a dictionary that will
be used as key word arguments (kwargs) to the
render function -- thereby giving lots of control on
how things are visualized.

Along the way I also refactored the cycle detection
using networkx. This again, was a quick hack,
now it's a standalone implementation. We do break graph
 behavior, but not driver behavior with this refactor. I
believe that's fine, since we don't want people to
depend on FunctionGraph directly just yet.

Adds unit tests for these changes.
This is to keep it consistent with the visualize_execution() function.
This change is backwards compatible, so no changes on the user
required.
Since we deprecated display=True in execute, this change
shows how one would visualize the DAG with the proper
function calls on the driver that now exist.
So that way we don't waste time trying to install it on python 3.7+
as it's in the standard library then.
@skrawcz skrawcz force-pushed the stefan/refactor_visualization branch from b87c8bc to 0046cae Compare February 6, 2022 22:20
Graphviz needed to be installed for things to work. Ugh. Bloat, but oh well.
hamilton/graph.py Outdated Show resolved Hide resolved
Due to:

1. we don't support any URI.
2. it is now consistent with language in graph.py.
It's a list of list of strings. where the strings are node names that
form a cycle.
Neither graph libraries output a stable format for some reason.
So explaining that in the comment.
@skrawcz skrawcz merged commit 4bb7464 into main Feb 6, 2022
@skrawcz skrawcz deleted the stefan/refactor_visualization branch February 6, 2022 22:43
@skrawcz skrawcz linked an issue Feb 7, 2022 that may be closed by this pull request
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Specify path to save .gv files
2 participants