tickwork 0.1.0 → 0.9.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/.travis.yml +0 -12
- data/README.md +13 -1
- data/lib/tickwork/manager.rb +3 -0
- data/test/manager_test.rb +15 -0
- data/tickworkwork.gemspec +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4aca4243b33cbafaffd6fd7c70e12e6be3d81712
|
4
|
+
data.tar.gz: 0123d0ea00910ce13404126d037fcdc99e96e5e7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 83369aefb73bfbd687c5455a956aeca132b23cd7aa8c087221070845ecade4629a2ea36d6513d1b6bb2836e9f70cde371dfc6a9198b1fd6cfca4f457437c3c51
|
7
|
+
data.tar.gz: 00b082f6478611419956844efc59ffa488d7ebd826bf7940a565b616373f0048ddc6b1e734a4e8bc383a03e4c11a777be88d31fafe01ff25bbde8dab9e165c9c
|
data/.gitignore
CHANGED
data/.travis.yml
CHANGED
data/README.md
CHANGED
@@ -7,10 +7,16 @@ This started as a stripped down version of [clockwork](https://github.com/tomyka
|
|
7
7
|
|
8
8
|
Tickwork provides a familiar and compatible config file for scheduled jobs, but instead of it being driven by a background process, it relies on regular calls to `Tickwork.run`. `Tickwork.run` efectively ticks the clock forward from the last time it was called scheduling jobs as it goes. By tuning the paramters below, you can call `Tickwork.run` as little or as often as you like.
|
9
9
|
|
10
|
-
Tickwork keeps track of time using a datastore.
|
10
|
+
Tickwork keeps track of time using a datastore. This is compatible with `ActiveSupport::Cache::Store` so should be compatible with most cache stores out there. It is important the cache be distributed (so not `ActiveSupport::Cache::Store`). [AWS_Tickwork](https://github.com/softwaregravy/aws_tickwork) contains an example of an `ActiveRecord` implementation.
|
11
11
|
|
12
12
|
Note that clockwork allowed schedules to be dynamically set via the database. This functionality does not exist in Tickwork.
|
13
13
|
|
14
|
+
Possible Combinations
|
15
|
+
-----------------------
|
16
|
+
|
17
|
+
This was originally built with the idea of using [Cloudwatch Events](https://aws.amazon.com/blogs/aws/new-cloudwatch-events-track-and-respond-to-changes-to-your-aws-resources/) to power time. An implementation doing that is here: [AWS_Tickwork](https://github.com/softwaregravy/aws_tickwork). Another option would be [Heroku Scheduler](https://devcenter.heroku.com/articles/scheduler). I'm sure there are many more options out there.
|
18
|
+
|
19
|
+
|
14
20
|
Quickstart
|
15
21
|
----------
|
16
22
|
|
@@ -19,6 +25,10 @@ Create tick.rb:
|
|
19
25
|
```ruby
|
20
26
|
require 'tickwork'
|
21
27
|
module Tickwork
|
28
|
+
configure do |config|
|
29
|
+
# See DataStore below
|
30
|
+
config[:data_store] = MyDataStore
|
31
|
+
end
|
22
32
|
handler do |job|
|
23
33
|
puts "Running #{job}"
|
24
34
|
end
|
@@ -36,6 +46,8 @@ module Tickwork
|
|
36
46
|
end
|
37
47
|
```
|
38
48
|
|
49
|
+
Note, this needs to be global to access the config whenever you run Tickwork. If you're on rails, this should be an initializer.
|
50
|
+
|
39
51
|
If you need to load your entire environment for your jobs, simply add:
|
40
52
|
|
41
53
|
```ruby
|
data/lib/tickwork/manager.rb
CHANGED
@@ -22,6 +22,9 @@ module Tickwork
|
|
22
22
|
|
23
23
|
def configure
|
24
24
|
yield(config)
|
25
|
+
[:max_threads, :tick_size, :max_ticks, :max_catchup].each do |int_config_key|
|
26
|
+
config[int_config_key] = config[int_config_key].to_i
|
27
|
+
end
|
25
28
|
if config[:sleep_timeout]
|
26
29
|
config[:logger].warn 'INCORRECT USAGE: sleep_timeout is not used'
|
27
30
|
if config[:sleep_timeout] < 1
|
data/test/manager_test.rb
CHANGED
@@ -162,6 +162,21 @@ end
|
|
162
162
|
assert_equal 'superhero', @manager.config[:namespace]
|
163
163
|
end
|
164
164
|
|
165
|
+
it "should be configurable and guard for string numbers" do
|
166
|
+
logger = NullLogger.new
|
167
|
+
@manager.configure do |config|
|
168
|
+
config[:max_threads] = "20"
|
169
|
+
config[:max_ticks] = "21"
|
170
|
+
config[:tick_size] = "59"
|
171
|
+
config[:max_catchup] = "3000"
|
172
|
+
end
|
173
|
+
|
174
|
+
assert_equal 20, @manager.config[:max_threads]
|
175
|
+
assert_equal 21, @manager.config[:max_ticks]
|
176
|
+
assert_equal 59, @manager.config[:tick_size]
|
177
|
+
assert_equal 3000, @manager.config[:max_catchup]
|
178
|
+
end
|
179
|
+
|
165
180
|
it "configuration should have reasonable defaults" do
|
166
181
|
@manager = Tickwork::Manager.new
|
167
182
|
assert @manager.config[:logger].is_a?(Logger)
|
data/tickworkwork.gemspec
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: tickwork
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.9.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- John Hinnegan
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-05-
|
11
|
+
date: 2016-05-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: tzinfo
|