/[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

Annotation of /trunk/bin/lorry.pl

Parent Directory Parent Directory | Revision Log Revision Log


Revision 92 - (hide annotations)
Sat Oct 3 21:09:51 2009 UTC (14 years, 8 months ago) by dpavlin
File MIME type: text/plain
File size: 981 byte(s)
begin refactor to lorry which will carry sacks for us
(creating nodes and communicating with them using Storable
traveling over sockets)

1 dpavlin 92 #!/usr/bin/perl
2    
3     use warnings;
4     use strict;
5    
6     use Data::Dump qw(dump);
7    
8     use lib 'lib';
9     use Sack::From;
10     use Sack::Lorry;
11    
12     my $offset = 0;
13     my $limit = 5;
14     my @cloud = ( 'localhost', 'localhost' );
15    
16    
17     my $lorry = Sack::Lorry->new;
18    
19     my $info;
20    
21     foreach my $host ( @cloud ) {
22     if ( my $port = $lorry->start_node( $host ) ) {
23    
24     warn "started [$port] on $host\n";
25    
26     my $data = Sack::From->shard( path => '/data/isi/full.txt', offset => $offset, limit => $limit );
27    
28     $lorry->send_to( $port, { data => $data } ) || die "can't send to $port: $!";
29     $info->{$port} = {
30     host => $host,
31     offset => $offset,
32     limit => $limit,
33     };
34    
35     $offset += $limit;
36    
37     } else {
38     warn "[$port] skipped";
39     }
40     }
41    
42     warn "info ",dump $info;
43    
44     foreach my $port ( keys %$info ) {
45     my $r = $lorry->get_from( $port );
46     if ( $r->{data} eq 'loaded' ) {
47     warn "OK [$port] loaded\n";
48     } else {
49     warn "ERROR [$port] ", dump $r;
50     }
51     }
52    
53     warn "exit all nodes\n";
54     $lorry->send_to( $_, { exit => 1 } ) foreach keys %$info;

Properties

Name Value
svn:executable *

  ViewVC Help
Powered by ViewVC 1.1.26