perfectqueue 0.7.1 → 0.7.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/ChangeLog CHANGED
@@ -1,4 +1,9 @@
1
1
 
2
+ == 2011-09-16 version 0.7.2
3
+
4
+ * Supported --env argument
5
+
6
+
2
7
  == 2011-08-31 version 0.7.1
3
8
 
4
9
  * Fixed kill behavior
data/README.rdoc CHANGED
@@ -52,12 +52,12 @@ PerfectQueue uses following database schema:
52
52
 
53
53
  # RDBMS
54
54
  require 'perfectqueue/backend/rdb'
55
- queue = PerfectQueue::Backend::RDBBackend.new(
55
+ queue = PerfectQueue::RDBBackend.new(
56
56
  'mysql://user:password@localhost/mydb', table='perfectqueue')
57
57
 
58
58
  # SimpleDB
59
59
  require 'perfectqueue/backend/simpledb'
60
- queue = PerfectQueue::Backend::SimpleDBBackend.new(
60
+ queue = PerfectQueue::SimpleDBBackend.new(
61
61
  'AWS_KEY_ID', 'AWS_SECRET_KEY', 'your-simpledb-domain-name')
62
62
 
63
63
  queue.submit('unique-key-id', '{"any":"data"}')
@@ -144,6 +144,7 @@ Use _perfectqueue_ command to execute a command.
144
144
 
145
145
  -w, --worker <NUM> Number of worker threads (default: 1)
146
146
  -d, --daemon <PIDFILE> Daemonize (default: foreground)
147
+ --env K=V Set environment variable
147
148
  -o, --log <PATH> log file path
148
149
  -v, --verbose verbose mode
149
150
 
@@ -4,8 +4,7 @@ module PerfectQueue
4
4
 
5
5
  class SimpleDBBackend < Backend
6
6
  def initialize(key_id, secret_key, domain)
7
- gem "aws-sdk"
8
- require 'aws'
7
+ require 'aws-sdk'
9
8
  @consistent_read = false
10
9
 
11
10
  @db = AWS::SimpleDB.new(
@@ -132,6 +132,11 @@ op.on('-d', '--daemon <PIDFILE>', 'Daemonize (default: foreground)') {|s|
132
132
  conf[:daemon] = s
133
133
  }
134
134
 
135
+ op.on('--env K=V', 'Set environment variable') {|s|
136
+ k, v = s.split('=',2)
137
+ (conf[:env] ||= {})[k] = v
138
+ }
139
+
135
140
  op.on('-o', '--log <PATH>', "log file path") {|s|
136
141
  conf[:log] = s
137
142
  }
@@ -243,7 +248,7 @@ end
243
248
  if confout
244
249
  require 'yaml'
245
250
 
246
- conf.delete(:file)
251
+ conf.delete(:files)
247
252
  conf[:args] = ARGV
248
253
 
249
254
  y = {}
@@ -304,6 +309,10 @@ when :exec, :run
304
309
  }
305
310
  end
306
311
 
312
+ (conf[:env] || {}).each_pair {|k,v|
313
+ ENV[k] = v
314
+ }
315
+
307
316
  if type == :run
308
317
  load File.expand_path(conf[:run])
309
318
  run_class = eval(conf[:run_class] || 'Run')
@@ -77,7 +77,7 @@ class Engine
77
77
  }
78
78
 
79
79
  if err
80
- log.error err.to_s
80
+ log.error "#{err.class}: #{err}"
81
81
  err.backtrace.each {|x|
82
82
  log.error " #{x}"
83
83
  }
@@ -1,5 +1,5 @@
1
1
  module PerfectQueue
2
2
 
3
- VERSION = '0.7.1'
3
+ VERSION = '0.7.2'
4
4
 
5
5
  end
@@ -83,7 +83,7 @@ class MonitorThread
83
83
  begin
84
84
  @kill_proc.call
85
85
  rescue
86
- @log.info "kill failed id=#{@task_id}: #{$!}"
86
+ @log.info "kill failed id=#{@task_id}: #{$!.class}: #{$!}"
87
87
  $!.backtrace.each {|bt|
88
88
  $log.debug " #{bt}"
89
89
  }
@@ -192,7 +192,7 @@ class Worker
192
192
  success = true
193
193
 
194
194
  rescue
195
- @log.info "failed id=#{task.id}: #{$!}"
195
+ @log.info "failed id=#{task.id}: #{$!.class}: #{$!}"
196
196
  $!.backtrace.each {|bt|
197
197
  $log.debug " #{bt}"
198
198
  }
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: perfectqueue
3
3
  version: !ruby/object:Gem::Version
4
- hash: 1
4
+ hash: 7
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 7
9
- - 1
10
- version: 0.7.1
9
+ - 2
10
+ version: 0.7.2
11
11
  platform: ruby
12
12
  authors:
13
13
  - Sadayuki Furuhashi
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-08-31 00:00:00 +09:00
18
+ date: 2011-09-16 00:00:00 +09:00
19
19
  default_executable: perfectqueue
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency