symphony 0.12.5 → 0.13.0.pre.20200309182558
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data/History.rdoc +16 -0
- data/Manifest.txt +1 -2
- data/{README.rdoc → README.md} +25 -14
- data/Rakefile +5 -74
- data/lib/symphony/daemon.rb +2 -2
- data/lib/symphony/metrics.rb +1 -1
- data/lib/symphony/mixins.rb +1 -1
- data/lib/symphony/routing.rb +1 -1
- data/lib/symphony/signal_handling.rb +1 -1
- data/lib/symphony/statistics.rb +1 -1
- data/lib/symphony/task.rb +14 -3
- data/lib/symphony/task_group/longlived.rb +2 -2
- data/lib/symphony/task_group/oneshot.rb +1 -1
- data/lib/symphony/task_group.rb +1 -1
- data/lib/symphony.rb +1 -1
- data/spec/helpers.rb +23 -7
- data/spec/symphony/daemon_spec.rb +2 -2
- data/spec/symphony/mixins_spec.rb +6 -2
- data/spec/symphony/queue_spec.rb +1 -1
- data/spec/symphony/routing_spec.rb +1 -1
- data/spec/symphony/statistics_spec.rb +1 -1
- data/spec/symphony/task_group/longlived_spec.rb +1 -1
- data/spec/symphony/task_group/oneshot_spec.rb +1 -1
- data/spec/symphony/task_group_spec.rb +1 -1
- data/spec/symphony/task_spec.rb +2 -2
- data/spec/symphony_spec.rb +1 -1
- data.tar.gz.sig +0 -0
- metadata +46 -149
- metadata.gz.sig +1 -2
- data/ChangeLog +0 -1202
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 692186739c647bd3b2e8432fa790a7a7de05fd23457ecb1377b0ab659477ff48
|
4
|
+
data.tar.gz: d42b13e3b7c1b49c3c25c5b238c81d3f8e8f585b700180971dd75733440dab88
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 37c090c9ac2067ad330122835f29c5c99cb9f5766090f8e402afb9fc19db02458c14bd0e60e4969abf1b6f1b154407e475714b750704b2618b026aebdb86b7be
|
7
|
+
data.tar.gz: 32125c9739cf2aa3fce83b128b22b1af19eeac054d20df45edf593756c488b82d144634e8dba533585559583d6d5a1d7cfcbbfa9a21a2c28fb16dc347d52689c
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data/History.rdoc
CHANGED
@@ -1,3 +1,19 @@
|
|
1
|
+
= Release History for symphony
|
2
|
+
|
3
|
+
---
|
4
|
+
|
5
|
+
== v0.13.0 [2020-03-09] Michael Granger <ged@faeriemud.org>
|
6
|
+
|
7
|
+
Improvements:
|
8
|
+
|
9
|
+
- Remove Yajl dependency in favor of stdlib json.
|
10
|
+
- Update for Ruby 2.7
|
11
|
+
|
12
|
+
Changes:
|
13
|
+
|
14
|
+
- Requires Ruby 2.6+
|
15
|
+
|
16
|
+
|
1
17
|
== v0.12.5 [2019-07-16] Michael Granger <ged@FaerieMUD.org>
|
2
18
|
|
3
19
|
Improvements:
|
data/Manifest.txt
CHANGED
data/{README.rdoc → README.md}
RENAMED
@@ -1,10 +1,16 @@
|
|
1
|
-
|
1
|
+
# symphony
|
2
2
|
|
3
|
-
|
4
|
-
|
3
|
+
home
|
4
|
+
: https://hg.sr.ht/~ged/symphony
|
5
5
|
|
6
|
+
docs
|
7
|
+
: https://deveiate.org/code/symphony
|
6
8
|
|
7
|
-
|
9
|
+
github
|
10
|
+
: https://github.com/ged/symphony
|
11
|
+
|
12
|
+
|
13
|
+
## Description
|
8
14
|
|
9
15
|
Symphony is a subscription-based asynchronous job system. It
|
10
16
|
allows you to define jobs that watch for lightweight events from a
|
@@ -21,7 +27,7 @@ symphony-task::
|
|
21
27
|
require the process management that the symphony daemon provides.
|
22
28
|
|
23
29
|
|
24
|
-
|
30
|
+
## Synopsis
|
25
31
|
|
26
32
|
class WorkerTask < Symphony::Task
|
27
33
|
# Process all events
|
@@ -37,28 +43,33 @@ symphony-task::
|
|
37
43
|
For a more detailed description of usage, please refer to the USAGE document.
|
38
44
|
|
39
45
|
|
40
|
-
|
46
|
+
## Installation
|
41
47
|
|
42
48
|
gem install symphony
|
43
49
|
|
44
50
|
|
45
|
-
|
51
|
+
## Contributing
|
46
52
|
|
47
53
|
You can check out the current development source with Mercurial via its
|
48
|
-
|
49
|
-
|
54
|
+
[project page](https://hg.sr.ht/~ged/symphony). Or if you prefer Git, via
|
55
|
+
[its Github mirror](https://github.com/ged/symphony).
|
50
56
|
|
51
57
|
After checking out the source, run:
|
52
58
|
|
53
|
-
$ rake
|
59
|
+
$ rake setup
|
60
|
+
|
61
|
+
This task will install dependencies, and do any other necessary developer setup.
|
62
|
+
|
63
|
+
|
64
|
+
## Authors
|
54
65
|
|
55
|
-
|
56
|
-
|
66
|
+
- Michael Granger <ged@faeriemud.org>
|
67
|
+
- Mahlon E. Smith <mahlon@martini.nu>
|
57
68
|
|
58
69
|
|
59
|
-
|
70
|
+
## License
|
60
71
|
|
61
|
-
Copyright (c) 2011-
|
72
|
+
Copyright (c) 2011-2020, Michael Granger and Mahlon E. Smith
|
62
73
|
All rights reserved.
|
63
74
|
|
64
75
|
Redistribution and use in source and binary forms, with or without
|
data/Rakefile
CHANGED
@@ -1,79 +1,10 @@
|
|
1
|
-
#!/usr/bin/env rake
|
1
|
+
#!/usr/bin/env ruby -S rake
|
2
2
|
|
3
|
-
|
4
|
-
require 'hoe'
|
5
|
-
rescue LoadError
|
6
|
-
abort "This Rakefile requires hoe (gem install hoe)"
|
7
|
-
end
|
8
|
-
|
9
|
-
GEMSPEC = 'symphony.gemspec'
|
10
|
-
|
11
|
-
|
12
|
-
Hoe.plugin :mercurial
|
13
|
-
Hoe.plugin :signing
|
14
|
-
Hoe.plugin :deveiate
|
15
|
-
|
16
|
-
Hoe.plugins.delete :rubyforge
|
17
|
-
|
18
|
-
hoespec = Hoe.spec 'symphony' do |spec|
|
19
|
-
spec.readme_file = 'README.rdoc'
|
20
|
-
spec.history_file = 'History.rdoc'
|
21
|
-
spec.extra_rdoc_files = FileList[ '*.rdoc' ]
|
22
|
-
spec.spec_extras[:rdoc_options] = ['-f', 'fivefish', '-t', 'Symphony']
|
23
|
-
spec.spec_extras[:required_rubygems_version] = '>= 2.0.3'
|
24
|
-
spec.license 'BSD'
|
25
|
-
|
26
|
-
spec.developer 'Michael Granger', 'ged@FaerieMUD.org'
|
27
|
-
spec.developer 'Mahlon E. Smith', 'mahlon@martini.nu'
|
28
|
-
|
29
|
-
spec.dependency 'configurability', '~> 3.1'
|
30
|
-
spec.dependency 'loggability', '~> 0.11'
|
31
|
-
spec.dependency 'pluggability', '~> 0.4'
|
32
|
-
spec.dependency 'bunny', '~> 2.0'
|
33
|
-
spec.dependency 'sysexits', '~> 1.1'
|
34
|
-
spec.dependency 'yajl-ruby', '~> 1.3'
|
35
|
-
spec.dependency 'msgpack', '~> 1.0'
|
36
|
-
spec.dependency 'metriks', '~> 0.9'
|
37
|
-
spec.dependency 'rusage', '~> 0.2'
|
38
|
-
|
39
|
-
spec.dependency 'rspec', '~> 3.0', :developer
|
40
|
-
spec.dependency 'simplecov', '~> 0.8', :developer
|
41
|
-
spec.dependency 'timecop', '~> 0.8', :developer
|
42
|
-
|
43
|
-
spec.require_ruby_version( '>=2.0.0' )
|
44
|
-
spec.hg_sign_tags = true if spec.respond_to?( :hg_sign_tags= )
|
3
|
+
require 'rake/deveiate'
|
45
4
|
|
46
|
-
|
5
|
+
Rake::DevEiate.setup( 'symphony' ) do |project|
|
6
|
+
project.publish_to = 'deveiate:/usr/local/www/public/code'
|
7
|
+
project.required_ruby_version = '~> 2.6'
|
47
8
|
end
|
48
9
|
|
49
|
-
# Fix some Hoe retardedness
|
50
|
-
hoespec.spec.files.delete( '.gemtest' )
|
51
|
-
ENV['VERSION'] ||= hoespec.spec.version.to_s
|
52
|
-
|
53
|
-
# Run the tests before checking in
|
54
|
-
task 'hg:precheckin' => [ :check_history, :check_manifest, :gemspec, :spec ]
|
55
|
-
|
56
|
-
# Rebuild the ChangeLog immediately before release
|
57
|
-
task :prerelease => 'ChangeLog'
|
58
|
-
CLOBBER.include( 'ChangeLog' )
|
59
|
-
|
60
|
-
desc "Build a coverage report"
|
61
|
-
task :coverage do
|
62
|
-
ENV["COVERAGE"] = 'yes'
|
63
|
-
Rake::Task[:spec].invoke
|
64
|
-
end
|
65
|
-
|
66
|
-
|
67
|
-
task :gemspec => GEMSPEC
|
68
|
-
file GEMSPEC => hoespec.spec.files do |task|
|
69
|
-
spec = $hoespec.spec
|
70
|
-
spec.version = "#{spec.version.bump}.0.pre#{Time.now.strftime("%Y%m%d%H%M%S")}"
|
71
|
-
File.open( task.name, 'w' ) do |fh|
|
72
|
-
fh.write( spec.to_ruby )
|
73
|
-
end
|
74
|
-
end
|
75
|
-
|
76
|
-
task :default => :gemspec
|
77
|
-
|
78
|
-
CLOBBER.include( GEMSPEC.to_s )
|
79
10
|
|
data/lib/symphony/daemon.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
# -*- ruby -*-
|
2
|
-
#
|
2
|
+
# frozen_string_literal: true
|
3
3
|
|
4
4
|
require 'configurability'
|
5
5
|
require 'loggability'
|
@@ -248,7 +248,7 @@ class Symphony::Daemon
|
|
248
248
|
self.log.info "Restarting task group for %p" % [ task_class ]
|
249
249
|
group.max_workers = max
|
250
250
|
group.restart_workers
|
251
|
-
|
251
|
+
end
|
252
252
|
|
253
253
|
|
254
254
|
### Shut down the workers for the specified task group.
|
data/lib/symphony/metrics.rb
CHANGED
data/lib/symphony/mixins.rb
CHANGED
data/lib/symphony/routing.rb
CHANGED
data/lib/symphony/statistics.rb
CHANGED
data/lib/symphony/task.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
# -*- ruby -*-
|
2
|
-
#
|
2
|
+
# frozen_string_literal: true
|
3
3
|
|
4
4
|
require 'set'
|
5
5
|
require 'sysexits'
|
@@ -7,7 +7,7 @@ require 'pluggability'
|
|
7
7
|
require 'loggability'
|
8
8
|
|
9
9
|
require 'msgpack'
|
10
|
-
require '
|
10
|
+
require 'json'
|
11
11
|
require 'yaml'
|
12
12
|
|
13
13
|
require 'symphony' unless defined?( Symphony )
|
@@ -47,6 +47,14 @@ class Symphony::Task
|
|
47
47
|
plugin_prefixes 'symphony/tasks'
|
48
48
|
|
49
49
|
|
50
|
+
@queue = nil
|
51
|
+
@acknowledge = true
|
52
|
+
@routing_keys = Set.new
|
53
|
+
@prefetch = 10
|
54
|
+
@persistent = false
|
55
|
+
@always_rebind = false
|
56
|
+
|
57
|
+
|
50
58
|
### Create a new Task object and listen for work. Exits with the code returned
|
51
59
|
### by #start when it's done.
|
52
60
|
def self::run( exit_on_idle=false )
|
@@ -79,11 +87,14 @@ class Symphony::Task
|
|
79
87
|
def self::inherited( subclass )
|
80
88
|
super
|
81
89
|
|
90
|
+
subclass.instance_variable_set( :@queue, nil )
|
91
|
+
subclass.instance_variable_set( :@always_rebind, false )
|
82
92
|
subclass.instance_variable_set( :@routing_keys, Set.new )
|
83
93
|
subclass.instance_variable_set( :@acknowledge, true )
|
84
94
|
subclass.instance_variable_set( :@work_model, :longlived )
|
85
95
|
subclass.instance_variable_set( :@prefetch, 10 )
|
86
96
|
subclass.instance_variable_set( :@timeout_action, :reject )
|
97
|
+
subclass.instance_variable_set( :@timeout, nil )
|
87
98
|
subclass.instance_variable_set( :@persistent, false )
|
88
99
|
subclass.instance_variable_set( :@idle_timeout, DEFAULT_IDLE_TIMEOUT )
|
89
100
|
end
|
@@ -438,7 +449,7 @@ class Symphony::Task
|
|
438
449
|
when 'application/x-msgpack'
|
439
450
|
MessagePack.unpack( payload )
|
440
451
|
when 'application/json', 'text/javascript'
|
441
|
-
|
452
|
+
JSON.parse( payload )
|
442
453
|
when 'application/x-yaml', 'text/x-yaml'
|
443
454
|
YAML.load( payload )
|
444
455
|
else
|
@@ -1,5 +1,5 @@
|
|
1
1
|
# -*- ruby -*-
|
2
|
-
#
|
2
|
+
# frozen_string_literal: true
|
3
3
|
|
4
4
|
require 'set'
|
5
5
|
require 'symphony/task_group' unless defined?( Symphony::TaskGroup )
|
@@ -96,7 +96,7 @@ class Symphony::TaskGroup::LongLived < Symphony::TaskGroup
|
|
96
96
|
end
|
97
97
|
|
98
98
|
return @queue
|
99
|
-
rescue Bunny::NotFound, Bunny::ChannelAlreadyClosed
|
99
|
+
rescue Bunny::NotFound, Bunny::ChannelAlreadyClosed
|
100
100
|
self.log.info "Child hasn't created the queue yet; deferring"
|
101
101
|
Symphony::Queue.reset
|
102
102
|
|
data/lib/symphony/task_group.rb
CHANGED
data/lib/symphony.rb
CHANGED
data/spec/helpers.rb
CHANGED
@@ -48,6 +48,10 @@ module Symphony::SpecHelpers
|
|
48
48
|
def initialize
|
49
49
|
@queue = nil
|
50
50
|
@exchange = nil
|
51
|
+
@open = true
|
52
|
+
end
|
53
|
+
def open?
|
54
|
+
return @open
|
51
55
|
end
|
52
56
|
def queue( name, opts={} )
|
53
57
|
return @queue ||= DummySession::Queue.new( self )
|
@@ -60,7 +64,9 @@ module Symphony::SpecHelpers
|
|
60
64
|
def number
|
61
65
|
return 1
|
62
66
|
end
|
63
|
-
def close
|
67
|
+
def close
|
68
|
+
@open = false
|
69
|
+
end
|
64
70
|
end
|
65
71
|
|
66
72
|
class Exchange
|
@@ -86,14 +92,24 @@ end
|
|
86
92
|
|
87
93
|
### Mock with RSpec
|
88
94
|
RSpec.configure do |config|
|
89
|
-
config.
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
+
config.expect_with :rspec do |expectations|
|
96
|
+
expectations.include_chain_clauses_in_custom_matcher_descriptions = true
|
97
|
+
expectations.syntax = :expect
|
98
|
+
end
|
99
|
+
|
100
|
+
config.mock_with :rspec do |mocks|
|
101
|
+
mocks.verify_partial_doubles = true
|
95
102
|
end
|
96
103
|
|
104
|
+
config.run_all_when_everything_filtered = true
|
105
|
+
config.filter_run_when_matching :focus
|
106
|
+
config.order = :random
|
107
|
+
config.example_status_persistence_file_path = 'spec/.state'
|
108
|
+
config.disable_monkey_patching!
|
109
|
+
config.warnings = true
|
110
|
+
config.profile_examples = 5
|
111
|
+
|
112
|
+
|
97
113
|
config.include( Loggability::SpecHelpers )
|
98
114
|
config.include( Symphony::SpecHelpers )
|
99
115
|
end
|
@@ -1,5 +1,5 @@
|
|
1
1
|
# -*- ruby -*-
|
2
|
-
#
|
2
|
+
# frozen_string_literal: true
|
3
3
|
# vim: set noet nosta sw=4 ts=4 :
|
4
4
|
|
5
5
|
|
@@ -19,7 +19,7 @@ class Test3Task < Symphony::Task
|
|
19
19
|
end
|
20
20
|
|
21
21
|
|
22
|
-
describe Symphony::Daemon do
|
22
|
+
RSpec.describe Symphony::Daemon do
|
23
23
|
|
24
24
|
before( :all ) do
|
25
25
|
@pids = ( 200..65534 ).cycle
|
@@ -5,12 +5,16 @@ require_relative '../helpers'
|
|
5
5
|
require 'symphony/mixins'
|
6
6
|
|
7
7
|
|
8
|
-
describe Symphony, 'mixins' do
|
8
|
+
RSpec.describe Symphony, 'mixins' do
|
9
9
|
|
10
10
|
describe Symphony::MethodUtilities, 'used to extend a class' do
|
11
11
|
|
12
12
|
let!( :extended_class ) do
|
13
|
-
klass = Class.new
|
13
|
+
klass = Class.new do
|
14
|
+
def initialize
|
15
|
+
@foo = nil
|
16
|
+
end
|
17
|
+
end
|
14
18
|
klass.extend( Symphony::MethodUtilities )
|
15
19
|
klass
|
16
20
|
end
|
data/spec/symphony/queue_spec.rb
CHANGED
data/spec/symphony/task_spec.rb
CHANGED
@@ -4,7 +4,7 @@ require_relative '../helpers'
|
|
4
4
|
|
5
5
|
require 'symphony/task'
|
6
6
|
|
7
|
-
describe Symphony::Task do
|
7
|
+
RSpec.describe Symphony::Task do
|
8
8
|
|
9
9
|
before( :all ) do
|
10
10
|
Symphony::Queue.configure
|
@@ -70,7 +70,7 @@ describe Symphony::Task do
|
|
70
70
|
end
|
71
71
|
end
|
72
72
|
let( :payload ) {{ "the" => "payload" }}
|
73
|
-
let( :serialized_payload ) {
|
73
|
+
let( :serialized_payload ) { JSON.generate(payload) }
|
74
74
|
let( :metadata ) {{ :content_type => 'application/json' }}
|
75
75
|
let( :queue ) do
|
76
76
|
obj = Symphony::Queue.for_task( task_class )
|
data/spec/symphony_spec.rb
CHANGED
data.tar.gz.sig
CHANGED
Binary file
|