Skip to content

Commit

Permalink
Merge branch 'develop' into encoded-workflow-processing-exp
Browse files Browse the repository at this point in the history
  • Loading branch information
cjao committed Jul 15, 2022
2 parents 21a8c54 + 736fb6f commit 8dddb4d
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 54 deletions.
11 changes: 11 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,17 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

- Covalent server can now process workflows without having their deps installed

## [0.133.0] - 2022-07-15

### Authors

- Will Cunningham <wjcunningham7@users.noreply.github.com>


### Removed

- Removed the deprecated function `draw_inline` as well as the `matplotlib` dependency.

### Operations

- Fixing the retry block for tests
Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.132.0
0.133.0
51 changes: 0 additions & 51 deletions covalent/_workflow/lattice.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@
from pathlib import Path
from typing import TYPE_CHECKING, Any, Callable, List, Optional, Union

import matplotlib.pyplot as plt
import networkx as nx

import covalent_ui.result_webhook as result_webhook
Expand Down Expand Up @@ -245,56 +244,6 @@ def build_graph(self, *args, **kwargs) -> None:
)
raise

def draw_inline(self, ax: plt.Axes = None, *args, **kwargs) -> None:
"""
Rebuilds the graph according to the kwargs passed and draws it on the given axis.
If no axis is given then a new figure is created.
Note: This function does `plt.show()` at the end.
Args:
ax: Axis on which the graph is to be drawn.
*args: Positional arguments to be passed to build the graph.
**kwargs: Keyword arguments to be passed to build the graph.
Returns:
None
"""

self.build_graph(**kwargs)

main_graph = self.transport_graph.get_internal_graph_copy()

node_labels = nx.get_node_attributes(main_graph, "name")

if ax is None:
_, ax = plt.subplots()
main_graph.graph["graph"] = {"rankdir": "TD"}
main_graph.graph["node"] = {"shape": "circle"}
main_graph.graph["edges"] = {"arrowsize": "4.0"}

prog = "dot"
args = "-Gnodesep=1 -Granksep=2 -Gpad=0.1 -Grankdir=TD"
root = None
pos = nx.drawing.nx_agraph.graphviz_layout(main_graph, prog=prog, root=root, args=args)

# Print the node number in the label as `[node number]`
for key, value in node_labels.items():
node_labels[key] = "[" + str(key) + "]\n" + value
edge_labels = nx.get_edge_attributes(main_graph, "edge_name")
nx.draw(
main_graph,
pos=pos,
labels=node_labels,
node_color="w",
node_size=700,
node_shape="s",
)
nx.draw_networkx_edge_labels(main_graph, pos, edge_labels)
plt.margins(x=0.4)
plt.tight_layout()
return ax

def persist(self, ds: DataStoreSession, update: bool):
self.transport_graph.persist(ds, update)

Expand Down
1 change: 0 additions & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ flask==2.0.1
flask-cors==3.0.10
flask-socketio==5.1.1
furl==2.1.3
matplotlib==3.5.1
networkx==2.5
psutil==5.9.0
PyYAML==6.0
Expand Down
1 change: 0 additions & 1 deletion tests/workflow_stack_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -448,7 +448,6 @@ def test_decorated_function():
"""

import pennylane as qml
from matplotlib import pyplot as plt

import covalent as ct

Expand Down

0 comments on commit 8dddb4d

Please sign in to comment.