tickwork 0.1.0 → 0.9.0

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 920921d051336381f10e80c3d7241af9d1bd6089
4
- data.tar.gz: ea06aed69b17703630a7dfdca5abaf54b9bdf015
3
+ metadata.gz: 4aca4243b33cbafaffd6fd7c70e12e6be3d81712
4
+ data.tar.gz: 0123d0ea00910ce13404126d037fcdc99e96e5e7
5
5
  SHA512:
6
- metadata.gz: 5098df50b53894be834e88af9a0c303c8a6ea2618a5a8814a373c9f92ecffb4c6e71de097031da046e519c08d9cfb43ef266e82c97c1e203ecdac92133d3dbe3
7
- data.tar.gz: a611528f519bf38cc5e063e107c354138b71094a1d7755b062ea4085e1833a3f010a68d988a263ded0ef22a8fed8cfb09b860881618022077c5e9cf4c7a6ca12
6
+ metadata.gz: 83369aefb73bfbd687c5455a956aeca132b23cd7aa8c087221070845ecade4629a2ea36d6513d1b6bb2836e9f70cde371dfc6a9198b1fd6cfca4f457437c3c51
7
+ data.tar.gz: 00b082f6478611419956844efc59ffa488d7ebd826bf7940a565b616373f0048ddc6b1e734a4e8bc383a03e4c11a777be88d31fafe01ff25bbde8dab9e165c9c
data/.gitignore CHANGED
@@ -5,3 +5,4 @@ Gemfile.lock
5
5
  *.swo
6
6
  *.swp
7
7
  *.gem
8
+ gem
data/.travis.yml CHANGED
@@ -1,13 +1 @@
1
1
  language: ruby
2
- sudo: false
3
- cache: bundler
4
- rvm:
5
- - 1.9.3
6
- - 2.0.0
7
- - 2.1
8
- - 2.2
9
- - jruby-19mode
10
- - # rbx-2.2.7
11
- gemfile:
12
- - gemfiles/activesupport3.gemfile
13
- - gemfiles/activesupport4.gemfile
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. Right now, nothing is supported.
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
@@ -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
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = "tickwork"
3
- s.version = "0.1.0"
3
+ s.version = "0.9.0"
4
4
 
5
5
  s.authors = ["John Hinnegan"]
6
6
  s.license = 'MIT'
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.1.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-10 00:00:00.000000000 Z
11
+ date: 2016-05-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: tzinfo