tasks_scheduler 0.0.10 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/assets/stylesheets/tasks_scheduler.scss +4 -0
- data/app/models/scheduled_task.rb +1 -0
- data/app/models/scheduled_task/checker.rb +13 -6
- data/app/models/scheduled_task/status.rb +1 -0
- data/db/migrate/20180302170138_add_enabled_to_scheduled_tasks.rb +5 -0
- data/lib/tasks_scheduler/version.rb +1 -1
- data/test/dummy/db/schema.rb +4 -3
- metadata +31 -30
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 13e0b12aa070c0f451496117460d094aa1f2eec0
|
4
|
+
data.tar.gz: 2c04617ea9741ea2a06748c67f2fe7678f2db03f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1502c2289657bd173cc132612605e8c3f2bfe66e2651707b032b7116e01d0a2681226cadf6e3580d15618e99f97264e13aab1365cbcaaf65ac839f4bed676446
|
7
|
+
data.tar.gz: 59ed1b051e70340e5df8e26d7f2a4b04281db36c127b9c9ab51cdeee2485a1c8dbc82e12777baea74c557f226b3d99b722ec4ee8deae54a630f1d5b7908c21fd
|
@@ -15,19 +15,25 @@ class ScheduledTask < ActiveRecord::Base
|
|
15
15
|
|
16
16
|
def check_on_pid_present
|
17
17
|
if process_running?
|
18
|
-
|
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
|
data/test/dummy/db/schema.rb
CHANGED
@@ -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:
|
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",
|
21
|
-
t.datetime "updated_at",
|
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
|
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-
|
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.
|
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/
|
194
|
-
- test/
|
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/
|
215
|
-
- test/dummy/
|
216
|
-
- test/dummy/
|
217
|
-
- test/dummy/
|
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
|