/[Sack]/trunk/bin/lorry.pl
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Diff of /trunk/bin/lorry.pl

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 126 by dpavlin, Tue Oct 6 23:04:45 2009 UTC revision 127 by dpavlin, Wed Oct 7 16:21:33 2009 UTC
# Line 38  sub duration { Line 38  sub duration {
38  my $lorry = Sack::Lorry->new;  my $lorry = Sack::Lorry->new;
39    
40  my @cloud = -e $cloud_file ? read_file $cloud_file : ( 'localhost' );  my @cloud = -e $cloud_file ? read_file $cloud_file : ( 'localhost' );
41  warn "bring up cloud ",dump @cloud;  @cloud = map { chomp $_; $_; } @cloud;
42    warn "bring up cloud: ",join(' ', @cloud),$/;
43    
44  my $from  = Sack::From->new(  my $from  = Sack::From->new(
45          path => '/data/isi/full.txt',          path => '/data/isi/full.txt',
# Line 49  duration 'load finished'; Line 50  duration 'load finished';
50    
51  my $info;  my $info;
52    
53    my $port = 4000;
54    
55  foreach my $host ( @cloud ) {  foreach my $host ( @cloud ) {
56          chomp $host;          chomp $host;
57    
58          if ( my $port = $lorry->start_node( $host ) ) {          if ( $lorry->start_node_port( $host, $port ) ) {
59    
60                  warn "started [$port] on $host\n";                  warn "started [$port] on $host\n";
61    
# Line 65  foreach my $host ( @cloud ) { Line 68  foreach my $host ( @cloud ) {
68                          limit => $limit,                          limit => $limit,
69                  };                  };
70    
71                    $port++;
72                  $offset += $limit;                  $offset += $limit;
73    
74          }          }
# Line 98  while ( $repl ) { Line 102  while ( $repl ) {
102          } elsif ( $cmd =~ m{^i} ) {          } elsif ( $cmd =~ m{^i} ) {
103                  $lorry->send_to_all({ info => 1 });                  $lorry->send_to_all({ info => 1 });
104                  my $info = $lorry->get_from_all;                  my $info = $lorry->get_from_all;
105                  foreach my $port ( keys %$info ) {                  foreach my $port ( $lorry->connected ) {
106                          warn "[$port] $lorry->{port_on_host}->{$port} ", dump( $info->{$port} ), "\n";                          warn "[$port] $lorry->{port_on_host}->{$port} ", dump( $info->{$port} ), "\n";
107                  }                  }
108            } elsif ( $cmd =~ m{^u} ) {
109                    my $updated;
110                    foreach my $host ( @cloud ) {
111                            next if $updated->{$host}++;
112                            warn "update $host\n";
113                            system "find /srv/Sack/ | cpio --create | ssh -F etc/lib.ssh $host cpio --extract --make-directories --unconditional";
114                    }
115          } elsif ( $cmd =~ m{^sh\s+(.+)} ) {          } elsif ( $cmd =~ m{^sh\s+(.+)} ) {
116                  $lorry->send_to_all({ sh => $1 });                  $lorry->send_to_all({ sh => $1 });
117                  my $sh = $lorry->get_from_all;                  my $sh = $lorry->get_from_all;
118                  foreach my $port ( keys %$sh ) {                  foreach my $port ( $lorry->connected ) {
119                          warn "[$port] $1\n$sh->{$port}->{sh}\n";                          warn "[$port]# $1\n$sh->{$port}->{sh}";
120                  }                  }
121          } else {          } else {
122                  warn "UNKNOWN $cmd\n" if $cmd;                  warn "UNKNOWN $cmd\n" if $cmd;

Legend:
Removed from v.126  
changed lines
  Added in v.127

  ViewVC Help
Powered by ViewVC 1.1.26