AustralianSynchrotron / lightflow

A lightweight, distributed workflow system
https://australiansynchrotron.github.io/lightflow/
BSD 3-Clause "New" or "Revised" License
101 stars 18 forks source link

updated for networkx 2.1 #16

Closed jrmlhermitte closed 6 years ago

jrmlhermitte commented 6 years ago

We need support for networkx 2.1 or greater. I ran the workflow with networkx 2.1 and found I only needed these changes.

Changes: graph.successors() and graph.predecessors() are now iterators not lists. Where needed, I convert them back to lists. Note I only converted some, where len was called on. For the items that were iterated on, I left as is.

How I tested

This works for me, and I tested on the branching.py, sub_dag.py and decision.py and simple.py workflows.

We might want to consider adding a test. One simple test suffices, roughly, assert this doesn't raise:

import networkx as nx
graph = nx.DiGraph()
graph.add_node('foo')
graph.add_node('foo2')

len(list(graph.predecessors('foo')))
len(list(graph.successors('foo')))

However, we might want to simulate an actual workflow in a test. Might be worth giving this a shot?