willcodeforfoo-barbequeue 0.1
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/README +30 -0
- data/barbequeue.gemspec +34 -0
- data/examples/workers/process_film_worker +32 -0
- data/examples/workers/process_map_worker +8 -0
- data/examples/workers/upload_film_worker +8 -0
- data/examples/workers/upload_map_worker +8 -0
- metadata +75 -0
data/README
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
Barbequeue is a simple framework for running shell scripts that read from a
|
|
2
|
+
queue, perform centralized logging, collect detailed statistics, and provide
|
|
3
|
+
notifications on errors.
|
|
4
|
+
|
|
5
|
+
Its genesis is feeling the pain of running small shell scripts over and over
|
|
6
|
+
again. Running them one-off on the command line first, then trying cron to
|
|
7
|
+
periodically kick off tasks based on results from find, then finally realizing
|
|
8
|
+
that a work queue is the proper solution to the problem--without sacrificing
|
|
9
|
+
the ability to run one-offs.
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
Queues
|
|
13
|
+
-------------------------------------------------------------------------------
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
Workers
|
|
17
|
+
-------------------------------------------------------------------------------
|
|
18
|
+
Workers can be run in two modes: daemon and one-off mode. Starting a worker with
|
|
19
|
+
no arguments will run in daemon mode, reading from the queue specified in the
|
|
20
|
+
worker class. Passing an argument to the worker will process that argument
|
|
21
|
+
(as if it was read from the queue) and terminate.
|
|
22
|
+
|
|
23
|
+
There are several examples in the examples/workers directory.
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
Mixins
|
|
27
|
+
-------------------------------------------------------------------------------
|
|
28
|
+
For lack of a better name, Mixins are actually Ruby mixins that allow you to
|
|
29
|
+
add functionality to any of your workers. Some ideas would be things like
|
|
30
|
+
logging, statistics, and exception notification.
|
data/barbequeue.gemspec
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
Gem::Specification.new do |s|
|
|
2
|
+
s.name = "barbequeue"
|
|
3
|
+
s.version = "0.1"
|
|
4
|
+
s.date = "2008-11-06"
|
|
5
|
+
s.summary = "Distributed shell scripts with logging and statistics"
|
|
6
|
+
s.email = "kevin.marsh@gmail.com"
|
|
7
|
+
s.homepage = "http://github.com/willcodeforfoo/barbequeue"
|
|
8
|
+
s.description = "Barbequeue is a simple framework for running shell scripts that read from a queue, perform centralized logging, collect detailed statistics, and provide notifications on errors."
|
|
9
|
+
s.has_rdoc = false
|
|
10
|
+
s.authors = ["Kevin Marsh"]
|
|
11
|
+
s.files = ["README",
|
|
12
|
+
"barbequeue.gemspec",
|
|
13
|
+
"lib/barbequeue/barbequeue.rb",
|
|
14
|
+
"lib/barbequeue/lib/mixins/logging.rb",
|
|
15
|
+
"lib/barbequeue/lib/mixins/statistics.rb",
|
|
16
|
+
"examples/workers/process_film_worker",
|
|
17
|
+
"examples/workers/process_map_worker",
|
|
18
|
+
"examples/workers/upload_film_worker",
|
|
19
|
+
"examples/workers/upload_map_worker"]
|
|
20
|
+
s.test_files = ["test/test_actor.rb",
|
|
21
|
+
"test/test_blob.rb", "test/test_commit.rb",
|
|
22
|
+
"test/test_config.rb",
|
|
23
|
+
"test/test_diff.rb",
|
|
24
|
+
"test/test_git.rb",
|
|
25
|
+
"test/test_grit.rb",
|
|
26
|
+
"test/test_head.rb",
|
|
27
|
+
"test/test_real.rb",
|
|
28
|
+
"test/test_reality.rb",
|
|
29
|
+
"test/test_remote.rb",
|
|
30
|
+
"test/test_repo.rb",
|
|
31
|
+
"test/test_tag.rb",
|
|
32
|
+
"test/test_tree.rb"]
|
|
33
|
+
s.rdoc_options = ["--main", "README"]
|
|
34
|
+
end
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
#!/usr/bin/env ruby
|
|
2
|
+
|
|
3
|
+
require 'rubygems'
|
|
4
|
+
require File.join(File.dirname(__FILE__), '/../../lib/barbequeue')
|
|
5
|
+
|
|
6
|
+
class ProcessFilm < Barbequeue::Worker
|
|
7
|
+
THUMBNAIL_SIZES = %w[240x172 700x503]
|
|
8
|
+
|
|
9
|
+
include Barbequeue::Logging # TODO: How can I get rid of the need to namespace
|
|
10
|
+
include Barbequeue::Statistics
|
|
11
|
+
|
|
12
|
+
queue :process_film
|
|
13
|
+
|
|
14
|
+
def process
|
|
15
|
+
# super
|
|
16
|
+
# Do things with @input here, these can be broken into submethods to maintain
|
|
17
|
+
# readability.
|
|
18
|
+
rename
|
|
19
|
+
resize
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
protected
|
|
23
|
+
def rename
|
|
24
|
+
puts "** Renaming #{@input}"
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
def resize
|
|
28
|
+
puts "** Resizing #{@input}"
|
|
29
|
+
end
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
ProcessFilm.run!
|
metadata
ADDED
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
|
2
|
+
name: willcodeforfoo-barbequeue
|
|
3
|
+
version: !ruby/object:Gem::Version
|
|
4
|
+
version: "0.1"
|
|
5
|
+
platform: ruby
|
|
6
|
+
authors:
|
|
7
|
+
- Kevin Marsh
|
|
8
|
+
autorequire:
|
|
9
|
+
bindir: bin
|
|
10
|
+
cert_chain: []
|
|
11
|
+
|
|
12
|
+
date: 2008-11-06 00:00:00 -08:00
|
|
13
|
+
default_executable:
|
|
14
|
+
dependencies: []
|
|
15
|
+
|
|
16
|
+
description: Barbequeue is a simple framework for running shell scripts that read from a queue, perform centralized logging, collect detailed statistics, and provide notifications on errors.
|
|
17
|
+
email: kevin.marsh@gmail.com
|
|
18
|
+
executables: []
|
|
19
|
+
|
|
20
|
+
extensions: []
|
|
21
|
+
|
|
22
|
+
extra_rdoc_files: []
|
|
23
|
+
|
|
24
|
+
files:
|
|
25
|
+
- README
|
|
26
|
+
- barbequeue.gemspec
|
|
27
|
+
- lib/barbequeue/barbequeue.rb
|
|
28
|
+
- lib/barbequeue/lib/mixins/logging.rb
|
|
29
|
+
- lib/barbequeue/lib/mixins/statistics.rb
|
|
30
|
+
- examples/workers/process_film_worker
|
|
31
|
+
- examples/workers/process_map_worker
|
|
32
|
+
- examples/workers/upload_film_worker
|
|
33
|
+
- examples/workers/upload_map_worker
|
|
34
|
+
has_rdoc: false
|
|
35
|
+
homepage: http://github.com/willcodeforfoo/barbequeue
|
|
36
|
+
post_install_message:
|
|
37
|
+
rdoc_options:
|
|
38
|
+
- --main
|
|
39
|
+
- README
|
|
40
|
+
require_paths:
|
|
41
|
+
- lib
|
|
42
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
|
43
|
+
requirements:
|
|
44
|
+
- - ">="
|
|
45
|
+
- !ruby/object:Gem::Version
|
|
46
|
+
version: "0"
|
|
47
|
+
version:
|
|
48
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
49
|
+
requirements:
|
|
50
|
+
- - ">="
|
|
51
|
+
- !ruby/object:Gem::Version
|
|
52
|
+
version: "0"
|
|
53
|
+
version:
|
|
54
|
+
requirements: []
|
|
55
|
+
|
|
56
|
+
rubyforge_project:
|
|
57
|
+
rubygems_version: 1.2.0
|
|
58
|
+
signing_key:
|
|
59
|
+
specification_version: 2
|
|
60
|
+
summary: Distributed shell scripts with logging and statistics
|
|
61
|
+
test_files:
|
|
62
|
+
- test/test_actor.rb
|
|
63
|
+
- test/test_blob.rb
|
|
64
|
+
- test/test_commit.rb
|
|
65
|
+
- test/test_config.rb
|
|
66
|
+
- test/test_diff.rb
|
|
67
|
+
- test/test_git.rb
|
|
68
|
+
- test/test_grit.rb
|
|
69
|
+
- test/test_head.rb
|
|
70
|
+
- test/test_real.rb
|
|
71
|
+
- test/test_reality.rb
|
|
72
|
+
- test/test_remote.rb
|
|
73
|
+
- test/test_repo.rb
|
|
74
|
+
- test/test_tag.rb
|
|
75
|
+
- test/test_tree.rb
|