better naming
This commit is contained in:
@@ -7,8 +7,8 @@ use Module::Load ();
|
|||||||
Module::Load::load_remote 'JobQueue' => 'App::Netdisco::JobQueue' => ':all';
|
Module::Load::load_remote 'JobQueue' => 'App::Netdisco::JobQueue' => ':all';
|
||||||
|
|
||||||
# central queue
|
# central queue
|
||||||
sub jq_get { shift and JobQueue::jq_get(@_) }
|
sub jq_getsome { shift and JobQueue::jq_getsome(@_) }
|
||||||
sub jq_getlocal { shift and JobQueue::jq_getlocal(@_) }
|
sub jq_locked { shift and JobQueue::jq_locked(@_) }
|
||||||
sub jq_queued { shift and JobQueue::jq_queued(@_) }
|
sub jq_queued { shift and JobQueue::jq_queued(@_) }
|
||||||
sub jq_take { goto \&JobQueue::jq_take }
|
sub jq_take { goto \&JobQueue::jq_take }
|
||||||
sub jq_lock { shift and JobQueue::jq_lock(@_) }
|
sub jq_lock { shift and JobQueue::jq_lock(@_) }
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ sub worker_begin {
|
|||||||
|
|
||||||
# requeue jobs locally
|
# requeue jobs locally
|
||||||
debug "mgr ($wid): searching for jobs booked to this processing node";
|
debug "mgr ($wid): searching for jobs booked to this processing node";
|
||||||
my @jobs = $self->jq_getlocal;
|
my @jobs = $self->jq_locked;
|
||||||
|
|
||||||
if (scalar @jobs) {
|
if (scalar @jobs) {
|
||||||
info sprintf "mgr (%s): found %s jobs booked to this processing node", $wid, 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
|
# get some pending jobs
|
||||||
# TODO also check for stale jobs in Netdisco DB
|
# 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
|
# check for available local capacity
|
||||||
my $job_type = setting('job_types')->{$job->action};
|
my $job_type = setting('job_types')->{$job->action};
|
||||||
|
|||||||
@@ -9,8 +9,8 @@ Module::Load::load
|
|||||||
use base 'Exporter';
|
use base 'Exporter';
|
||||||
our @EXPORT = ();
|
our @EXPORT = ();
|
||||||
our @EXPORT_OK = qw/
|
our @EXPORT_OK = qw/
|
||||||
jq_get
|
jq_getsome
|
||||||
jq_getlocal
|
jq_locked
|
||||||
jq_queued
|
jq_queued
|
||||||
jq_log
|
jq_log
|
||||||
jq_userlog
|
jq_userlog
|
||||||
@@ -36,13 +36,13 @@ subroutines.
|
|||||||
|
|
||||||
=head1 EXPORT_OK
|
=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,
|
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
|
unless C<$num> is provided. Jobs are returned as objects which implement the
|
||||||
Netdisco job instance interface (see below).
|
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
|
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
|
by the local hostname). Jobs are returned as objects which implement the
|
||||||
|
|||||||
@@ -9,8 +9,8 @@ use Try::Tiny;
|
|||||||
use base 'Exporter';
|
use base 'Exporter';
|
||||||
our @EXPORT = ();
|
our @EXPORT = ();
|
||||||
our @EXPORT_OK = qw/
|
our @EXPORT_OK = qw/
|
||||||
jq_get
|
jq_getsome
|
||||||
jq_getlocal
|
jq_locked
|
||||||
jq_queued
|
jq_queued
|
||||||
jq_log
|
jq_log
|
||||||
jq_userlog
|
jq_userlog
|
||||||
@@ -23,7 +23,7 @@ our @EXPORT_OK = qw/
|
|||||||
/;
|
/;
|
||||||
our %EXPORT_TAGS = ( all => \@EXPORT_OK );
|
our %EXPORT_TAGS = ( all => \@EXPORT_OK );
|
||||||
|
|
||||||
sub jq_get {
|
sub jq_getsome {
|
||||||
my $num_slots = shift;
|
my $num_slots = shift;
|
||||||
my @returned = ();
|
my @returned = ();
|
||||||
|
|
||||||
@@ -41,7 +41,7 @@ sub jq_get {
|
|||||||
return @returned;
|
return @returned;
|
||||||
}
|
}
|
||||||
|
|
||||||
sub jq_getlocal {
|
sub jq_locked {
|
||||||
my $fqdn = hostfqdn || 'localhost';
|
my $fqdn = hostfqdn || 'localhost';
|
||||||
my @returned = ();
|
my @returned = ();
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user