Merge lp:~ted/upstart/starting-reversal into lp:upstart

Proposed by Ted Gould
Status: Merged
Merged at revision: 1500
Proposed branch: lp:~ted/upstart/starting-reversal
Merge into: lp:upstart
Diff against target: 38 lines (+9/-5)
1 file modified
scripts/initctl2dot.py (+9/-5)
To merge this branch: bzr merge lp:~ted/upstart/starting-reversal
Reviewer Review Type Date Requested Status
James Hunt Approve
Review via email: mp+172660@code.launchpad.net

Commit message

Special case the 'starting' job command in dot visualization

Description of the change

Basically this handles 'starting' as a special case because it kinda works deferently as it inserts itself before the job being mentioned. Here, by reversing the edge, we can show that in the graphviz diagram and thus graphviz can put those jobs earlier in the diagram.

To post a comment you must log in.
Revision history for this message
James Hunt (jamesodhunt) wrote :

LGTM.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'scripts/initctl2dot.py'
--- scripts/initctl2dot.py 2013-06-28 20:17:15 +0000
+++ scripts/initctl2dot.py 2013-07-02 20:11:27 +0000
@@ -263,9 +263,13 @@
263 ofh.write(" %s -> %s [color=\"%s\"];\n" % (from_node, to_node, color))263 ofh.write(" %s -> %s [color=\"%s\"];\n" % (from_node, to_node, color))
264264
265265
266def show_start_on_job_edge(ofh, from_job, to_job):266def show_start_on_job_edge(ofh, from_job, to_job, relation):
267 show_edge(ofh, "%s:job" % mk_job_node_name(to_job),267 if relation == 'starting':
268 "%s:start" % mk_job_node_name(from_job), options.color_start_on)268 show_edge(ofh, "%s:start" % mk_job_node_name(from_job),
269 "%s:job" % mk_job_node_name(to_job),options.color_start_on)
270 else:
271 show_edge(ofh, "%s:job" % mk_job_node_name(to_job),
272 "%s:start" % mk_job_node_name(from_job), options.color_start_on)
269273
270274
271def show_start_on_event_edge(ofh, from_job, to_event):275def show_start_on_event_edge(ofh, from_job, to_event):
@@ -298,7 +302,7 @@
298302
299 for job in jobs_list:303 for job in jobs_list:
300 for s in jobs[job]['start on']['job']:304 for s in jobs[job]['start on']['job']:
301 show_start_on_job_edge(ofh, job, s)305 show_start_on_job_edge(ofh, job, s, jobs[job]['start on']['job'][s])
302306
303 for s in jobs[job]['start on']['event']:307 for s in jobs[job]['start on']['event']:
304 show_start_on_event_edge(ofh, job, s)308 show_start_on_event_edge(ofh, job, s)
@@ -384,7 +388,7 @@
384 _event = encode_dollar(job, result.group(1))388 _event = encode_dollar(job, result.group(1))
385 _job = result.group(2)389 _job = result.group(2)
386 if _job:390 if _job:
387 jobs[job]['start on']['job'][_job] = 1391 jobs[job]['start on']['job'][_job] = _event
388 else:392 else:
389 jobs[job]['start on']['event'][_event] = 1393 jobs[job]['start on']['event'][_event] = 1
390 events[_event] = 1394 events[_event] = 1

Subscribers

People subscribed via source and target branches