perl-IPC-Concurrency-DBI - Control how many instances of an application run in parallel, using DBI as the IPC method

Distribution: ALT Linux Sisyphus
Repository: Autoimports noarch
Package name: perl-IPC-Concurrency-DBI
Package version: 1.2.0
Package release: alt1
Package architecture: noarch
Package type: rpm
Installed size: 47.39 KB
Download size: 47.39 KB
Official Mirror:
This module controls how many instances of a given program are allowed to run in parallel. It does not manage forking or starting those instances. You can use this module for example to prevent more than one instance of a program from running at any given time, or to never have more than N instances running in parallel to prevent exhausting all the available resources. It uses DBI as a storage layer for information about instances and applications, which is particularly useful in contexts where Sarbanes-Oxley regulations allow you database access but not file write rights in production environments. _# Configure the concurrency object. _use IPC::Concurrency::DBI; _my $concurrency_manager = IPC::Concurrency::DBI->new( __'database_handle' => $dbh, __'verbose' => 1, _); _# Create the tables that the concurrency manager needs to store information _# about the applications and instances. _$concurrency_manager->create_tables(); _# Register as an application we want to limit to 10 parallel _# instances. We only need to do this once, obviously. _$concurrency_manager->register_application( __name => '', __maximum_instances => 10, _); _# Retrieve the application. _my $application = $concurrency_manager->get_application( __name => '', _); _# Count how many instances are currently running. _my $instances_count = $application->get_instances_count(); _# NOT IMPLEMENTED YET: Get a list of what instances are currently running. _# my $instances = $application->get_instances_list() _# Start a new instance of the application. If this returns undef, we've _# reached the limit. _unless ( my $instance = $application->start_instance() ) _{ __print "Too many instances of $0 are already running.\n"; __exit; _} _# [...] Do some work. _# Now that the application is about to exit, flag the instance as completed. _# (note: this is implicit when $instance is destroyed). _$instance->finish();




  • perl(IPC/Concurrency/ = 1.002
  • perl(IPC/Concurrency/DBI/ = 1.002
  • perl(IPC/Concurrency/DBI/Application/ = 1.002
  • perl-IPC-Concurrency-DBI = 1.2.0-alt1

    Install Howto

    1. Add the following line to /etc/apt/sources.list:
      rpm [Sisyphus] noarch autoimports
      rpm [Sisyphus] noarch autoimports
    2. Update the package index:
      # sudo apt-get update
    3. Install perl-IPC-Concurrency-DBI rpm package:
      # sudo apt-get install perl-IPC-Concurrency-DBI


    • /usr/share/doc/perl-IPC-Concurrency-DBI-1.2.0/Changes
    • /usr/share/doc/perl-IPC-Concurrency-DBI-1.2.0/LICENSE
    • /usr/share/doc/perl-IPC-Concurrency-DBI-1.2.0/
    • /usr/share/doc/perl-IPC-Concurrency-DBI-1.2.0/ignore.txt
    • /usr/share/doc/perl-IPC-Concurrency-DBI-1.2.0/examples/examples.txt
    • /usr/share/perl5/IPC/
    • /usr/share/perl5/IPC/Concurrency/
    • /usr/share/perl5/IPC/Concurrency/DBI/
    • /usr/share/perl5/IPC/Concurrency/DBI/Application/