background function calls are not dotted
authorDobrica Pavlinusic <dpavlin@rot13.org>
Sun, 27 Mar 2011 18:27:45 +0000 (18:27 +0000)
committerDobrica Pavlinusic <dpavlin@rot13.org>
Sun, 27 Mar 2011 18:27:45 +0000 (18:27 +0000)
scripts/gearman2dot.pl

index b30ecde..4e889bf 100755 (executable)
@@ -30,7 +30,7 @@ sub print_job {
                my $wait = $t[$#t] eq 'wait' && pop @t;
                foreach my $f ( @t ) {
                        dot qq|"$name" -> "$f";|;
-                       dot qq|"$f" -> "${name}_wait";| if $wait;
+                       dot qq|"$f" -> "${name}";| if $wait;
                }
                dot "} //subgraph";
        }
@@ -53,8 +53,11 @@ find(sub {
                                push @{ $job->{task}->{$1} }, 'wait';
                        }
                } elsif ( m/\$self->(do\w*)\(\s*'(\w+)'/ ) {
-                       push @{ $job->{$1} }, $2;
-                       dot qq|"$job->{name}" -> "$2" [ label="$1" ];|;
+                       my ( $do, $what ) = ( $1, $2 );
+                       push @{ $job->{$do} }, $what;
+                       my $style = '';
+                       $style = ' style=dotted ' if $do =~ s/_background.*//;
+                       dot qq|"$job->{name}" -> "$what" [ $style ];|;
                }
        }
        print_job $name => $job;