Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Fix an error raised when some node data are empty. #20

Merged
merged 1 commit into from

2 participants

@dahlia

Sometimes node data could be empty (for example, the application uses gevent.spawn() heavily, but I’m not sure why). In that case, several points of linesman raise KeyError.

It fixes node data to have 'totaltime' key before graph data are used.

@dahlia dahlia Fix an error raised when some node data are empty.
Sometimes node data could be empty (for example, the application
uses gevent.spawn() heavily, but not sure why). In that case, several
points of linesman raise KeyError.

It fixes node data to have 'totaltime' key before graph data are used.
7574c90
@amcfague amcfague merged commit a01c32c into from
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Jan 14, 2012
  1. @dahlia

    Fix an error raised when some node data are empty.

    dahlia authored
    Sometimes node data could be empty (for example, the application
    uses gevent.spawn() heavily, but not sure why). In that case, several
    points of linesman raise KeyError.
    
    It fixes node data to have 'totaltime' key before graph data are used.
This page is out of date. Refresh to see the latest.
Showing with 5 additions and 0 deletions.
  1. +5 −0 linesman/middleware.py
View
5 linesman/middleware.py
@@ -413,6 +413,11 @@ def prepare_graph(source_graph, cutoff_time, break_cycles=False):
# Always use a copy for destructive changes
graph = source_graph.copy()
+ # Some node data could be empty dict
+ for node, data in graph.nodes(data=True):
+ if not data:
+ data['totaltime'] = 0
+
max_totaltime = max(data['totaltime']
for node, data in graph.nodes(data=True))
for node, data in graph.nodes(data=True):
Something went wrong with that request. Please try again.