From 187fc849375ff27c644ce05a014b8c0e8ab8d5b8 Mon Sep 17 00:00:00 2001 From: Oliver Gorwits Date: Sat, 17 May 2014 21:22:06 +0100 Subject: [PATCH] better naming --- Netdisco/lib/App/Netdisco/Daemon/JobQueue.pm | 4 ++-- Netdisco/lib/App/Netdisco/Daemon/Worker/Manager.pm | 4 ++-- Netdisco/lib/App/Netdisco/JobQueue.pm | 8 ++++---- Netdisco/lib/App/Netdisco/JobQueue/PostgreSQL.pm | 8 ++++---- 4 files changed, 12 insertions(+), 12 deletions(-) diff --git a/Netdisco/lib/App/Netdisco/Daemon/JobQueue.pm b/Netdisco/lib/App/Netdisco/Daemon/JobQueue.pm index 80ab7d7b..097582d5 100644 --- a/Netdisco/lib/App/Netdisco/Daemon/JobQueue.pm +++ b/Netdisco/lib/App/Netdisco/Daemon/JobQueue.pm @@ -7,8 +7,8 @@ use Module::Load (); Module::Load::load_remote 'JobQueue' => 'App::Netdisco::JobQueue' => ':all'; # central queue -sub jq_get { shift and JobQueue::jq_get(@_) } -sub jq_getlocal { shift and JobQueue::jq_getlocal(@_) } +sub jq_getsome { shift and JobQueue::jq_getsome(@_) } +sub jq_locked { shift and JobQueue::jq_locked(@_) } sub jq_queued { shift and JobQueue::jq_queued(@_) } sub jq_take { goto \&JobQueue::jq_take } sub jq_lock { shift and JobQueue::jq_lock(@_) } diff --git a/Netdisco/lib/App/Netdisco/Daemon/Worker/Manager.pm b/Netdisco/lib/App/Netdisco/Daemon/Worker/Manager.pm index bec58049..39af503a 100644 --- a/Netdisco/lib/App/Netdisco/Daemon/Worker/Manager.pm +++ b/Netdisco/lib/App/Netdisco/Daemon/Worker/Manager.pm @@ -15,7 +15,7 @@ sub worker_begin { # requeue jobs locally debug "mgr ($wid): searching for jobs booked to this processing node"; - my @jobs = $self->jq_getlocal; + my @jobs = $self->jq_locked; if (scalar @jobs) { info sprintf "mgr (%s): found %s jobs booked to this processing node", $wid, scalar @jobs; @@ -34,7 +34,7 @@ sub worker_body { # get some pending jobs # TODO also check for stale jobs in Netdisco DB - foreach my $job ( $self->jq_get($num_slots) ) { + foreach my $job ( $self->jq_getsome($num_slots) ) { # check for available local capacity my $job_type = setting('job_types')->{$job->action}; diff --git a/Netdisco/lib/App/Netdisco/JobQueue.pm b/Netdisco/lib/App/Netdisco/JobQueue.pm index a0b6cbc1..c83db56a 100644 --- a/Netdisco/lib/App/Netdisco/JobQueue.pm +++ b/Netdisco/lib/App/Netdisco/JobQueue.pm @@ -9,8 +9,8 @@ Module::Load::load use base 'Exporter'; our @EXPORT = (); our @EXPORT_OK = qw/ - jq_get - jq_getlocal + jq_getsome + jq_locked jq_queued jq_log jq_userlog @@ -36,13 +36,13 @@ subroutines. =head1 EXPORT_OK -=head2 jq_get( $num? ) +=head2 jq_getsome( $num? ) Returns a list of randomly selected queued jobs. Default is to return one job, unless C<$num> is provided. Jobs are returned as objects which implement the Netdisco job instance interface (see below). -=head2 jq_getlocal() +=head2 jq_locked() Returns the list of jobs currently booked out to this processing node (denoted by the local hostname). Jobs are returned as objects which implement the diff --git a/Netdisco/lib/App/Netdisco/JobQueue/PostgreSQL.pm b/Netdisco/lib/App/Netdisco/JobQueue/PostgreSQL.pm index 61cc1f53..4a146fa5 100644 --- a/Netdisco/lib/App/Netdisco/JobQueue/PostgreSQL.pm +++ b/Netdisco/lib/App/Netdisco/JobQueue/PostgreSQL.pm @@ -9,8 +9,8 @@ use Try::Tiny; use base 'Exporter'; our @EXPORT = (); our @EXPORT_OK = qw/ - jq_get - jq_getlocal + jq_getsome + jq_locked jq_queued jq_log jq_userlog @@ -23,7 +23,7 @@ our @EXPORT_OK = qw/ /; our %EXPORT_TAGS = ( all => \@EXPORT_OK ); -sub jq_get { +sub jq_getsome { my $num_slots = shift; my @returned = (); @@ -41,7 +41,7 @@ sub jq_get { return @returned; } -sub jq_getlocal { +sub jq_locked { my $fqdn = hostfqdn || 'localhost'; my @returned = ();