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: 9a16067c62acba647e2e5d6b0ba72aefd8e394766242c7aa7222cdc26efa515d
4
- data.tar.gz: 15605017849c697fe146a8ac1ad69981846c5ebb1aa4b54fc8d0695d555f498c
3
+ metadata.gz: 599df8db33d832f04a2ad1a0581c7775fbd17f345da397e6b2e6e14090dfe9d1
4
+ data.tar.gz: f20e6101384683f6d398ef55603f2a1d47d1e79dbf111237d68b2bfcc426292c
5
5
  SHA512:
6
- metadata.gz: f850e1b47685482e850d93b61a49339fae6f508f25b042e960d8da8f9fb78f50b3d46f84acf8049db43b0a675de91485335f3f04df3575b9345f6fb58a652be0
7
- data.tar.gz: d0d33e8ba43ca019a9f4ec70aeb614cfd53c3693f1f5b86c4cf705ef69a62e98ec9d90e11ec7654fc5573e8c61fbd2e943fc1571ec66d9877133823e7ff97022
6
+ metadata.gz: ca786519acd5d3925cc521ffed0f3d61471d409abefe94b70b32002951ce27d51cc63435567b2b820d7be7315265f7d7a847723ba721835246531fb391474539
7
+ data.tar.gz: 6e0e915ebd3b41d75499899b3155b33e71f34ad08fe80f03f30dc03dc75ead448acbd34dc71c6eb8ab38c8e9f49fd1c0f95c8922c4c76afb6ea9f3a30847368c
@@ -39,6 +39,10 @@
39
39
  td.status_disabled {
40
40
  color: lightgrey;
41
41
  }
42
+
43
+ td.status_task_not_found {
44
+ color: violet;
45
+ }
42
46
  }
43
47
 
44
48
  .last_run {
@@ -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
- STATUS_RUNNING = 'running'
33
- STATUS_FAILED = 'failed'
34
- STATUS_WAITING = 'waiting'
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
- check_log("Task does not exist: #{task}")
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
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module TasksScheduler
4
- VERSION = '0.4.2'
4
+ VERSION = '0.5.0'
5
5
  end
@@ -2,3 +2,5 @@ test_scheduling:
2
2
  scheduling: 0 0 * * *
3
3
  task: test
4
4
  next_run: 2016-11-22 09:38:28
5
+ created_at: 2016-11-20 00:00:00
6
+ updated_at: 2016-11-20 00:00:00
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.2
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-07-26 00:00:00.000000000 Z
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.6
264
+ rubygems_version: 3.0.8
251
265
  signing_key:
252
266
  specification_version: 4
253
267
  summary: Scheduler for Rake tasks.