AC-MrGamoo
view release on metacpan or search on metacpan
eg/example.mrjob view on Meta::CPAN
# Created: 2009-Oct-28 11:19 (EDT)
# Function: test
#
# $Id: example.mrjob,v 1.1 2010/11/01 19:04:21 jaw Exp $
<%doc>
map reduce example
</%doc>
%################################################################
%# provide values for configurable parameters
%# these override the defaults
%# and params specified on the command line, override these
<%config>
system => blargh
tasktimeout => 120
</%config>
%################################################################
%# common block is prepended to all other blocks.
%# used to load modules
<%common>
use AC::Misc;
lib/AC/MrGamoo/Customize.pm view on Meta::CPAN
#
# $Id: Customize.pm,v 1.1 2010/11/01 18:41:40 jaw Exp $
package AC::MrGamoo::Customize;
use strict;
sub customize {
my $class = shift;
my $implby = shift;
(my $default = $class) =~ s/(.*)::([^:]+)$/$1::Default::$2/;
# load user's implemantation + default
for my $p ($implby, $default){
eval "require $p" if $p;
die $@ if $@;
}
# import/export
no strict;
no warnings;
for my $f ( @{$class . '::CUSTOM'} ){
*{$class . '::' . $f} = ($implby && $implby->can($f)) || $default->can($f);
}
}
1;
lib/AC/MrGamoo/Default/MySelf.pm view on Meta::CPAN
# -*- perl -*-
# Copyright (c) 2010 AdCopy
# Author: Jeff Weisberg
# Created: 2010-Jan-18 18:10 (EST)
# Function: info about myself - default implementation
#
# $Id: MySelf.pm,v 1.1 2010/11/01 18:41:54 jaw Exp $
package AC::MrGamoo::Default::MySelf;
use AC::MrGamoo::Config;
use AC::MrGamoo::Debug;
use Sys::Hostname;
use Socket;
use strict;
lib/AC/MrGamoo/Default/MySelf.pm view on Meta::CPAN
sub my_server_id {
return $SERVERID;
}
sub my_network_info {
return [ { ipa => $MYIP } ];
}
sub my_datacenter {
return 'default';
}
1;
lib/AC/MrGamoo/MySelf.pm view on Meta::CPAN
emacs /myperldir/Local/MrGamoo/MySelf.pm
copy. paste. edit.
use lib '/myperldir';
my $m = AC::MrGamoo::D->new(
class_myself => 'Local::MrGamoo::MySelf',
);
=head1 DESCRIPTION
provide functions to override default behavior. you may define
any or all of the following functions.
=head2 my_server_id
return a unique identity for this mrgamoo instance. typically,
something similar to the server hostname.
sub my_server_id {
return 'mrm@' . hostname();
}
lib/AC/MrGamoo/ReadInput.pm view on Meta::CPAN
my $m = AC::MrGamoo::D->new(
class_readinput => 'Local::MrGamoo::ReadInput',
);
=head1 DESCRIPTION
In your map/reduce job, your C<map> function is called once per record.
The C<readinput> function is responsible for reading the actual files
and returning records.
The default C<readinput> returns one line at a time (just like <FILE>).
If you want different behavior, you can provide a C<ReadInput> class,
or spoecify a C<readinput> block in your map/reduce job.
Your function should return an array of 2 values
=head2 record
the record data
( run in 0.696 second using v1.01-cache-2.11-cpan-0a6323c29d9 )