naf 2.0.2 → 2.0.3
Sign up to get free protection for your applications and to get access to all the features.
- data/app/controllers/naf/historical_jobs_controller.rb +20 -17
- data/app/models/process/naf/runner.rb +10 -1
- data/lib/naf/version.rb +1 -1
- data/naf.gemspec +1 -1
- metadata +2 -2
@@ -107,26 +107,29 @@ module Naf
|
|
107
107
|
respond_to do |format|
|
108
108
|
@historical_job = Naf::HistoricalJob.find(params[:id])
|
109
109
|
if @historical_job.update_attributes(params[:historical_job])
|
110
|
-
if params[:historical_job][:request_to_terminate].present?
|
111
|
-
if queued_job = ::Naf::QueuedJob.find_by_id(params[:id])
|
112
|
-
@historical_job.finished_at = Time.zone.now
|
113
|
-
@historical_job.save!
|
114
|
-
queued_job.delete
|
115
|
-
end
|
116
110
|
|
117
|
-
|
118
|
-
|
119
|
-
|
111
|
+
::Naf::HistoricalJob.lock_for_job_queue do
|
112
|
+
if params[:historical_job][:request_to_terminate].present?
|
113
|
+
if queued_job = ::Naf::QueuedJob.find_by_id(params[:id])
|
114
|
+
@historical_job.finished_at = Time.zone.now
|
115
|
+
@historical_job.save!
|
116
|
+
queued_job.delete
|
117
|
+
end
|
118
|
+
|
119
|
+
if running_job = ::Naf::RunningJob.find_by_id(params[:id])
|
120
|
+
running_job.update_attributes(request_to_terminate: true)
|
121
|
+
@historical_job.update_attributes(request_to_terminate: true)
|
122
|
+
end
|
120
123
|
end
|
121
|
-
end
|
122
124
|
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
125
|
+
format.html do
|
126
|
+
redirect_to(@historical_job, notice: "Job '#{@historical_job.command}' was successfully updated.")
|
127
|
+
end
|
128
|
+
format.json do
|
129
|
+
render json: { success: true,
|
130
|
+
title: @historical_job.title,
|
131
|
+
command: @historical_job.command }.to_json
|
132
|
+
end
|
130
133
|
end
|
131
134
|
else
|
132
135
|
format.html do
|
@@ -76,6 +76,7 @@ module Process::Naf
|
|
76
76
|
machine.lock_for_runner_use
|
77
77
|
begin
|
78
78
|
cleanup_old_processes
|
79
|
+
remove_invalid_running_jobs
|
79
80
|
wind_down_runners
|
80
81
|
|
81
82
|
# Create a machine runner, if it doesn't exist
|
@@ -100,6 +101,14 @@ module Process::Naf
|
|
100
101
|
end
|
101
102
|
end
|
102
103
|
|
104
|
+
def remove_invalid_running_jobs
|
105
|
+
::Naf::RunningJob.
|
106
|
+
joins("INNER JOIN #{Naf.schema_name}.historical_jobs AS hj ON hj.id = #{Naf.schema_name}.running_jobs.id").
|
107
|
+
where('finished_at IS NOT NULL AND hj.started_on_machine_id = ?', @machine.id).readonly(false).each do |job|
|
108
|
+
job.delete
|
109
|
+
end
|
110
|
+
end
|
111
|
+
|
103
112
|
def check_gc_configurations
|
104
113
|
unless @disable_gc_modifications
|
105
114
|
# These configuration changes will help forked processes, not the runner
|
@@ -589,7 +598,7 @@ module Process::Naf
|
|
589
598
|
|
590
599
|
def assigned_jobs(record)
|
591
600
|
if record.kind_of? ::Naf::MachineRunnerInvocation
|
592
|
-
return ::Naf::RunningJob.started_on_invocation(record.id).select do |job|
|
601
|
+
return ::Naf::RunningJob.started_on_invocation(record.id).readonly(false).select do |job|
|
593
602
|
is_job_process_alive?(job)
|
594
603
|
end
|
595
604
|
else
|
data/lib/naf/version.rb
CHANGED
data/naf.gemspec
CHANGED
@@ -8,7 +8,7 @@ Gem::Specification.new do |s|
|
|
8
8
|
s.name = "naf"
|
9
9
|
s.version = Naf::VERSION
|
10
10
|
s.license = 'New BSD License'
|
11
|
-
s.date = '2014-01-
|
11
|
+
s.date = '2014-01-07'
|
12
12
|
s.summary = "Creates infrastructure for a customizable and robust Postgres-backed script scheduling/running"
|
13
13
|
s.description = "A cloud based distributed cron, application framework and operations console. Naf works as a distributed script running " +
|
14
14
|
"system that provides scheduling, logging, alarming, machine redundancy, and the ability to set constraint during script execution"
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: naf
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.
|
4
|
+
version: 2.0.3
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -12,7 +12,7 @@ authors:
|
|
12
12
|
autorequire:
|
13
13
|
bindir: bin
|
14
14
|
cert_chain: []
|
15
|
-
date: 2014-01-
|
15
|
+
date: 2014-01-07 00:00:00.000000000 Z
|
16
16
|
dependencies:
|
17
17
|
- !ruby/object:Gem::Dependency
|
18
18
|
name: rails
|