assistor 0.1.1 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/README.md +1 -4
- data/lib/assistor/abstract_job.rb +0 -4
- data/lib/assistor/assistant.rb +1 -1
- data/lib/assistor/configuration.rb +8 -0
- data/lib/assistor/daemon.rb +4 -0
- data/lib/assistor/version.rb +1 -1
- metadata +21 -37
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 1fa2ddaa11e30636eb624ee437c724f2a1602fdf4951cf386d1039ccc7b4d664
|
4
|
+
data.tar.gz: 52f0e901cb875e920d43e677592f11dd4f20b045f7dd8752b95f5dd20c9a23e4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2c5f78349106336a9716bb07ab1835309ae587b9aef14da0a9bb9c84aabb4183e480a0f667e651d8fa2f3759178573084ae4bad7d1223cc4ea67086cb5b2a77b
|
7
|
+
data.tar.gz: e0d5c02282a5929a2e5e0f89bb09ba1c77b084b6c168dc4b6a0dda723ac0ccee2c8c38d1ea2f44f5b03bd81fe9978bf3be924d645b825962fbec6634f89778e7
|
data/README.md
CHANGED
@@ -48,10 +48,6 @@ class ExampleJob < Assistor::AbstractJob
|
|
48
48
|
def run
|
49
49
|
sleep @i
|
50
50
|
end
|
51
|
-
|
52
|
-
def fail(exception)
|
53
|
-
ExceptionHandler.handle exception
|
54
|
-
end
|
55
51
|
end
|
56
52
|
|
57
53
|
class ExampleQueue < Assistor::AbstractQueue
|
@@ -77,6 +73,7 @@ configuration = Assistor::Configuration.new
|
|
77
73
|
configuration.id = 'example'
|
78
74
|
configuration.size = 3
|
79
75
|
configuration.delay = 0.2
|
76
|
+
configuration.exception_handler = Proc.new { |exception| ExceptionHandler.handle(exception) }_
|
80
77
|
configuration.log_file = File.join(File.expand_path('..', __FILE__), 'example.log')
|
81
78
|
configuration.pid_file = File.join(File.expand_path('..', __FILE__), 'example.pid')
|
82
79
|
|
data/lib/assistor/assistant.rb
CHANGED
@@ -10,5 +10,13 @@ module Assistor
|
|
10
10
|
def pid_file=(file)
|
11
11
|
@pid_file = PidFile.new file
|
12
12
|
end
|
13
|
+
|
14
|
+
def exception_handler(exception_handler)
|
15
|
+
@exception_handler = exception_handler
|
16
|
+
end
|
17
|
+
|
18
|
+
def exception_handler
|
19
|
+
@exception_handler || Proc.new {}
|
20
|
+
end
|
13
21
|
end
|
14
22
|
end
|
data/lib/assistor/daemon.rb
CHANGED
@@ -19,6 +19,7 @@ module Assistor
|
|
19
19
|
end
|
20
20
|
rescue => e
|
21
21
|
log_file.error e
|
22
|
+
@configuration.exception_handler.call(e)
|
22
23
|
end
|
23
24
|
|
24
25
|
private
|
@@ -38,6 +39,7 @@ module Assistor
|
|
38
39
|
exit!(0)
|
39
40
|
rescue => e
|
40
41
|
log_file.error e
|
42
|
+
@configuration.exception_handler.call(e)
|
41
43
|
end
|
42
44
|
|
43
45
|
def stop!
|
@@ -47,6 +49,7 @@ module Assistor
|
|
47
49
|
exit!(1)
|
48
50
|
rescue => e
|
49
51
|
log_file.error e
|
52
|
+
@configuration.exception_handler.call(e)
|
50
53
|
end
|
51
54
|
|
52
55
|
def assist(queue)
|
@@ -60,6 +63,7 @@ module Assistor
|
|
60
63
|
assistant_group.add(assistant)
|
61
64
|
rescue => e
|
62
65
|
log_file.error e
|
66
|
+
@configuration.exception_handler.call(e)
|
63
67
|
end
|
64
68
|
|
65
69
|
def daemonize
|
data/lib/assistor/version.rb
CHANGED
metadata
CHANGED
@@ -1,71 +1,57 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: assistor
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tomasz Kowalewski
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2023-05-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- -
|
17
|
+
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '
|
19
|
+
version: '0'
|
20
20
|
type: :development
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- -
|
24
|
+
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: '
|
26
|
+
version: '0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: rake
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- -
|
31
|
+
- - ">="
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: '
|
33
|
+
version: '0'
|
34
34
|
type: :development
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- -
|
38
|
+
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: '
|
40
|
+
version: '0'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: rspec
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- -
|
45
|
+
- - ">="
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: '
|
47
|
+
version: '0'
|
48
48
|
type: :development
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- -
|
52
|
+
- - ">="
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: '
|
55
|
-
- !ruby/object:Gem::Dependency
|
56
|
-
name: rubocop
|
57
|
-
requirement: !ruby/object:Gem::Requirement
|
58
|
-
requirements:
|
59
|
-
- - ~>
|
60
|
-
- !ruby/object:Gem::Version
|
61
|
-
version: 0.44.1
|
62
|
-
type: :development
|
63
|
-
prerelease: false
|
64
|
-
version_requirements: !ruby/object:Gem::Requirement
|
65
|
-
requirements:
|
66
|
-
- - ~>
|
67
|
-
- !ruby/object:Gem::Version
|
68
|
-
version: 0.44.1
|
54
|
+
version: '0'
|
69
55
|
description: Simple background processing framework for Ruby
|
70
56
|
email:
|
71
57
|
- me@tkowalewski.pl
|
@@ -77,6 +63,7 @@ files:
|
|
77
63
|
- CODE_OF_CONDUCT.md
|
78
64
|
- LICENSE.txt
|
79
65
|
- README.md
|
66
|
+
- lib/assistor.rb
|
80
67
|
- lib/assistor/abstract_job.rb
|
81
68
|
- lib/assistor/abstract_queue.rb
|
82
69
|
- lib/assistor/assistant.rb
|
@@ -86,30 +73,27 @@ files:
|
|
86
73
|
- lib/assistor/log_file.rb
|
87
74
|
- lib/assistor/pid_file.rb
|
88
75
|
- lib/assistor/version.rb
|
89
|
-
- lib/assistor.rb
|
90
76
|
homepage: https://github.com/tkowalewski/assistor
|
91
77
|
licenses:
|
92
78
|
- MIT
|
93
79
|
metadata: {}
|
94
|
-
post_install_message:
|
80
|
+
post_install_message:
|
95
81
|
rdoc_options: []
|
96
82
|
require_paths:
|
97
83
|
- lib
|
98
84
|
required_ruby_version: !ruby/object:Gem::Requirement
|
99
85
|
requirements:
|
100
|
-
- -
|
86
|
+
- - ">="
|
101
87
|
- !ruby/object:Gem::Version
|
102
88
|
version: '0'
|
103
89
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
104
90
|
requirements:
|
105
|
-
- -
|
91
|
+
- - ">="
|
106
92
|
- !ruby/object:Gem::Version
|
107
93
|
version: '0'
|
108
94
|
requirements: []
|
109
|
-
|
110
|
-
|
111
|
-
signing_key:
|
95
|
+
rubygems_version: 3.1.2
|
96
|
+
signing_key:
|
112
97
|
specification_version: 4
|
113
98
|
summary: Simple background processing framework for Ruby
|
114
99
|
test_files: []
|
115
|
-
has_rdoc:
|