Skip to content

Commit

Permalink
fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
jan-janssen committed Jun 15, 2024
1 parent 672bc94 commit b57ca6d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 14 deletions.
12 changes: 1 addition & 11 deletions pympipool/interactive/dependencies.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,7 @@
from pympipool.interactive import create_executor
from pympipool.shared.executor import ExecutorSteps, execute_tasks_with_dependencies
from pympipool.shared.thread import RaisingThread


try:
from pympipool.shared.plot import generate_task_hash, generate_nodes_and_edges, draw

graph_extension_available = True
import_error = None
except ImportError:
graph_extension_available = False
from pympipool.shared.plot import generate_task_hash, generate_nodes_and_edges, draw


class ExecutorWithDependencies(ExecutorSteps):
Expand All @@ -38,8 +30,6 @@ def __init__(
)
self._future_hash_dict = {}
self._task_hash_dict = {}
if plot_dependency_graph and not graph_extension_available:
raise ImportError(import_error)
self._generate_dependency_graph = plot_dependency_graph

def submit(self, fn: callable, *args, resource_dict: dict = {}, **kwargs):
Expand Down
6 changes: 3 additions & 3 deletions pympipool/shared/plot.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
from concurrent.futures import Future

import cloudpickle
from IPython.display import SVG, display
import matplotlib.pyplot as plt
import networkx as nx


def generate_nodes_and_edges(task_hash_dict, future_hash_inverse_dict):
Expand Down Expand Up @@ -59,6 +56,9 @@ def generate_task_hash(task_dict, future_hash_inverse_dict):


def draw(node_lst, edge_lst):
from IPython.display import SVG, display # noqa
import matplotlib.pyplot as plt # noqa
import networkx as nx # noqa
graph = nx.DiGraph()
for node in node_lst:
graph.add_node(node["id"], label=node["name"])
Expand Down

0 comments on commit b57ca6d

Please sign in to comment.