r16435 - in /branches/upstream/libpoe-component-jobqueue-perl/current: CHANGES JobQueue.pm MANIFEST META.yml Makefile.PL README t/01_queues.t
tincho-guest at users.alioth.debian.org
tincho-guest at users.alioth.debian.org
Tue Mar 4 03:52:28 UTC 2008
Author: tincho-guest
Date: Tue Mar 4 03:52:24 2008
New Revision: 16435
URL: http://svn.debian.org/wsvn/?sc=1&rev=16435
Log:
[svn-upgrade] Integrating new upstream version, libpoe-component-jobqueue-perl (0.55)
Modified:
branches/upstream/libpoe-component-jobqueue-perl/current/CHANGES
branches/upstream/libpoe-component-jobqueue-perl/current/JobQueue.pm
branches/upstream/libpoe-component-jobqueue-perl/current/MANIFEST
branches/upstream/libpoe-component-jobqueue-perl/current/META.yml
branches/upstream/libpoe-component-jobqueue-perl/current/Makefile.PL
branches/upstream/libpoe-component-jobqueue-perl/current/README
branches/upstream/libpoe-component-jobqueue-perl/current/t/01_queues.t
Modified: branches/upstream/libpoe-component-jobqueue-perl/current/CHANGES
URL: http://svn.debian.org/wsvn/branches/upstream/libpoe-component-jobqueue-perl/current/CHANGES?rev=16435&op=diff
==============================================================================
--- branches/upstream/libpoe-component-jobqueue-perl/current/CHANGES (original)
+++ branches/upstream/libpoe-component-jobqueue-perl/current/CHANGES Tue Mar 4 03:52:24 2008
@@ -1,20 +1,21 @@
=========================
-2004-05-19 16:13:42 v0_54
+2006-08-09 13:24:28 v0_55
=========================
- 2004-05-19 16:13:42 by rcaputo; JobQueue.pm 1.10
+ 2006-08-09 13:23:57 (r23) by rcaputo; JobQueue.pm M
- Zach Thompson reported the hash keys problem that was previously
- patched, reminding me that I hadn't actually released the fix to the
- world. Here I am bumping the version number so I can release it to
- the CPAN.
+ Andrew Hoying (blm.gov) added support for a "stop" command that
+ allows queues to be stopped before they run out of jobs.
- 2003-11-29 23:18:56 by rcaputo; JobQueue.pm 1.9; t/01_queues.t 1.8
+ 2005-06-21 18:50:16 (r22) by rcaputo; MANIFEST M; Makefile.PL M
- Applied neyuki's patch to correct some typos in hash keys and
- parameter names. This also corrects the worker respond logic in
- active queues.
+ Remove META.yml from MANIFEST since it's created at "make dist" time.
+ Updated Makefile.PL to generate CHANGES from Subversion commits.
-=============================
-Beginning of Recorded History
-=============================
+ 2005-05-05 05:37:56 (r21) by rcaputo; MANIFEST M
+
+ Add META.yml to the MANIFEST.
+
+==============
+End of Excerpt
+==============
Modified: branches/upstream/libpoe-component-jobqueue-perl/current/JobQueue.pm
URL: http://svn.debian.org/wsvn/branches/upstream/libpoe-component-jobqueue-perl/current/JobQueue.pm?rev=16435&op=diff
==============================================================================
--- branches/upstream/libpoe-component-jobqueue-perl/current/JobQueue.pm (original)
+++ branches/upstream/libpoe-component-jobqueue-perl/current/JobQueue.pm Tue Mar 4 03:52:24 2008
@@ -1,4 +1,4 @@
-# $Id: JobQueue.pm,v 1.10 2004/05/19 16:13:42 rcaputo Exp $
+# $Id: JobQueue.pm 23 2006-08-09 13:23:57Z rcaputo $
# License and documentation are after __END__.
package POE::Component::JobQueue;
@@ -6,7 +6,7 @@
use strict;
use vars qw($VERSION);
-$VERSION = '0.54';
+$VERSION = '0.55';
use Carp qw (croak);
@@ -194,8 +194,24 @@
$heap->{worker_limit}, ")"
) if $heap->{worker_count} > $heap->{worker_limit};
$heap->{worker_count}--;
- $kernel->yield('dequeue') unless $heap->{latest_worker};
- }
+ $kernel->yield('dequeue') unless (
+ $heap->{latest_worker} or $heap->{stopped}
+ );
+ }
+}
+
+# Remove the alias, stop active polling and delete outstanding job queue
+
+sub poco_jobqueue_both_stop {
+ my ($kernel, $heap) = @_[KERNEL, HEAP];
+
+ $kernel->alias_remove($heap->{alias});
+ $kernel->alarm_remove_all();
+
+ delete $heap->{pollinterval} if ($heap->{pollinterval});
+ delete $heap->{job_queue} if ($heap->{job_queue});
+
+ $heap->{stopped} = 1;
}
# Attempt to fill empty worker slots.
@@ -222,7 +238,10 @@
}
# Attempt to fill the empty worker slots.
- while ($heap->{worker_count} < $heap->{worker_limit}) {
+ while (
+ not $heap->{stopped}
+ and $heap->{worker_count} < $heap->{worker_limit}
+ ) {
# Call the worker to fetch a new job and spawn a session.
my $previous_worker_count = $heap->{worker_count};
@@ -247,7 +266,10 @@
my ($kernel, $heap) = @_[KERNEL, HEAP];
# Attempt to fill the empty worker slots.
- while ($heap->{worker_count} < $heap->{worker_limit}) {
+ while (
+ not $heap->{stopped}
+ and $heap->{worker_count} < $heap->{worker_limit}
+ ) {
# Try to fetch another job from the queue.
my $next_job = shift @{ $heap->{job_queue} };
@@ -269,6 +291,14 @@
sub poco_jobqueue_passive_enqueue {
my ($kernel, $sender, $heap, $return_state, @job) =
@_[KERNEL, SENDER, HEAP, ARG0..$#_];
+
+ if ($heap->{stopped}) {
+ DEBUG and warn(
+ "JQ: $heap->{alias} can not enqueue new jobs after 'stop'\n"
+ );
+
+ return;
+ }
DEBUG and warn "JQ: job queue $heap->{alias} enqueuing a new job";
@@ -373,6 +403,9 @@
print "results of finished job: (@job_response)\n";
}
+ # Stop a running queue
+ $kernel->call( 'active' => 'stop' );
+
=head1 DESCRIPTION
POE::Component::JobQueue manages a finite pool of worker sessions as
@@ -552,6 +585,12 @@
receive jobs from the outside; instead, they poll for them and post
acknowledgements as they're completed.
+Running queues can be stopped by posting a "stop" state to the
+component. Any currently running workers will be allowed to
+complete, but no new workers will be started.
+
+ $kernel->call( 'queue' => 'stop' ); # Stop the running queue
+
=head1 SEE ALSO
This component is built upon and POE. Please see its source code and
Modified: branches/upstream/libpoe-component-jobqueue-perl/current/MANIFEST
URL: http://svn.debian.org/wsvn/branches/upstream/libpoe-component-jobqueue-perl/current/MANIFEST?rev=16435&op=diff
==============================================================================
--- branches/upstream/libpoe-component-jobqueue-perl/current/MANIFEST (original)
+++ branches/upstream/libpoe-component-jobqueue-perl/current/MANIFEST Tue Mar 4 03:52:24 2008
@@ -1,4 +1,4 @@
-# $Id: MANIFEST,v 1.1 2000/09/04 20:19:57 rcaputo Exp $
+# $Id: MANIFEST 22 2005-06-21 18:50:16Z rcaputo $
CHANGES
JobQueue.pm
MANIFEST
Modified: branches/upstream/libpoe-component-jobqueue-perl/current/META.yml
URL: http://svn.debian.org/wsvn/branches/upstream/libpoe-component-jobqueue-perl/current/META.yml?rev=16435&op=diff
==============================================================================
--- branches/upstream/libpoe-component-jobqueue-perl/current/META.yml (original)
+++ branches/upstream/libpoe-component-jobqueue-perl/current/META.yml Tue Mar 4 03:52:24 2008
@@ -1,11 +1,13 @@
-# http://module-build.sourceforge.net/META-spec.html
-#XXXXXXX This is a prototype!!! It will change in the future!!! XXXXX#
-name: POE-Component-JobQueue
-version: 0.54
-version_from: JobQueue.pm
-installdirs: site
-requires:
- POE: 0.11
-
-distribution_type: module
-generated_by: ExtUtils::MakeMaker version 6.17
+--- #YAML:1.0
+name: POE-Component-JobQueue
+version: 0.55
+abstract: Handle large numbers of tasks with finite numbers of workers.
+license: unknown
+generated_by: ExtUtils::MakeMaker version 6.30_01
+author: Rocco Caputo <rcaputo at cpan.org>
+distribution_type: module
+requires:
+ POE: 0.31
+meta-spec:
+ url: <http://module-build.sourceforge.net/META-spec-new.html>;
+ version: 1.1
Modified: branches/upstream/libpoe-component-jobqueue-perl/current/Makefile.PL
URL: http://svn.debian.org/wsvn/branches/upstream/libpoe-component-jobqueue-perl/current/Makefile.PL?rev=16435&op=diff
==============================================================================
--- branches/upstream/libpoe-component-jobqueue-perl/current/Makefile.PL (original)
+++ branches/upstream/libpoe-component-jobqueue-perl/current/Makefile.PL Tue Mar 4 03:52:24 2008
@@ -1,27 +1,29 @@
#!/usr/bin/perl
-# $Id: Makefile.PL,v 1.3 2002/09/10 03:42:50 rcaputo Exp $
+# $Id: Makefile.PL 22 2005-06-21 18:50:16Z rcaputo $
use ExtUtils::MakeMaker;
# Touch CHANGES so it exists.
open(CHANGES, ">>CHANGES") and close CHANGES;
-WriteMakefile
- ( NAME => 'POE::Component::JobQueue',
- AUTHOR => 'Rocco Caputo <rcaputo at cpan.org>',
- ABSTRACT => ( 'POE component for processing large numbers of tasks ' .
- 'with finite numbers of workers.'
- ),
- VERSION_FROM => 'JobQueue.pm',
+WriteMakefile(
+ NAME => 'POE::Component::JobQueue',
+ AUTHOR => 'Rocco Caputo <rcaputo at cpan.org>',
+ ABSTRACT => (
+ 'Handle large numbers of tasks with finite numbers of workers.'
+ ),
+ VERSION_FROM => 'JobQueue.pm',
- PM => { 'JobQueue.pm' => '$(INST_LIBDIR)/JobQueue.pm' },
- PREREQ_PM => { POE => 0.11,
- },
- dist =>
- { COMPRESS => 'gzip -9f',
- SUFFIX => 'gz',
- PREOP => ( 'cvs-log.perl | ' .
- 'tee ./$(DISTNAME)-$(VERSION)/CHANGES > ./CHANGES'
- ),
- },
- );
+ PM => { 'JobQueue.pm' => '$(INST_LIBDIR)/JobQueue.pm' },
+ PREREQ_PM => {
+ POE => 0.31,
+ },
+ dist => {
+ COMPRESS => 'gzip -9f',
+ SUFFIX => 'gz',
+ PREOP => (
+ 'svn-log.perl --repo https://thirdlobe.com/svn/poco-jobqueue | ' .
+ 'tee ./$(DISTNAME)-$(VERSION)/CHANGES > ./CHANGES'
+ ),
+ },
+);
Modified: branches/upstream/libpoe-component-jobqueue-perl/current/README
URL: http://svn.debian.org/wsvn/branches/upstream/libpoe-component-jobqueue-perl/current/README?rev=16435&op=diff
==============================================================================
--- branches/upstream/libpoe-component-jobqueue-perl/current/README (original)
+++ branches/upstream/libpoe-component-jobqueue-perl/current/README Tue Mar 4 03:52:24 2008
@@ -1,4 +1,4 @@
-$Id: README,v 1.2 2001/05/29 17:54:55 rcaputo Exp $
+$Id: README 3 2001-05-29 17:54:55Z rcaputo $
--------
Abstract
Modified: branches/upstream/libpoe-component-jobqueue-perl/current/t/01_queues.t
URL: http://svn.debian.org/wsvn/branches/upstream/libpoe-component-jobqueue-perl/current/t/01_queues.t?rev=16435&op=diff
==============================================================================
--- branches/upstream/libpoe-component-jobqueue-perl/current/t/01_queues.t (original)
+++ branches/upstream/libpoe-component-jobqueue-perl/current/t/01_queues.t Tue Mar 4 03:52:24 2008
@@ -1,5 +1,5 @@
#!/usr/bin/perl -w
-# $Id: 01_queues.t,v 1.8 2003/11/29 23:18:56 rcaputo Exp $
+# $Id: 01_queues.t 18 2003-11-29 23:18:56Z rcaputo $
use strict;
More information about the Pkg-perl-cvs-commits
mailing list