perfectsched 0.7.15 → 0.7.16
Sign up to get free protection for your applications and to get access to all the features.
- data/ChangeLog +6 -0
- data/lib/perfectsched/version.rb +1 -1
- metadata +21 -13
- checksums.yaml +0 -15
- data/README.md.html +0 -153
data/ChangeLog
CHANGED
data/lib/perfectsched/version.rb
CHANGED
metadata
CHANGED
@@ -1,18 +1,20 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: perfectsched
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.7.
|
4
|
+
version: 0.7.16
|
5
|
+
prerelease:
|
5
6
|
platform: ruby
|
6
7
|
authors:
|
7
8
|
- Sadayuki Furuhashi
|
8
9
|
autorequire:
|
9
10
|
bindir: bin
|
10
11
|
cert_chain: []
|
11
|
-
date: 2014-
|
12
|
+
date: 2014-10-09 00:00:00.000000000 Z
|
12
13
|
dependencies:
|
13
14
|
- !ruby/object:Gem::Dependency
|
14
15
|
name: cron-spec
|
15
16
|
requirement: !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
16
18
|
requirements:
|
17
19
|
- - <=
|
18
20
|
- !ruby/object:Gem::Version
|
@@ -23,6 +25,7 @@ dependencies:
|
|
23
25
|
type: :runtime
|
24
26
|
prerelease: false
|
25
27
|
version_requirements: !ruby/object:Gem::Requirement
|
28
|
+
none: false
|
26
29
|
requirements:
|
27
30
|
- - <=
|
28
31
|
- !ruby/object:Gem::Version
|
@@ -33,34 +36,39 @@ dependencies:
|
|
33
36
|
- !ruby/object:Gem::Dependency
|
34
37
|
name: sequel
|
35
38
|
requirement: !ruby/object:Gem::Requirement
|
39
|
+
none: false
|
36
40
|
requirements:
|
37
41
|
- - ~>
|
38
42
|
- !ruby/object:Gem::Version
|
39
|
-
version: 3.
|
43
|
+
version: 3.48.0
|
40
44
|
type: :runtime
|
41
45
|
prerelease: false
|
42
46
|
version_requirements: !ruby/object:Gem::Requirement
|
47
|
+
none: false
|
43
48
|
requirements:
|
44
49
|
- - ~>
|
45
50
|
- !ruby/object:Gem::Version
|
46
|
-
version: 3.
|
51
|
+
version: 3.48.0
|
47
52
|
- !ruby/object:Gem::Dependency
|
48
53
|
name: perfectqueue
|
49
54
|
requirement: !ruby/object:Gem::Requirement
|
55
|
+
none: false
|
50
56
|
requirements:
|
51
57
|
- - ~>
|
52
58
|
- !ruby/object:Gem::Version
|
53
|
-
version: 0.7.
|
59
|
+
version: 0.7.31
|
54
60
|
type: :runtime
|
55
61
|
prerelease: false
|
56
62
|
version_requirements: !ruby/object:Gem::Requirement
|
63
|
+
none: false
|
57
64
|
requirements:
|
58
65
|
- - ~>
|
59
66
|
- !ruby/object:Gem::Version
|
60
|
-
version: 0.7.
|
67
|
+
version: 0.7.31
|
61
68
|
- !ruby/object:Gem::Dependency
|
62
69
|
name: tzinfo
|
63
70
|
requirement: !ruby/object:Gem::Requirement
|
71
|
+
none: false
|
64
72
|
requirements:
|
65
73
|
- - ~>
|
66
74
|
- !ruby/object:Gem::Version
|
@@ -68,6 +76,7 @@ dependencies:
|
|
68
76
|
type: :runtime
|
69
77
|
prerelease: false
|
70
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
none: false
|
71
80
|
requirements:
|
72
81
|
- - ~>
|
73
82
|
- !ruby/object:Gem::Version
|
@@ -79,12 +88,8 @@ executables:
|
|
79
88
|
extensions: []
|
80
89
|
extra_rdoc_files:
|
81
90
|
- ChangeLog
|
82
|
-
- README.md.html
|
83
91
|
- README.rdoc
|
84
92
|
files:
|
85
|
-
- ChangeLog
|
86
|
-
- README.md.html
|
87
|
-
- README.rdoc
|
88
93
|
- bin/perfectsched
|
89
94
|
- lib/perfectsched.rb
|
90
95
|
- lib/perfectsched/backend.rb
|
@@ -95,30 +100,33 @@ files:
|
|
95
100
|
- lib/perfectsched/croncalc.rb
|
96
101
|
- lib/perfectsched/engine.rb
|
97
102
|
- lib/perfectsched/version.rb
|
103
|
+
- ChangeLog
|
104
|
+
- README.rdoc
|
98
105
|
- test/backend_test.rb
|
99
106
|
- test/test_helper.rb
|
100
107
|
homepage: https://github.com/treasure-data/perfectsched
|
101
108
|
licenses: []
|
102
|
-
metadata: {}
|
103
109
|
post_install_message:
|
104
110
|
rdoc_options: []
|
105
111
|
require_paths:
|
106
112
|
- lib
|
107
113
|
required_ruby_version: !ruby/object:Gem::Requirement
|
114
|
+
none: false
|
108
115
|
requirements:
|
109
116
|
- - ! '>='
|
110
117
|
- !ruby/object:Gem::Version
|
111
118
|
version: '0'
|
112
119
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
120
|
+
none: false
|
113
121
|
requirements:
|
114
122
|
- - ! '>='
|
115
123
|
- !ruby/object:Gem::Version
|
116
124
|
version: '0'
|
117
125
|
requirements: []
|
118
126
|
rubyforge_project:
|
119
|
-
rubygems_version:
|
127
|
+
rubygems_version: 1.8.24
|
120
128
|
signing_key:
|
121
|
-
specification_version:
|
129
|
+
specification_version: 3
|
122
130
|
summary: Highly available distributed cron built on RDBMS or SimpleDB
|
123
131
|
test_files:
|
124
132
|
- test/backend_test.rb
|
checksums.yaml
DELETED
@@ -1,15 +0,0 @@
|
|
1
|
-
---
|
2
|
-
!binary "U0hBMQ==":
|
3
|
-
metadata.gz: !binary |-
|
4
|
-
NjkxNTY3NTA4Yjg0YTQ1ZmVlNTFkYjE2NDhlNTIyNmFhZjAyODlhNA==
|
5
|
-
data.tar.gz: !binary |-
|
6
|
-
NGZkMGVmMTVhMTQwMDFjYTFmMGE2ZTZmYjRjMzM1YzJiNThmMjZlNg==
|
7
|
-
SHA512:
|
8
|
-
metadata.gz: !binary |-
|
9
|
-
MzFkYWI1MTc5ODllY2ZkMjZlYTg5MGVmOGU1M2ZhMGM3MTQxMWJiYzFhNDJh
|
10
|
-
ZWNjMTBjMzY1MzVkMTM1ZDQyYThmMWUwNTkyYTNlZjRmMGNjOThmNDZiOWFm
|
11
|
-
NmQwMWZkYjg2Zjk0NzU3ZjAzOTcwMGM0ZjBhMWFmOTZiNzVlZjY=
|
12
|
-
data.tar.gz: !binary |-
|
13
|
-
MGZjMzRlNDkzYWZkMmFjMWFkMzRjMWNjNDc0Y2Y0NzY5YTg4ZDQ0OTA2YzYw
|
14
|
-
ZTMyZTRhODliMmM4ODc5YjRiYTNjNDE1MjJhN2EyMzRhNTQ4NWVmODUxMmRi
|
15
|
-
Yjc5NDhiN2ZkZTk4OTYxYWZmMWI2YzllMGY3MmE5YjhkZDFkZDQ=
|
data/README.md.html
DELETED
@@ -1,153 +0,0 @@
|
|
1
|
-
|
2
|
-
<html>
|
3
|
-
<head><title>-</title></head>
|
4
|
-
<body>
|
5
|
-
<h1>PerfectSched</h1>
|
6
|
-
|
7
|
-
<p>PerfectSched is a highly available distributed cron built on top of RDBMS.</p>
|
8
|
-
|
9
|
-
<p>It provides at-least-once semantics; Even if a worker node fails during process a task, the task is retried by another worker.</p>
|
10
|
-
|
11
|
-
<p>PerfectSched also guarantees that only one worker server processes a task if the server is alive.</p>
|
12
|
-
|
13
|
-
<p>All you have to consider is implementing idempotent worker programs. It's recommended to use <a href="https://github.com/treasure-data/perfectqueue">PerfectQueue</a> with PerfectSched.</p>
|
14
|
-
|
15
|
-
<h2>API overview</h2>
|
16
|
-
|
17
|
-
<p>```ruby</p>
|
18
|
-
|
19
|
-
<h1>open a schedule collection</h1>
|
20
|
-
|
21
|
-
<p>PerfectSched.open(config, &block) #=> #<ScheduleCollection></p>
|
22
|
-
|
23
|
-
<h1>add a schedule</h1>
|
24
|
-
|
25
|
-
<p>ScheduleCollection#add(task_id, type, options)</p>
|
26
|
-
|
27
|
-
<h1>poll a scheduled task</h1>
|
28
|
-
|
29
|
-
<h1>(you don't have to use this method directly. see following sections)</h1>
|
30
|
-
|
31
|
-
<p>ScheduleCollection#poll #=> #<Task></p>
|
32
|
-
|
33
|
-
<h1>get data associated with a task</h1>
|
34
|
-
|
35
|
-
<p>Task#data #=> #<Hash></p>
|
36
|
-
|
37
|
-
<h1>finish a task</h1>
|
38
|
-
|
39
|
-
<p>Task#finish!</p>
|
40
|
-
|
41
|
-
<h1>retry a task</h1>
|
42
|
-
|
43
|
-
<p>Task#retry!
|
44
|
-
```</p>
|
45
|
-
|
46
|
-
<p>Example:</p>
|
47
|
-
|
48
|
-
<p>```ruby</p>
|
49
|
-
|
50
|
-
<h1>submit a task</h1>
|
51
|
-
|
52
|
-
<p>PerfectSched.open(config) {|sc|
|
53
|
-
data = {'key'=>"value"}
|
54
|
-
options = {</p>
|
55
|
-
|
56
|
-
<pre><code>:cron => '0 * * * *',
|
57
|
-
:delay => 30,
|
58
|
-
:timezone => 'Asia/Tokyo',
|
59
|
-
:next_time => Time.parse('2013-01-01 00:00:00 +0900').to_i,
|
60
|
-
:data => data,
|
61
|
-
</code></pre>
|
62
|
-
|
63
|
-
<p> }
|
64
|
-
sc.submit("sched-id", "type1", options)
|
65
|
-
}
|
66
|
-
```</p>
|
67
|
-
|
68
|
-
<h2>Writing a worker application</h2>
|
69
|
-
|
70
|
-
<h3>1. Implement PerfectSched::Application::Base</h3>
|
71
|
-
|
72
|
-
<p>```ruby
|
73
|
-
class TestHandler < PerfectSched::Application::Base
|
74
|
-
# implement run method
|
75
|
-
def run</p>
|
76
|
-
|
77
|
-
<pre><code># do something ...
|
78
|
-
puts "acquired task: #{task.inspect}"
|
79
|
-
|
80
|
-
# call task.finish!, task.retry! or task.release!
|
81
|
-
task.finish!
|
82
|
-
</code></pre>
|
83
|
-
|
84
|
-
<p> end
|
85
|
-
end</p>
|
86
|
-
|
87
|
-
<h3>2. Implement PerfectSched::Application::Dispatch</h3>
|
88
|
-
|
89
|
-
<p><code>ruby
|
90
|
-
class Dispatch < PerfectSched::Application::Dispatch
|
91
|
-
# describe routing
|
92
|
-
route "type1" => TestHandler
|
93
|
-
route /^regexp-.*$/ => :TestHandler # String or Regexp => Class or Symbol
|
94
|
-
end
|
95
|
-
</code></p>
|
96
|
-
|
97
|
-
<h3>3. Run the worker</h3>
|
98
|
-
|
99
|
-
<p>In a launcher script or rake file:</p>
|
100
|
-
|
101
|
-
<p>```</p>
|
102
|
-
|
103
|
-
<h1>run PerfectSched::Worker with the dispatcher</h1>
|
104
|
-
|
105
|
-
<p>system('perfectsched run -I. -rapp/schedules/dispatch Dispatch')
|
106
|
-
```</p>
|
107
|
-
|
108
|
-
<p>or:</p>
|
109
|
-
|
110
|
-
<p><code>ruby
|
111
|
-
require 'app/schedules/dispatch'
|
112
|
-
PerfectSched::Worker.run(Dispatch) {
|
113
|
-
# this method is called when the worker process is restarted
|
114
|
-
raw = File.read('config/perfectsched.yml')
|
115
|
-
yml = YAJL.load(raw)
|
116
|
-
yml[ENV['RAILS_ENV'] || 'development']
|
117
|
-
}
|
118
|
-
</code></p>
|
119
|
-
|
120
|
-
<h3>Signal handlers</h3>
|
121
|
-
|
122
|
-
<ul>
|
123
|
-
<li><em>TERM,INT,QUIT:</em> shutdown</li>
|
124
|
-
<li><em>USR1,HUP:</em> restart</li>
|
125
|
-
<li><em>USR2:</em> reopen log files</li>
|
126
|
-
</ul>
|
127
|
-
|
128
|
-
|
129
|
-
<h2>Configuration</h2>
|
130
|
-
|
131
|
-
<ul>
|
132
|
-
<li><em>type:</em> backend type (required; see following sections)</li>
|
133
|
-
<li><em>log:</em> log file path (default: use stderr)</li>
|
134
|
-
<li><em>poll_interval:</em> interval to poll tasks in seconds (default: 1.0 sec)</li>
|
135
|
-
<li><em>timezone:</em> default timezone (default: 'UTC')</li>
|
136
|
-
<li><em>alive_time:</em> duration to continue a heartbeat request (default: 300 sec)</li>
|
137
|
-
<li><em>retry_wait:</em> duration to retry a retried task (default: 300 sec)</li>
|
138
|
-
</ul>
|
139
|
-
|
140
|
-
|
141
|
-
<h2>Backend types</h2>
|
142
|
-
|
143
|
-
<h3>rdb_compat</h3>
|
144
|
-
|
145
|
-
<p>additional configuration:</p>
|
146
|
-
|
147
|
-
<ul>
|
148
|
-
<li><strong>url:</strong> URL to the RDBMS (example: 'mysql://user:password@host:port/database')</li>
|
149
|
-
<li><strong>table:</strong> name of the table to use</li>
|
150
|
-
</ul>
|
151
|
-
|
152
|
-
</body>
|
153
|
-
</html>
|