Copyright Notice

 Copyright I.N.R.A. - C.N.R.S.
 emmanuel.courcelle@toulouse.inra.fr
 jerome.gouzy@toulouse.inra.fr
 This software is a computer program whose purpose is to help you run 
 your scripts on parallel computers.
 This software is governed by the CeCILL  license under French law and
 abiding by the rules of distribution of free software.  You can  use, 
 modify and/ or redistribute the software under the terms of the CeCILL
 license as circulated by CEA, CNRS and INRIA at the following URL
 http://www.cecill.info";
 As a counterpart to the access to the source code and  rights to copy,
 modify and redistribute granted by the license, users are provided only
 with a limited warranty  and the software's author,  the holder of the
 economic rights,  and the successive licensors  have only  limited
 liability.
 In this respect, the user's attention is drawn to the risks associated
 with loading,  using,  modifying and/or developing or reproducing the
 software by the user in light of its specific status of free software,
 that may mean  that it is complicated to manipulate,  and  that  also
 therefore means  that it is reserved for developers  and  experienced
 professionals having in-depth computer knowledge. Users are therefore
 encouraged to load and test the software's suitability as regards their
 requirements in conditions enabling the security of their systems and/or 
 data to be ensured and,  more generally, to use and operate it in the 
 same conditions as regards security.
 The fact that you are presently reading this means that you have had
 knowledge of the CeCILL license and that you accept its terms.


NAME

PARALOOP::PLUGIN::Plugin - Abstract class for the Plugin objects


Derives from...

UNIVERSAL


DESCRIPTION

The objects deriving from Plugin implement 5 methods, requested by paraloop. Plugin calls dies for some of those, thus declaring abstract methods.


PUBLIC METHODS

I/O METHODS (all abstract)

 NextRecord
    $obj->NextRecord();
 SkipRecords
    $obj->SkipRecords(10)
 Tell
    my $record_number = $obj->Tell();
 Seek
    my $obj->Seek(10);
 TellLength
    my $nb_of_records = $obj->TellLength();

OTHER METHODS

 WhatParaloopPlugin
    my $msg=$obj->WhatParaloopPlugin();
    ABSTRACT
 Parameters
    my $msg=$obj->Parameters();
    ABSTRACT
    
 New
    my $obj = PARALOOP::Dummy->New(-params => $params, -log => $log);
    ABSTRACT (cf _Init)
 Exec
    my ($incr_size,$error,$killed) = $obj->Exec();
    ABSTRACT
 SetOutputFile
    $obj->SetOutputFile('filename');
    
 __JobId
    my $job_id = $obj->__JobId($o_param);
 StealWork (for load balancing)
    $obj->StealWork($o_scheduler);
    
=head1 METHODS AND SUBROUTINES - DETAILED DESCRIPTION

Function WhatParaloopPlugin

 Usage:    my $msg = PARALOOP::Dummy::WhatParaloopPlugin()
        or my $msg = $obj->WhatParaloopPlugin()
 Function: Return some information (2 lines max) on the plugin
           An object is NOT considered as a plugin if this function is not implemented
 Arg:      none ($self is ignored)
 Return:   A message describing the plugin (1 or 2 lines)

Function Parameters

 Usage:    my $msg = PARALOOP::Dummy::Parameters()
        or my $msg = $obj->Parameters()
 Function: Return the list of allowed parameters for this plugin
           If your plugin defines some parameters, it is good pratice adding this function,
           to display those parameters when the --parameters switch of paraloop.pl is used.
           However, this is not mandatory
 Arg:      none ($self is ignored)
 Return:   A message describing the plugin (1 or 2 lines)

procedure _Init

 Usage:  CALLED BY UNIVERSAL::New
         my obj = PARALOOP::Dummy->New(-params => $params, -log => $log);
 Access: private (use New instead)
 procedure: Init the object
 Return:   nothing
 Args:     -params = an object of class ParamParser (already initialized)
           -log    = an object of class Log (already initialized)
 globals:  none

Procedure SetOutputFile

 Usage:     &$opt->SetOutputFile('filename');
 Procedure: change the name of the output file
 Arg :      the output file name

Function Exec

 Usage:    my ($incr_size, $error,$killed) = &$opt->Exec($timeout);
 Function: Abstract method - What is done depends on the derived object
 Arg:      $timeout   = The number of seconds after which a timeout is sent
 Return:   $incr_size = The number of bytes added to the output file
           $error     = An error code. 
                                If != 0, paraloop WILL BE TERMINATED - Generally marks the end of file
           $killed    = A kill code
                                0: everything OK 
                       -1: killed by timeout
                        -2: killed by TERM signal (kill, qdel, ...)

function NextRecord

 Usage:    my $line = $obj->NextRecord()
 function: read and return next record (a string)
           update private member __records_counter
 Return:   a string
 Args:     none

function Tell

 Usage:    my $cnt = $obj->Tell()
 function: return records_counter private field
 Return:   The counter of records (first=0)
 Args:     none

function TellLength

 Usage:    my $cnt = $obj->TellLength()
 function: Open the file again, call next_seq() until the end the file is reached, 
           counting the number of records in the file.
 Return:   The total number of records
 Args:     none

procedure Seek

 Usage:    $obj->Seek($n)
 procedure:Position the pointer to $n (absolute, 1st record is 0)
 Args:     The record to seek to (MUST BE > 0)

procedure SkipRecords

 Usage:    $obj->SkipRecords($n)
 procedure:Position the pointer, skipping $n records
 Args:     The number of records to skip (MUST BE > 0)
 Access:   protected

function _JobId

 Usage:    my $job_id = $obj->__JobId($o_param)
 procedure:Return the job_id, as found in the ParamParser object.
           If 0, return a pseudo job_id, just good enough to create a temporary directory of file
 Args:     A ref to a ParamParsers object
 Access:   protected

Function StealWork

 Usage: my $sts = $obj->StealWork($o_scheduler)
 function:  Look inside all the jobs, trying to steal some work to another job.
            1/ Look for the jobs whose status is anything but TERMINATED or INTERRUPTED
            2/ Select the less advanced job
            3/ If this job has a more than 1 record to work with (configurable with PARALOOP_load_balancing_threshold parameter), submit a new
               monoprocessor job, taking 50% of the remaining work
               This function may be overloaded by the plugins, if necessary.
 precondition: $o_scheduler must exist and be initialized
 Return:   0 if nothing stolen, 1 if something stolen
 Args:     $o_scheduler
 Globals:  none