From 5dc1462a4ce536cacf9fc380b1022d1c48d12bc2 Mon Sep 17 00:00:00 2001 From: Steve Kemp Date: Tue, 23 Apr 2013 10:11:47 +0100 Subject: Allow --queue to specify the beanstalkd tube. --- bin/custodian-dequeue | 7 ++++++- bin/custodian-enqueue | 11 +++++++++-- bin/custodian-queue | 6 +++++- 3 files changed, 20 insertions(+), 4 deletions(-) (limited to 'bin') diff --git a/bin/custodian-dequeue b/bin/custodian-dequeue index 08579af..f121686 100755 --- a/bin/custodian-dequeue +++ b/bin/custodian-dequeue @@ -71,15 +71,18 @@ if __FILE__ == $0 then # settings = Custodian::Settings.instance() $SERVER = settings.queue_server + $QUEUE = settings.queue_name $ALERTER = settings.alerter $LOGFILE = settings.log_file + begin opts = GetoptLong.new( [ "--help", "-h", GetoptLong::NO_ARGUMENT ], [ "--manual", "-m", GetoptLong::NO_ARGUMENT ], [ "--fail", "-f", GetoptLong::NO_ARGUMENT ], [ "--logfile", "-l", GetoptLong::REQUIRED_ARGUMENT ], + [ "--queue", "-q", GetoptLong::REQUIRED_ARGUMENT ], [ "--server", "-S", GetoptLong::REQUIRED_ARGUMENT ], [ "--alerter", "-a", GetoptLong::REQUIRED_ARGUMENT ], [ "--single", "-s", GetoptLong::NO_ARGUMENT ], @@ -93,6 +96,8 @@ if __FILE__ == $0 then $LOGFILE = arg when "--server" then $SERVER = arg + when "--queue" then + $QUEUE = arg when "--alerter" then $ALERTER = arg when "--single" then @@ -144,7 +149,7 @@ if __FILE__ == $0 then # # Create the object # - worker = Custodian::Worker.new( $SERVER, $ALERTER, $LOGFILE, settings ) + worker = Custodian::Worker.new( $SERVER, $QUEUE, $ALERTER, $LOGFILE, settings ) # diff --git a/bin/custodian-enqueue b/bin/custodian-enqueue index 41378e6..e2e4420 100755 --- a/bin/custodian-enqueue +++ b/bin/custodian-enqueue @@ -6,6 +6,7 @@ # SYNOPSIS # custodian-enqueue [ -h | --help ] # [ -m | --manual] +# [ -q | --queue NAME] # [ -f | --file FILE] # [ -d | --dump ] # [ | --test ] @@ -18,6 +19,8 @@ # # -d, --dump Dump the parsed tests to the console; don't insert in the queue. # +# -q, --queue Use the named beanstalkd tube. +# # --test Test the parsing of the given file, alert on errors. # # -f, --file FILE Parse the given configuration file. @@ -74,6 +77,7 @@ if __FILE__ == $0 then # settings = Custodian::Settings.instance() $SERVER = settings.queue_server + $QUEUE = settings.queue_name begin opts = GetoptLong.new( @@ -82,6 +86,7 @@ if __FILE__ == $0 then [ "--server", GetoptLong::REQUIRED_ARGUMENT ], [ "--file", "-f", GetoptLong::REQUIRED_ARGUMENT ], [ "--help", "-h", GetoptLong::NO_ARGUMENT ], + [ "--queue", "-q", GetoptLong::REQUIRED_ARGUMENT ], [ "--manual","-m", GetoptLong::NO_ARGUMENT ] ) opts.each do |opt, arg| @@ -92,7 +97,9 @@ if __FILE__ == $0 then ENV["TEST"] = "1" when "--server" then $SERVER = arg - when "--file" then + when "--queue" then + $QUEUE= arg + when "--file" then ENV["FILE"] = arg when "--help" then $help = true @@ -139,7 +146,7 @@ if __FILE__ == $0 then # # Connected to the server # - queue = Beanstalk::Pool.new([$SERVER], "Custodian") + queue = Beanstalk::Pool.new([$SERVER], $QUEUE ) if ( ! queue ) puts "Failed to connect to beanstalk server: #{$SERVER}" exit 1 diff --git a/bin/custodian-queue b/bin/custodian-queue index f50a9bd..3e20410 100755 --- a/bin/custodian-queue +++ b/bin/custodian-queue @@ -69,6 +69,7 @@ if __FILE__ == $0 then # settings = Custodian::Settings.instance() $SERVER = settings.queue_server + $QUEUE = settings.queue_name begin opts = GetoptLong.new( @@ -77,6 +78,7 @@ if __FILE__ == $0 then [ "--manual", "-m", GetoptLong::NO_ARGUMENT ], [ "--monitor", "-M", GetoptLong::OPTIONAL_ARGUMENT ], [ "--server", "-S", GetoptLong::REQUIRED_ARGUMENT ], + [ "--queue", "-q", GetoptLong::REQUIRED_ARGUMENT ], [ "--stats", "-s", GetoptLong::NO_ARGUMENT ] ) opts.each do |opt, arg| @@ -93,6 +95,8 @@ if __FILE__ == $0 then $FLUSH = true when "--server" then $SERVER = arg + when "--queue" then + $QUEUE = arg when "--help" then $help = true when "--manual" then @@ -136,7 +140,7 @@ if __FILE__ == $0 then # # Create the queue object. # - queue = Beanstalk::Pool.new([$SERVER], "Custodian" ) + queue = Beanstalk::Pool.new([$SERVER], $QUEUE ) # # Alerting on a queue that is too-full? -- cgit v1.2.1