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

Contents of /trunk/bin/lorry.pl

Parent Directory Parent Directory | Revision Log Revision Log


Revision 93 - (show annotations)
Sat Oct 3 21:43:34 2009 UTC (14 years, 7 months ago) by dpavlin
File MIME type: text/plain
File size: 1052 byte(s)
run simple view
1 #!/usr/bin/perl
2
3 use warnings;
4 use strict;
5
6 use Data::Dump qw(dump);
7 use File::Slurp;
8
9 use lib 'lib';
10 use Sack::From;
11 use Sack::Lorry;
12
13 my $view = 'views/00.demo.pl';
14 my $offset = 0;
15 my $limit = 5;
16 my @cloud = ( 'localhost', 'localhost' );
17
18
19 my $lorry = Sack::Lorry->new;
20
21 my $info;
22
23 foreach my $host ( @cloud ) {
24 if ( my $port = $lorry->start_node( $host ) ) {
25
26 warn "started [$port] on $host\n";
27
28 my $data = Sack::From->shard( path => '/data/isi/full.txt', offset => $offset, limit => $limit );
29
30 $lorry->send_to( $port, { data => $data } ) || die "can't send to $port: $!";
31 $info->{$port} = {
32 host => $host,
33 offset => $offset,
34 limit => $limit,
35 };
36
37 $offset += $limit;
38
39 } else {
40 warn "[$port] skipped";
41 }
42 }
43
44 warn "info ",dump $info;
45
46 warn "load status ", dump( $lorry->get_from_all );
47
48 warn "run view $view ", -s $view, " bytes\n";
49 my $view_code = read_file($view);
50 $lorry->send_to_all({ view => $view_code });
51 warn "result ", dump( $lorry->get_from_all );
52
53 warn "exit all nodes\n";
54 $lorry->send_to_all( { exit => 1 } );
55

Properties

Name Value
svn:executable *

  ViewVC Help
Powered by ViewVC 1.1.26