tasks_scheduler 0.4.2 → 0.5.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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 599df8db33d832f04a2ad1a0581c7775fbd17f345da397e6b2e6e14090dfe9d1
|
4
|
+
data.tar.gz: f20e6101384683f6d398ef55603f2a1d47d1e79dbf111237d68b2bfcc426292c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ca786519acd5d3925cc521ffed0f3d61471d409abefe94b70b32002951ce27d51cc63435567b2b820d7be7315265f7d7a847723ba721835246531fb391474539
|
7
|
+
data.tar.gz: 6e0e915ebd3b41d75499899b3155b33e71f34ad08fe80f03f30dc03dc75ead448acbd34dc71c6eb8ab38c8e9f49fd1c0f95c8922c4c76afb6ea9f3a30847368c
|
@@ -1,5 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
+
require 'eac_ruby_utils/core_ext'
|
3
4
|
require 'rake'
|
4
5
|
|
5
6
|
class ScheduledTask < ActiveRecord::Base
|
@@ -29,14 +30,11 @@ class ScheduledTask < ActiveRecord::Base
|
|
29
30
|
end
|
30
31
|
end
|
31
32
|
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
STATUS_ABORTED = 'aborted'
|
36
|
-
STATUS_TIMEOUT = 'timeout'
|
37
|
-
STATUS_DISABLED = 'disabled'
|
33
|
+
enable_listable
|
34
|
+
lists.add_string :status, 'aborted', 'disabled', 'failed', 'running', 'task_not_found', 'timeout',
|
35
|
+
'waiting'
|
38
36
|
|
39
|
-
LAST_FAIL_STATUSES = [STATUS_FAILED, STATUS_ABORTED, STATUS_TIMEOUT].freeze
|
37
|
+
LAST_FAIL_STATUSES = [STATUS_FAILED, STATUS_ABORTED, STATUS_TASK_NOT_FOUND, STATUS_TIMEOUT].freeze
|
40
38
|
|
41
39
|
validates :scheduling, presence: true, 'tasks_scheduler/cron_scheduling': true
|
42
40
|
validates :task, presence: true
|
@@ -45,6 +45,12 @@ class ScheduledTask < ActiveRecord::Base
|
|
45
45
|
end
|
46
46
|
end
|
47
47
|
|
48
|
+
def check_on_task_not_exist
|
49
|
+
message = "Task does not exist: #{task}"
|
50
|
+
check_log(message)
|
51
|
+
on_end_running(::StandardError.new(message), STATUS_TASK_NOT_FOUND)
|
52
|
+
end
|
53
|
+
|
48
54
|
def check_log(message, method = :info)
|
49
55
|
Rails.logger.send(method, "TASK_CHECK(#{id}): #{message}")
|
50
56
|
end
|
@@ -65,7 +71,7 @@ class ScheduledTask < ActiveRecord::Base
|
|
65
71
|
|
66
72
|
def check_task_with_next_run
|
67
73
|
if !task_exist?
|
68
|
-
|
74
|
+
check_on_task_not_exist
|
69
75
|
elsif next_run < Time.zone.now
|
70
76
|
check_log('Next run reached. Running...')
|
71
77
|
spawn_task
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: tasks_scheduler
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Eduardo H. Bogoni
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-08-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: active_scaffold
|
@@ -58,6 +58,20 @@ dependencies:
|
|
58
58
|
- - ">="
|
59
59
|
- !ruby/object:Gem::Version
|
60
60
|
version: 0.4.1
|
61
|
+
- !ruby/object:Gem::Dependency
|
62
|
+
name: eac_ruby_utils
|
63
|
+
requirement: !ruby/object:Gem::Requirement
|
64
|
+
requirements:
|
65
|
+
- - "~>"
|
66
|
+
- !ruby/object:Gem::Version
|
67
|
+
version: '0.43'
|
68
|
+
type: :runtime
|
69
|
+
prerelease: false
|
70
|
+
version_requirements: !ruby/object:Gem::Requirement
|
71
|
+
requirements:
|
72
|
+
- - "~>"
|
73
|
+
- !ruby/object:Gem::Version
|
74
|
+
version: '0.43'
|
61
75
|
- !ruby/object:Gem::Dependency
|
62
76
|
name: js-routes
|
63
77
|
requirement: !ruby/object:Gem::Requirement
|
@@ -228,7 +242,7 @@ files:
|
|
228
242
|
- test/fixtures/scheduled_tasks.yml
|
229
243
|
- test/models/scheduled_task_test.rb
|
230
244
|
- test/test_helper.rb
|
231
|
-
homepage:
|
245
|
+
homepage: https://github.com/esquilo-azul/tasks_scheduler
|
232
246
|
licenses:
|
233
247
|
- MIT
|
234
248
|
metadata: {}
|
@@ -247,7 +261,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
247
261
|
- !ruby/object:Gem::Version
|
248
262
|
version: '0'
|
249
263
|
requirements: []
|
250
|
-
rubygems_version: 3.0.
|
264
|
+
rubygems_version: 3.0.8
|
251
265
|
signing_key:
|
252
266
|
specification_version: 4
|
253
267
|
summary: Scheduler for Rake tasks.
|