/[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 145 by dpavlin, Wed Oct 7 18:30:22 2009 UTC revision 146 by dpavlin, Wed Oct 7 23:11:03 2009 UTC
# Line 17  use Time::HiRes qw(time); Line 17  use Time::HiRes qw(time);
17    
18    
19  my $view   = 'views/00.demo.pl';  my $view   = 'views/00.demo.pl';
20  my $offset = 0;  my $limit;
21  my $limit  = 5000;  my $cloud;
 my $cloud_file;  
22    
23    
24  GetOptions(  GetOptions(
25          'view=s'  => \$view,          'view=s'  => \$view,
26          'limit=i' => \$limit,          'limit=i' => \$limit,
27          'cloud=s' => \$cloud_file,          'cloud=s' => \$cloud,
28  ) or die $!;  ) or die $!;
29    
30    
31  my $lorry = Sack::Lorry->new( view => $view );  my $lorry = Sack::Lorry->new( view => $view, cloud => $cloud );
32    
 my @cloud = -e $cloud_file ? read_file $cloud_file : ( 'localhost' );  
 @cloud = map { chomp $_; $_; } @cloud;  
 my $cloud_size = scalar @cloud;  
   
 warn "cloud with $cloud_size nodes: ",join(' ', @cloud),$/;  
33  my $from  = Sack::From->new(  my $from  = Sack::From->new(
34          path => '/data/isi/full.txt',          path => '/data/isi/full.txt',
35          limit => $limit * $cloud_size,          limit => $limit * $lorry->cloud_size,
36  );  );
37    
38  duration 'load finished';  duration 'pre-load finished';
   
 my $info;  
   
 my $port = 4000;  
   
 foreach my $host ( @cloud ) {  
   
         if ( $lorry->start_node_port( $host, $port ) ) {  
39    
40                  warn "started [$port] on $host\n";  $lorry->start_nodes;
   
                 my $data = $from->shard( $limit );  
                 $lorry->send_to( $port, { data => $data } ) || die "can't send to $port: $!";  
   
                 $info->{$port} = {  
                         host => $host,  
                         offset => $offset,  
                         limit => $limit,  
                 };  
   
                 $port++;  
                 $offset += $limit;  
   
         }  
 }  
41    
42  duration 'cloud up';  duration 'cloud up';
43    
44  warn "info ",dump $info;  $lorry->load_nodes( $from );
45    
46    duration 'load finished';
47    
 warn "load status ", dump( $lorry->get_from_all ),$/;  
48    
49  our $out;  our $out;
50  our $cmd;  our $cmd;

Legend:
Removed from v.145  
changed lines
  Added in v.146

  ViewVC Help
Powered by ViewVC 1.1.26