-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
move show_dag method to sepate plugin
- Loading branch information
1 parent
e57df2e
commit ca2f62d
Showing
2 changed files
with
32 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
# Copyright 2017 The Lambda-blocks developers. See AUTHORS for details. | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
""" | ||
This plugin allows for a very basic representation of the graph, | ||
showing for each vertice its inner and outer links. | ||
""" | ||
|
||
from lb.plugins_manager import before_graph_execution | ||
|
||
@before_graph_execution | ||
def show_dag(vertices, entry_points): | ||
for v in vertices.values(): | ||
print(v.fields['name']) | ||
print(' from:') | ||
for prev in v.prev_vertices: | ||
print(' {} -> {}'.format(prev.block_from.fields['name'], prev.value_from)) | ||
print(' to:') | ||
for to in v.next_vertices: | ||
print(' {} -> {}'.format(to.block_dest.fields['name'], to.value_dest)) | ||
print('____________________') |