taskinator 0.3.16 → 0.4.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 231c6c9f1bdcf8bb1a7fb38c0ebd0c893f61f49051d94ace5714233a207ad651
4
- data.tar.gz: 9c66bf91f8420f3fff69487e095a5c36986409f7249224f03ba0b53fdd427190
3
+ metadata.gz: a5f30cdfcc1ec3f517d2346f5eb27549cf27ed18ab830692e3747fdb1a5244e8
4
+ data.tar.gz: '08299d0e337897c9efcb2080debec16072459d6a2a9fdfb8218c2bc296652a25'
5
5
  SHA512:
6
- metadata.gz: 0e322ccc3214ed171bd75b14b4ebaa7e51c1e1ba33b3f7f292c707059f166566a8b8c08235442d26922b0cd8a8c2affa320af03d069d33b0fce4d9ffe7485e95
7
- data.tar.gz: d16a3220d1be357c77e7a47d3e2c426a99549c3d350979f534a176ec3919444551956d4d41e6b7389e245fe39c1286d7ef60e6f07b1155f3aeae7e9cdce1398b
6
+ metadata.gz: 6d3c829ff6913bfc9c7bd41736a75b43119ebb50337eb666970e6133cbc3ee466291011c72b6213e7182111c9899706c1a241f2b3e4579474a6c1c7513e6c4d6
7
+ data.tar.gz: 82c7058f70249413193d1699b8ad49e300d858d6a2d90f12c63667131399c9e33358342f6d28f36a8fd3f98d4e31c6b5a98dd4735105484e917d8262825243a2
data/.travis.yml CHANGED
@@ -1,15 +1,16 @@
1
+ os: linux
2
+ dist: xenial
1
3
  language: ruby
2
- sudo: false # See http://docs.travis-ci.com/user/migrating-from-legacy
3
4
  cache: bundler
4
5
 
5
6
  services:
6
- - redis-server
7
+ - redis
7
8
 
8
9
  rvm:
9
- - 2.4.10
10
10
  - 2.5.8
11
11
  - 2.6.6
12
12
  - 2.7.2
13
+ - 3.0.0
13
14
 
14
15
  script: 'bundle exec rake spec'
15
16
 
data/CHANGELOG.md CHANGED
@@ -1,3 +1,51 @@
1
+ v0.4.0 - 4 Mar 2021
2
+ ---
3
+ Bug fix `job` tasks which have no arguments to the `perform` method.
4
+ Added support for having `perform` method as a class method.
5
+
6
+ v0.3.16 - 17 Feb 2021
7
+ ---
8
+ Bug fix to deincrement pending counts for sequential tasks.
9
+ Bug fix to allow concurrent tasks to be retried (via Resque) and to complete processes.
10
+
11
+ v0.3.15 - 22 Nov 2018
12
+ ---
13
+ Updated dependencies.
14
+
15
+ v0.3.14 - 13 Jul 2018
16
+ ---
17
+ Updated dependencies.
18
+ Removed gemnasium.
19
+
20
+ v0.3.13 - 23 Sep 2017
21
+ ---
22
+ Updated dependencies.
23
+
24
+ v0.3.12 - 23 Sep 2017
25
+ ---
26
+ Spec fixes.
27
+ Updated dependencies.
28
+
29
+ v0.3.11 - 1 Nov 2016
30
+ ---
31
+ Removed `redis-semaphore` gem and use INCRBY to track pending concurrent tasks instead.
32
+ Added instrumentation using statsd.
33
+ Bug fixes to key expiry logic.
34
+ Refactored process and task state transistions.
35
+
36
+ v0.3.10 - 1 Nov 2016
37
+ ---
38
+ Added support for serializing to XML.
39
+ Improvements to process and task states.
40
+
41
+ v0.3.9 - 12 Sep 2016
42
+ ---
43
+ Added benchmark for redis-mutex.
44
+
45
+ v0.3.7 - 18 Aug 2016
46
+ ---
47
+ Bug fix to `option?` method.
48
+
1
49
  v0.3.6 - 11 Nov 2015
2
50
  ---
3
51
  Added visitor for performing clean up of completed processes/tasks.
data/Gemfile.lock CHANGED
@@ -1,14 +1,13 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- taskinator (0.3.16)
4
+ taskinator (0.4.0)
5
5
  builder (>= 3.2.2)
6
6
  connection_pool (>= 2.2.0)
7
7
  globalid (~> 0.3)
8
8
  json (>= 1.8.2)
9
9
  redis (>= 3.2.1)
10
10
  redis-namespace (>= 1.5.2)
11
- redis-semaphore (>= 0.2.4)
12
11
  statsd-ruby (~> 1.4.0)
13
12
  thwait (~> 0.2)
14
13
 
@@ -44,7 +43,7 @@ GEM
44
43
  concurrent-ruby (~> 1.0)
45
44
  json (2.5.1)
46
45
  method_source (1.0.0)
47
- minitest (5.14.3)
46
+ minitest (5.14.4)
48
47
  mono_logger (1.1.0)
49
48
  multi_json (1.15.0)
50
49
  mustermann (1.1.1)
@@ -62,8 +61,6 @@ GEM
62
61
  redis (4.2.5)
63
62
  redis-namespace (1.8.1)
64
63
  redis (>= 3.0.4)
65
- redis-semaphore (0.3.1)
66
- redis
67
64
  resque (2.0.0)
68
65
  mono_logger (~> 1.0)
69
66
  multi_json (~> 1.0)
@@ -142,4 +139,4 @@ DEPENDENCIES
142
139
  taskinator!
143
140
 
144
141
  BUNDLED WITH
145
- 2.2.11
142
+ 2.2.13
data/lib/taskinator.rb CHANGED
@@ -1,7 +1,6 @@
1
1
  require 'json'
2
2
  require 'yaml'
3
3
  require 'securerandom'
4
- require 'redis-semaphore'
5
4
  require 'benchmark'
6
5
  require 'delegate'
7
6
 
@@ -230,12 +230,12 @@ module Taskinator
230
230
  # NNB: if other job types are required, may need to implement how they get invoked here!
231
231
  # FIXME: possible implement using ActiveJob instead, so it doesn't matter how the worker is implemented
232
232
 
233
- if job.instance_of?(Module)
233
+ if job.respond_to?(:perform)
234
234
  # resque
235
- job.perform(args)
235
+ job.perform(*args)
236
236
  else
237
237
  # delayedjob and sidekiq
238
- job.new.perform(args)
238
+ job.new.perform(*args)
239
239
  end
240
240
 
241
241
  # ASSUMPTION: when the job returns, the task is considered to be complete
@@ -1,3 +1,3 @@
1
1
  module Taskinator
2
- VERSION = "0.3.16"
2
+ VERSION = "0.4.0"
3
3
  end
@@ -334,13 +334,23 @@ describe Taskinator::Task do
334
334
  end
335
335
  end
336
336
 
337
- subject { Taskinator::Task.define_job_task(process, TestJob, {:a => 1, :b => 2}) }
337
+ class TestJobClassNoArgs
338
+ def perform
339
+ end
340
+ end
341
+
342
+ module TestJobModuleNoArgs
343
+ def self.perform
344
+ end
345
+ end
346
+
347
+ subject { Taskinator::Task.define_job_task(process, TestJob, [1, {:a => 1, :b => 2}]) }
338
348
 
339
349
  it_should_behave_like "a task", Taskinator::Task::Job
340
350
 
341
351
  describe ".define_job_task" do
342
352
  it "sets the queue to use" do
343
- task = Taskinator::Task.define_job_task(process, TestJob, {:a => 1, :b => 2}, :queue => :foo)
353
+ task = Taskinator::Task.define_job_task(process, TestJob, [1, {:a => 1, :b => 2}], :queue => :foo)
344
354
  expect(task.queue).to eq(:foo)
345
355
  end
346
356
  end
@@ -367,23 +377,37 @@ describe Taskinator::Task do
367
377
 
368
378
  describe "#start" do
369
379
  it {
370
- task = Taskinator::Task.define_job_task(process, TestJobClass, {:a => 1, :b => 2})
380
+ task = Taskinator::Task.define_job_task(process, TestJobClass, [1, {:a => 1, :b => 2}])
381
+ expect(process).to receive(:task_completed).with(task)
382
+ expect_any_instance_of(TestJobClass).to receive(:perform).with(1, {:a => 1, :b => 2})
383
+ task.start!
384
+ }
385
+
386
+ it {
387
+ task = Taskinator::Task.define_job_task(process, TestJobModule, [2, {:a => 1, :b => 2}])
388
+ expect(process).to receive(:task_completed).with(task)
389
+ expect(TestJobModule).to receive(:perform).with(2, {:a => 1, :b => 2})
390
+ task.start!
391
+ }
392
+
393
+ it {
394
+ task = Taskinator::Task.define_job_task(process, TestJobClassNoArgs, nil)
371
395
  expect(process).to receive(:task_completed).with(task)
372
- expect_any_instance_of(TestJobClass).to receive(:perform).with({:a => 1, :b => 2})
396
+ expect_any_instance_of(TestJobClassNoArgs).to receive(:perform).and_call_original
373
397
  task.start!
374
398
  }
375
399
 
376
400
  it {
377
- task = Taskinator::Task.define_job_task(process, TestJobModule, {:a => 1, :b => 2})
401
+ task = Taskinator::Task.define_job_task(process, TestJobModuleNoArgs, nil)
378
402
  expect(process).to receive(:task_completed).with(task)
379
- expect(TestJobModule).to receive(:perform).with({:a => 1, :b => 2})
403
+ expect(TestJobModuleNoArgs).to receive(:perform).and_call_original
380
404
  task.start!
381
405
  }
382
406
 
383
407
  it "is instrumented" do
384
408
  allow(process).to receive(:task_completed).with(subject)
385
409
 
386
- allow(TestJob).to receive(:perform).with({:a => 1, :b => 2})
410
+ allow(TestJob).to receive(:perform).with(1, {:a => 1, :b => 2})
387
411
 
388
412
  instrumentation_block = SpecSupport::Block.new
389
413
 
data/taskinator.gemspec CHANGED
@@ -23,7 +23,6 @@ Gem::Specification.new do |spec|
23
23
  # core
24
24
  spec.add_dependency 'redis' , '>= 3.2.1'
25
25
  spec.add_dependency 'redis-namespace' , '>= 1.5.2'
26
- spec.add_dependency 'redis-semaphore' , '>= 0.2.4'
27
26
  spec.add_dependency 'connection_pool' , '>= 2.2.0'
28
27
  spec.add_dependency 'json' , '>= 1.8.2'
29
28
  spec.add_dependency 'builder' , '>= 3.2.2'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: taskinator
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.16
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chris Stefano
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-02-17 00:00:00.000000000 Z
11
+ date: 2021-03-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: redis
@@ -38,20 +38,6 @@ dependencies:
38
38
  - - ">="
39
39
  - !ruby/object:Gem::Version
40
40
  version: 1.5.2
41
- - !ruby/object:Gem::Dependency
42
- name: redis-semaphore
43
- requirement: !ruby/object:Gem::Requirement
44
- requirements:
45
- - - ">="
46
- - !ruby/object:Gem::Version
47
- version: 0.2.4
48
- type: :runtime
49
- prerelease: false
50
- version_requirements: !ruby/object:Gem::Requirement
51
- requirements:
52
- - - ">="
53
- - !ruby/object:Gem::Version
54
- version: 0.2.4
55
41
  - !ruby/object:Gem::Dependency
56
42
  name: connection_pool
57
43
  requirement: !ruby/object:Gem::Requirement