NAME

DynGig::Automata::Sequence - Sequential automation framework.

SYNOPOSIS

use DynGig::Automata::Sequence;

$DynGig::Automata::Sequence::THREAD = $thread_count;  ## select thread mode

my $sequence = DynGig::Automata::Sequence->new( 'blah' );

$sequence->run  ## see DynGig::Util::Logger for parameter
(
    log => '/home/bob/log/blah',
    time => 'local',
    context => \%context,
    thread => $thread_count,
);

DESCRIPTION

Execution pauses when an error is encountered in any job. Execution resumes when all errors are removed from the alert database.

Execution pauses when pause is active. Execution resumes when pause is remove.

Execution terminates when stop is active.

CONFIGURATION FILE

A YAML file 'conf' is expected under the application root directory. It should load into a HASH with the following fields.

KEY               TYPE             NOTE
===               ====             ====
target            HASH
queue             AoH
begin             HASH             optional
end               HASH             optional

Each sub-HASH represents a code/param HASH, where code is the path to the plugin subroutine, and param is a HASH for the parameter of code. ( see PLUGIN API )

PLUGIN API

Each plugin is a file that contains a subroutine. The path of the file corresponds to code in the configuration file. e.g.

return sub
{
    my %param = @_;
    my $logger = $param{logger};    ## CODE
    my $target = $param{target};
    my $context = $param{context};
    ## additional param are passed from the configuration file

    &$logger( "blah" );
    &$logger( "%s", 'blah' );
    ...
};

MODE

In serial mode, target code must have an exhaustive batching behavior. e.g. n targets T1 .. Tn into k batches in k iterations of target code

ITERATION        TARGET
=========        ======
1                T1, T2 .. Tm
2                Tm+1 ..
...
k                .. Tn-1, Tn
k+1              undef

In serial mode, the target parameter for plugin is ARRAY. Whereas in thread mode, scalar.

ARTIFACT

The following directories or symlinks to which, if not already exist are created under the application root directory.

DIRECTORY         NOTE
=========         ====
run               where alert database and symlink to log are kept
param             where override parameter files are kept

The following files are created.

FILE              NOTE
====              ====
run/$name.alert   alert database
run/$name.log     symlink to the log file

The following file is used to control execution

FILE              NOTE
====              ====
run/$name.pause   lock file for pause/stop

NOTE

See DynGig::Automata