Add env var to dump config graph
Make this a bit easier during debugging. Add env var and some developer instructions. Change-Id: I34978ddb47d6642dfa22cae0f4c0543c0ba5475f
This commit is contained in:
		@@ -12,6 +12,7 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
import logging
 | 
					import logging
 | 
				
			||||||
import networkx as nx
 | 
					import networkx as nx
 | 
				
			||||||
 | 
					import os
 | 
				
			||||||
 | 
					
 | 
				
			||||||
from stevedore import extension
 | 
					from stevedore import extension
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -217,10 +218,14 @@ def create_graph(config, default_config):
 | 
				
			|||||||
                    "Edge not defined: %s->%s" % (name, edge_to))
 | 
					                    "Edge not defined: %s->%s" % (name, edge_to))
 | 
				
			||||||
            dg.add_edge(name, edge_to)
 | 
					            dg.add_edge(name, edge_to)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    # this can be quite helpful debugging but needs pydotplus.
 | 
					    # this can be quite helpful debugging but needs pydotplus which
 | 
				
			||||||
    # run "dotty /tmp/out.dot"
 | 
					    # isn't in requirements.  for debugging, do
 | 
				
			||||||
    #  XXX: maybe an env var that dumps to a tmpdir or something?
 | 
					    #   .tox/py27/bin/pip install pydotplus
 | 
				
			||||||
    # nx.nx_pydot.write_dot(dg, '/tmp/graph_dump.dot')
 | 
					    #   DUMP_CONFIG_GRAPH=1 tox -e py27 -- specific_test
 | 
				
			||||||
 | 
					    #   dotty /tmp/graph_dump.dot
 | 
				
			||||||
 | 
					    # to see helpful output
 | 
				
			||||||
 | 
					    if 'DUMP_CONFIG_GRAPH' in os.environ:
 | 
				
			||||||
 | 
					        nx.nx_pydot.write_dot(dg, '/tmp/graph_dump.dot')
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    # Topological sort (i.e. create a linear array that satisfies
 | 
					    # Topological sort (i.e. create a linear array that satisfies
 | 
				
			||||||
    # dependencies) and return the object list
 | 
					    # dependencies) and return the object list
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										2
									
								
								tox.ini
									
									
									
									
									
								
							
							
						
						
									
										2
									
								
								tox.ini
									
									
									
									
									
								
							@@ -10,6 +10,8 @@ deps= -r{toxinidir}/requirements.txt
 | 
				
			|||||||
      -r{toxinidir}/test-requirements.txt
 | 
					      -r{toxinidir}/test-requirements.txt
 | 
				
			||||||
commands=
 | 
					commands=
 | 
				
			||||||
    python setup.py test --slowest --testr-args='{posargs}'
 | 
					    python setup.py test --slowest --testr-args='{posargs}'
 | 
				
			||||||
 | 
					passenv=
 | 
				
			||||||
 | 
					    DUMP_CONFIG_GRAPH
 | 
				
			||||||
 | 
					
 | 
				
			||||||
[testenv:pep8]
 | 
					[testenv:pep8]
 | 
				
			||||||
commands =
 | 
					commands =
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user