Batcher is a base class that distributes dynamically sized batches of input data to forked child processes for parallel processing.
# TODO
- Clone the repository
git clone https://github.com/selftaught/Batcher.git
- Cd into the repo root and generate a makefile:
perl Makefile.pl
- Make it:
make && make test && make install
Using Batcher is simple. Inherit Batcher in a subclass and then implement a few hooks that Batcher::run
depends on.
batch_count()
- provides the total number of batchsbatch_next($next_idx)
- provides the next batch of data given the next indexbatch_size()
- provides the number of items in a batchbatch_result($result)
- provides the next result to process
Browse examples for implementation examples.
- Fork the repository
- Create feature branch (git checkout -b feature/adding-xyz)
- Create PR to main when feature branch is ready for review
perl Makefile.PL && make dist && make clean
cpan-upload -u <PAUSEUSERNAME> Batcher-$VERSION.tar.gz
If you're a mac user and encounter the following error:
objc[62121]: +[NSString initialize] may have been in progress in another thread when fork() was called.
you may need to disable initialize fork safey for this to work.
export OBJC_DISABLE_INITIALIZE_FORK_SAFETY=YES