DBIx::BatchChunker::LoopState - Loop state object for DBIx::BatchChunker
version v1.0.1
sub chunk_method { my ($bc, $rs) = @_; my $loop_state = $bc->loop_state; # introspect stuff }
This is the loop state object used during BatchChunker runs. It only exists within the BatchChunker execution loop, and would generally only be accessible through the coderef or method referenced within that loop.
This is a quasi-private object and its API may be subject to change, but the module is in a pretty stable state at this point. While permissions are available to write to the attributes, it is highly recommended to not do so unless you know exactly what you doing. These are mostly available for introspection of loop progress.
Reference back to the parent DBIx::BatchChunker object.
The progress bar being used in the loop. This may be different than "progress_bar" in DBIx::BatchChunker, since it could be auto-generated.
If you're trying to access the progress bar for debug or display purposes, it's best to use this attribute:
my $progress_bar = $bc->loop_state->progress_bar; $progress_bar->message('Found something here');
Epoch timer for the start of the entire operation.
Epoch timer for the start of each chunk.
The real start ID that the loop is currently on. May continue to exist within iterations if chunk resizing is trying to find a valid range. Otherwise, this value will become undef when a chunk is finally processed.
The real end ID that the loop is currently looking at. This is always redefined at the beginning of the loop.
Last "processed" value of "end". This also includes skipped blocks. Used in "start" calculations and to determine if the end of the loop has been reached.
A hashref of min/max values used for the bisecting of one block, measured in chunk multipliers. Cleared out after a block has been processed or skipped.
An arrayref of hashrefs, containing data for the previous 5 runs. This data is used for runtime targeting.
The range (in units of "chunk_size") between the start and end IDs. This starts at 1 (at the beginning of the loop), but may expand or shrink depending on chunk count checks. Resets after block processing.
Determines how fast "multiplier_range" increases, so that chunk resizing happens at an accelerated pace. Speeds or slows depending on what kind of limits the chunk count checks are hitting. Resets after block processing.
A check counter to make sure the chunk resizing isn't taking too long. After ten checks, it will give up, assuming the block is safe to process.
The current chunk size, which might be adjusted by runtime targeting.
Records the results of the COUNT(*) query for chunk resizing.
COUNT(*)
A short string recording what happened during the last chunk resizing check. Exists purely for debugging purposes.
The number of seconds the previously processed chunk took to run, not including sleep time.
Grant Street Group <developers@grantstreet.com>
This software is Copyright (c) 2018 - 2023 by Grant Street Group.
This is free software, licensed under:
The Artistic License 2.0 (GPL Compatible)
To install DBIx::BatchChunker, copy and paste the appropriate command in to your terminal.
cpanm
cpanm DBIx::BatchChunker
CPAN shell
perl -MCPAN -e shell install DBIx::BatchChunker
For more information on module installation, please visit the detailed CPAN module installation guide.