diff --git a/.gitignore b/.gitignore index a044288f..ac8bcc25 100644 --- a/.gitignore +++ b/.gitignore @@ -55,9 +55,13 @@ target/ # Virtual Environments .venv +venv/ # Temporary Files *.swp # Visual Studio Code .vscode/ + +# Pycharm +.idea/ diff --git a/orquesta/graphing.py b/orquesta/graphing.py index e25b779b..6c718cb1 100644 --- a/orquesta/graphing.py +++ b/orquesta/graphing.py @@ -53,8 +53,8 @@ def deserialize(cls, data): @staticmethod def get_root_nodes(graph): nodes = [ - {"id": n, "name": graph.node[n].get("name", n)} - for n, d in graph.in_degree().items() + {"id": n, "name": graph.nodes[n].get("name", n)} + for n, d in dict(graph.in_degree()).items() if d == 0 ] @@ -80,7 +80,7 @@ def get_task(self, task_id): raise exc.InvalidTask(task_id) task = {"id": task_id} - task.update(json_util.deepcopy(self._graph.node[task_id])) + task.update(json_util.deepcopy(self._graph.nodes[task_id])) return task @@ -102,7 +102,7 @@ def update_task(self, task_id, **kwargs): raise exc.InvalidTask(task_id) for key, value in six.iteritems(kwargs): - self._graph.node[task_id][key] = value + self._graph.nodes[task_id][key] = value def has_transition(self, source, destination, **kwargs): edges = filter( diff --git a/orquesta/tests/unit/conducting/test_workflow_conductor.py b/orquesta/tests/unit/conducting/test_workflow_conductor.py index d8018c17..cbbe5ddd 100644 --- a/orquesta/tests/unit/conducting/test_workflow_conductor.py +++ b/orquesta/tests/unit/conducting/test_workflow_conductor.py @@ -141,7 +141,7 @@ def test_init(self): self.assertEqual(conductor.workflow_state.status, statuses.UNSET) self.assertEqual(conductor.get_workflow_status(), statuses.UNSET) self.assertIsInstance(conductor.graph, graphing.WorkflowGraph) - self.assertEqual(len(conductor.graph._graph.node), 5) + self.assertEqual(len(conductor.graph._graph.nodes), 5) self.assertIsInstance(conductor.workflow_state, conducting.WorkflowState) def test_init_with_inputs(self): @@ -180,7 +180,7 @@ def test_init_with_inputs(self): self.assertEqual(conductor.workflow_state.status, statuses.UNSET) self.assertEqual(conductor.get_workflow_status(), statuses.UNSET) self.assertIsInstance(conductor.graph, graphing.WorkflowGraph) - self.assertEqual(len(conductor.graph._graph.node), 5) + self.assertEqual(len(conductor.graph._graph.nodes), 5) self.assertIsInstance(conductor.workflow_state, conducting.WorkflowState) def test_init_with_partial_inputs(self): @@ -221,7 +221,7 @@ def test_init_with_partial_inputs(self): self.assertEqual(conductor.workflow_state.status, statuses.UNSET) self.assertEqual(conductor.get_workflow_status(), statuses.UNSET) self.assertIsInstance(conductor.graph, graphing.WorkflowGraph) - self.assertEqual(len(conductor.graph._graph.node), 5) + self.assertEqual(len(conductor.graph._graph.nodes), 5) self.assertIsInstance(conductor.workflow_state, conducting.WorkflowState) def test_init_with_context(self): @@ -263,7 +263,7 @@ def test_init_with_context(self): self.assertEqual(conductor.workflow_state.status, statuses.UNSET) self.assertEqual(conductor.get_workflow_status(), statuses.UNSET) self.assertIsInstance(conductor.graph, graphing.WorkflowGraph) - self.assertEqual(len(conductor.graph._graph.node), 5) + self.assertEqual(len(conductor.graph._graph.nodes), 5) self.assertIsInstance(conductor.workflow_state, conducting.WorkflowState) def test_serialization(self): @@ -296,7 +296,7 @@ def test_serialization(self): self.assertIsInstance(conductor.spec, native_specs.WorkflowSpec) self.assertIsInstance(conductor.graph, graphing.WorkflowGraph) - self.assertEqual(len(conductor.graph._graph.node), 5) + self.assertEqual(len(conductor.graph._graph.nodes), 5) self.assertEqual(conductor.get_workflow_status(), statuses.SUCCEEDED) self.assertIsInstance(conductor.workflow_state, conducting.WorkflowState) self.assertEqual(len(conductor.workflow_state.tasks), 5) @@ -850,7 +850,7 @@ def test_append_log_entries(self): self.assertIsInstance(conductor.spec, native_specs.WorkflowSpec) self.assertEqual(conductor.get_workflow_status(), statuses.RUNNING) self.assertIsInstance(conductor.graph, graphing.WorkflowGraph) - self.assertEqual(len(conductor.graph._graph.node), 5) + self.assertEqual(len(conductor.graph._graph.nodes), 5) self.assertIsInstance(conductor.workflow_state, conducting.WorkflowState) self.assertListEqual(conductor.log, expected_log_entries) self.assertListEqual(conductor.errors, expected_errors) diff --git a/requirements.txt b/requirements.txt index ec08cb7c..2b2de353 100644 --- a/requirements.txt +++ b/requirements.txt @@ -2,7 +2,7 @@ chardet>=3.0.2,<4.0.0 eventlet Jinja2>=2.8 # BSD License (3 clause) jsonschema!=2.5.0,<3.0.0,>=2.0.0 # MIT -networkx>=1.10,<2.0 +networkx>=2.5.1,<3.0 python-dateutil PyYAML>=3.1.0 # MIT six>=1.9.0