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
1=== modified file 'scripts/initctl2dot.py'
2--- scripts/initctl2dot.py 2013-06-28 20:17:15 +0000
3+++ scripts/initctl2dot.py 2013-07-02 20:11:27 +0000
4@@ -263,9 +263,13 @@
5 ofh.write(" %s -> %s [color=\"%s\"];\n" % (from_node, to_node, color))
6
7
8-def show_start_on_job_edge(ofh, from_job, to_job):
9- show_edge(ofh, "%s:job" % mk_job_node_name(to_job),
10- "%s:start" % mk_job_node_name(from_job), options.color_start_on)
11+def show_start_on_job_edge(ofh, from_job, to_job, relation):
12+ if relation == 'starting':
13+ show_edge(ofh, "%s:start" % mk_job_node_name(from_job),
14+ "%s:job" % mk_job_node_name(to_job),options.color_start_on)
15+ else:
16+ show_edge(ofh, "%s:job" % mk_job_node_name(to_job),
17+ "%s:start" % mk_job_node_name(from_job), options.color_start_on)
18
19
20 def show_start_on_event_edge(ofh, from_job, to_event):
21@@ -298,7 +302,7 @@
22
23 for job in jobs_list:
24 for s in jobs[job]['start on']['job']:
25- show_start_on_job_edge(ofh, job, s)
26+ show_start_on_job_edge(ofh, job, s, jobs[job]['start on']['job'][s])
27
28 for s in jobs[job]['start on']['event']:
29 show_start_on_event_edge(ofh, job, s)
30@@ -384,7 +388,7 @@
31 _event = encode_dollar(job, result.group(1))
32 _job = result.group(2)
33 if _job:
34- jobs[job]['start on']['job'][_job] = 1
35+ jobs[job]['start on']['job'][_job] = _event
36 else:
37 jobs[job]['start on']['event'][_event] = 1
38 events[_event] = 1

Subscribers

People subscribed via source and target branches