tasks_scheduler 0.0.10 → 0.1.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: 63b28c22180672d1d3837ad74877ba3a254b9c25
4
- data.tar.gz: 6ed6a07e3c64af4c3122324c90016589555411e0
3
+ metadata.gz: 13e0b12aa070c0f451496117460d094aa1f2eec0
4
+ data.tar.gz: 2c04617ea9741ea2a06748c67f2fe7678f2db03f
5
5
  SHA512:
6
- metadata.gz: 3e512a427ce0f7dd5190865d51c4f52c3fcc8f875354da52a3b83bec30da0622d8f241ccd1cbd43662f7582667421cd96f574b67d0ae1b23d3474dc5cff0099e
7
- data.tar.gz: feb9cb316900062618f4dc2d846d02c08319781a8b442e06df042981731204609417632fcd54da9cc97cf922c29e7466df8dfa30c87aa674d718c5960c7525d3
6
+ metadata.gz: 1502c2289657bd173cc132612605e8c3f2bfe66e2651707b032b7116e01d0a2681226cadf6e3580d15618e99f97264e13aab1365cbcaaf65ac839f4bed676446
7
+ data.tar.gz: 59ed1b051e70340e5df8e26d7f2a4b04281db36c127b9c9ab51cdeee2485a1c8dbc82e12777baea74c557f226b3d99b722ec4ee8deae54a630f1d5b7908c21fd
@@ -34,6 +34,10 @@
34
34
  td.status_timeout {
35
35
  color: orange;
36
36
  }
37
+
38
+ td.status_disabled {
39
+ color: lightgrey;
40
+ }
37
41
  }
38
42
 
39
43
  .last_run {
@@ -32,6 +32,7 @@ class ScheduledTask < ActiveRecord::Base
32
32
  STATUS_WAITING = 'waiting'
33
33
  STATUS_ABORTED = 'aborted'
34
34
  STATUS_TIMEOUT = 'timeout'
35
+ STATUS_DISABLED = 'disabled'
35
36
 
36
37
  LAST_FAIL_STATUSES = [STATUS_FAILED, STATUS_ABORTED, STATUS_TIMEOUT]
37
38
 
@@ -15,19 +15,25 @@ class ScheduledTask < ActiveRecord::Base
15
15
 
16
16
  def check_on_pid_present
17
17
  if process_running?
18
- if timeout?
19
- check_log('Timeout')
20
- on_end_running(StandardError.new("Timeout (PID: #{pid}. running time: #{running_time})"), STATUS_TIMEOUT)
21
- else
22
- check_log('Already running')
23
- end
18
+ check_on_process_running
24
19
  else
25
20
  check_log('Aborted')
26
21
  on_end_running(Exception.new("Aborted (PID: #{pid} not found)"), STATUS_ABORTED)
27
22
  end
28
23
  end
29
24
 
25
+ def check_on_process_running
26
+ if timeout?
27
+ check_log('Timeout')
28
+ on_end_running(StandardError.new("Timeout (PID: #{pid}. running time: #{running_time})"),
29
+ STATUS_TIMEOUT)
30
+ else
31
+ check_log('Already running')
32
+ end
33
+ end
34
+
30
35
  def check_on_pid_not_present
36
+ return unless enabled?
31
37
  if next_run.present?
32
38
  check_task_with_next_run
33
39
  else
@@ -44,6 +50,7 @@ class ScheduledTask < ActiveRecord::Base
44
50
  check_log("PID: #{pid}")
45
51
  check_log("Running? #{process_running?}")
46
52
  check_log("Last fail status: #{last_fail_status}")
53
+ check_log("Enabled: #{enabled?}")
47
54
  end
48
55
 
49
56
  def check_task_without_next_run
@@ -1,6 +1,7 @@
1
1
  class ScheduledTask < ActiveRecord::Base
2
2
  module Status
3
3
  def status
4
+ return STATUS_DISABLED unless enabled?
4
5
  return STATUS_RUNNING if running?
5
6
  return STATUS_WAITING if waiting?
6
7
  last_fail_status.present? ? last_fail_status : STATUS_FAILED
@@ -0,0 +1,5 @@
1
+ class AddEnabledToScheduledTasks < ActiveRecord::Migration
2
+ def change
3
+ add_column :scheduled_tasks, :enabled, :boolean, null: false, default: true
4
+ end
5
+ end
@@ -1,3 +1,3 @@
1
1
  module TasksScheduler
2
- VERSION = '0.0.10'.freeze
2
+ VERSION = '0.1.0'.freeze
3
3
  end
@@ -11,14 +11,14 @@
11
11
  #
12
12
  # It's strongly recommended that you check this file into your version control system.
13
13
 
14
- ActiveRecord::Schema.define(version: 20180223155025) do
14
+ ActiveRecord::Schema.define(version: 20180302170138) do
15
15
 
16
16
  create_table "scheduled_tasks", force: :cascade do |t|
17
17
  t.string "scheduling"
18
18
  t.string "task"
19
19
  t.datetime "next_run"
20
- t.datetime "created_at", null: false
21
- t.datetime "updated_at", null: false
20
+ t.datetime "created_at", null: false
21
+ t.datetime "updated_at", null: false
22
22
  t.datetime "last_run_start"
23
23
  t.datetime "last_run_successful_start"
24
24
  t.datetime "last_run_successful_end"
@@ -27,6 +27,7 @@ ActiveRecord::Schema.define(version: 20180223155025) do
27
27
  t.integer "pid"
28
28
  t.string "args"
29
29
  t.string "last_fail_status"
30
+ t.boolean "enabled", default: true, null: false
30
31
  end
31
32
 
32
33
  end
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.0.10
4
+ version: 0.1.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: 2018-03-16 00:00:00.000000000 Z
11
+ date: 2018-03-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: active_scaffold
@@ -118,6 +118,7 @@ files:
118
118
  - db/migrate/20161124200712_add_pid_to_scheduled_tasks.rb
119
119
  - db/migrate/20161128163702_add_args_to_scheduled_tasks.rb
120
120
  - db/migrate/20180223155025_add_last_fail_status_to_scheduled_tasks.rb
121
+ - db/migrate/20180302170138_add_enabled_to_scheduled_tasks.rb
121
122
  - exe/tasks_scheduler
122
123
  - exe/tasks_scheduler_run_task
123
124
  - lib/tasks_scheduler.rb
@@ -185,46 +186,46 @@ required_rubygems_version: !ruby/object:Gem::Requirement
185
186
  version: '0'
186
187
  requirements: []
187
188
  rubyforge_project:
188
- rubygems_version: 2.6.12
189
+ rubygems_version: 2.6.14
189
190
  signing_key:
190
191
  specification_version: 4
191
192
  summary: Scheduler for Rake tasks.
192
193
  test_files:
193
- - test/dummy/Rakefile
194
- - test/dummy/README.rdoc
194
+ - test/fixtures/scheduled_tasks.yml
195
+ - test/models/scheduled_task_test.rb
195
196
  - test/dummy/config.ru
197
+ - test/dummy/README.rdoc
198
+ - test/dummy/db/schema.rb
199
+ - test/dummy/app/views/layouts/application.html.erb
200
+ - test/dummy/app/assets/stylesheets/application.css
201
+ - test/dummy/app/assets/javascripts/application.js
202
+ - test/dummy/app/helpers/application_helper.rb
203
+ - test/dummy/app/controllers/application_controller.rb
204
+ - test/dummy/bin/bundle
205
+ - test/dummy/bin/rails
206
+ - test/dummy/bin/setup
207
+ - test/dummy/bin/rake
208
+ - test/dummy/Rakefile
209
+ - test/dummy/config/environments/production.rb
210
+ - test/dummy/config/environments/test.rb
211
+ - test/dummy/config/environments/development.rb
212
+ - test/dummy/config/application.rb
196
213
  - test/dummy/config/boot.rb
197
- - test/dummy/config/database.yml
198
- - test/dummy/config/secrets.yml
199
214
  - test/dummy/config/locales/en.yml
200
- - test/dummy/config/application.rb
201
- - test/dummy/config/environments/development.rb
202
- - test/dummy/config/environments/test.rb
203
- - test/dummy/config/environments/production.rb
204
- - test/dummy/config/environment.rb
205
- - test/dummy/config/routes.rb
206
- - test/dummy/config/initializers/assets.rb
207
- - test/dummy/config/initializers/cookies_serializer.rb
208
- - test/dummy/config/initializers/inflections.rb
209
215
  - test/dummy/config/initializers/session_store.rb
210
- - test/dummy/config/initializers/wrap_parameters.rb
211
216
  - test/dummy/config/initializers/filter_parameter_logging.rb
217
+ - test/dummy/config/initializers/wrap_parameters.rb
212
218
  - test/dummy/config/initializers/backtrace_silencers.rb
219
+ - test/dummy/config/initializers/inflections.rb
220
+ - test/dummy/config/initializers/assets.rb
221
+ - test/dummy/config/initializers/cookies_serializer.rb
213
222
  - test/dummy/config/initializers/mime_types.rb
214
- - test/dummy/db/schema.rb
215
- - test/dummy/app/views/layouts/application.html.erb
216
- - test/dummy/app/controllers/application_controller.rb
217
- - test/dummy/app/helpers/application_helper.rb
218
- - test/dummy/app/assets/stylesheets/application.css
219
- - test/dummy/app/assets/javascripts/application.js
223
+ - test/dummy/config/secrets.yml
224
+ - test/dummy/config/database.yml
225
+ - test/dummy/config/routes.rb
226
+ - test/dummy/config/environment.rb
220
227
  - test/dummy/public/422.html
221
- - test/dummy/public/404.html
222
228
  - test/dummy/public/favicon.ico
229
+ - test/dummy/public/404.html
223
230
  - test/dummy/public/500.html
224
- - test/dummy/bin/bundle
225
- - test/dummy/bin/setup
226
- - test/dummy/bin/rails
227
- - test/dummy/bin/rake
228
231
  - test/test_helper.rb
229
- - test/fixtures/scheduled_tasks.yml
230
- - test/models/scheduled_task_test.rb