rest-ftp-daemon 0.306.4 → 0.400.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 +4 -4
- data/.rubocop.yml +1 -1
- data/Gemfile.lock +3 -3
- data/config.ru +5 -11
- data/lib/rest-ftp-daemon/api/dashboard.rb +2 -2
- data/lib/rest-ftp-daemon/api/debug.rb +1 -1
- data/lib/rest-ftp-daemon/api/jobs.rb +5 -5
- data/lib/rest-ftp-daemon/api/root.rb +0 -11
- data/lib/rest-ftp-daemon/api/status.rb +3 -13
- data/lib/rest-ftp-daemon/counters.rb +17 -8
- data/lib/rest-ftp-daemon/exceptions.rb +0 -1
- data/lib/rest-ftp-daemon/helpers/views.rb +18 -0
- data/lib/rest-ftp-daemon/job.rb +4 -4
- data/lib/rest-ftp-daemon/job_queue.rb +8 -5
- data/lib/rest-ftp-daemon/metrics.rb +5 -15
- data/lib/rest-ftp-daemon/static/images/{logo_newrelic.png → feature_newrelic.png} +0 -0
- data/lib/rest-ftp-daemon/static/images/{reload.png → feature_reload.png} +0 -0
- data/lib/rest-ftp-daemon/views/dashboard_counters.haml +1 -1
- data/lib/rest-ftp-daemon/views/dashboard_footer.haml +7 -11
- data/lib/rest-ftp-daemon/views/dashboard_header.haml +2 -2
- data/lib/rest-ftp-daemon/views/dashboard_jobs.haml +2 -2
- data/lib/rest-ftp-daemon/views/dashboard_rates.haml +1 -1
- data/lib/rest-ftp-daemon/views/dashboard_workers.haml +2 -5
- data/lib/rest-ftp-daemon/worker_pool.rb +6 -4
- data/lib/rest-ftp-daemon/workers/conchita.rb +3 -3
- data/lib/rest-ftp-daemon/workers/reporter.rb +0 -2
- data/lib/rest-ftp-daemon/workers/transfer.rb +3 -3
- data/rest-ftp-daemon.gemspec +3 -3
- metadata +7 -9
- data/lib/rest-ftp-daemon/static/images/logo_newrelic.fw.png +0 -0
- data/lib/rest-ftp-daemon/static/images/logo_newrelic_full.png +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0ddc0fb0b76fb6590512af92bcff70b63b03d770
|
4
|
+
data.tar.gz: e43a27f7cc877d49bc965493aedd7a97cad1ff3a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0b39316f2dc7892f5b77fb27a6e7f9b46df8dbb43be7382218ca25d49681114be8d4e5b99ef8e59e341d18da62302322b1431bb789a8dbc11b15bdbdf241f53e
|
7
|
+
data.tar.gz: b2a2e0a9c4f1a1737ce42e8e767c8ae3ffa19dfa30e12b63ebde9fd9492aa4f835436ed797c2fd93557392f5122a0f6a62255da738bd759faf57efa34ea9515a
|
data/.rubocop.yml
CHANGED
@@ -412,7 +412,7 @@ Style/FormatString:
|
|
412
412
|
|
413
413
|
# Built-in global variables are allowed by default.
|
414
414
|
Style/GlobalVars:
|
415
|
-
AllowedVariables: ["$
|
415
|
+
AllowedVariables: ["$pool"]
|
416
416
|
|
417
417
|
# `MinBodyLength` defines the number of lines of the a body of an if / unless
|
418
418
|
# needs to have to trigger this cop
|
data/Gemfile.lock
CHANGED
@@ -1,10 +1,10 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
rest-ftp-daemon (0.
|
4
|
+
rest-ftp-daemon (0.400.0)
|
5
5
|
activesupport (~> 4.2)
|
6
6
|
api-auth
|
7
|
-
bmc-daemon-lib (~> 0.3.
|
7
|
+
bmc-daemon-lib (~> 0.3.3)
|
8
8
|
double-bag-ftps
|
9
9
|
facter
|
10
10
|
get_process_mem
|
@@ -38,7 +38,7 @@ GEM
|
|
38
38
|
descendants_tracker (~> 0.0.4)
|
39
39
|
ice_nine (~> 0.11.0)
|
40
40
|
thread_safe (~> 0.3, >= 0.3.1)
|
41
|
-
bmc-daemon-lib (0.3.
|
41
|
+
bmc-daemon-lib (0.3.3)
|
42
42
|
chamber (~> 2.9)
|
43
43
|
builder (3.2.2)
|
44
44
|
chamber (2.9.0)
|
data/config.ru
CHANGED
@@ -4,16 +4,6 @@ load_path_libs = File.expand_path "lib", File.dirname(__FILE__)
|
|
4
4
|
$LOAD_PATH.unshift(load_path_libs) unless $LOAD_PATH.include?(load_path_libs)
|
5
5
|
require "rest-ftp-daemon"
|
6
6
|
|
7
|
-
# Create global queue
|
8
|
-
$queue = RestFtpDaemon::JobQueue.new
|
9
|
-
|
10
|
-
# Create global counters
|
11
|
-
$counters = RestFtpDaemon::Counters.new
|
12
|
-
|
13
|
-
# Initialize workers
|
14
|
-
$pool = RestFtpDaemon::WorkerPool.new
|
15
|
-
$pool.start!
|
16
|
-
|
17
7
|
# Rack authent
|
18
8
|
unless Conf[:adminpwd].nil?
|
19
9
|
use Rack::Auth::Basic, "Restricted Area" do |username, password|
|
@@ -30,5 +20,9 @@ unless Conf.app_env == "production"
|
|
30
20
|
# use Rack::MiniProfiler
|
31
21
|
end
|
32
22
|
|
33
|
-
|
23
|
+
|
24
|
+
# Initialize workers
|
25
|
+
RestFtpDaemon::WorkerPool.instance.start_em_all
|
26
|
+
|
27
|
+
# Launch the API
|
34
28
|
run RestFtpDaemon::API::Root
|
@@ -33,11 +33,11 @@ module RestFtpDaemon
|
|
33
33
|
@page = params["page"].to_i
|
34
34
|
|
35
35
|
# Get jobs for this view, order jobs by their weights
|
36
|
-
jobs_with_status =
|
36
|
+
jobs_with_status = RestFtpDaemon::JobQueue.instance.jobs_with_status(filter).reverse
|
37
37
|
|
38
38
|
# Provide queue only if no filtering set
|
39
39
|
if filter.empty?
|
40
|
-
@jobs_queued =
|
40
|
+
@jobs_queued = RestFtpDaemon::JobQueue.instance.jobs_queued
|
41
41
|
else
|
42
42
|
@jobs_queued = []
|
43
43
|
end
|
@@ -13,7 +13,7 @@ module RestFtpDaemon
|
|
13
13
|
begin
|
14
14
|
# Get job to display
|
15
15
|
raise RestFtpDaemon::JobNotFound if params[:id].nil?
|
16
|
-
job =
|
16
|
+
job = RestFtpDaemon::JobQueue.instance.find_by_id(params[:id]) || RestFtpDaemon::JobQueue.instance.find_by_id(params[:id], true)
|
17
17
|
raise RestFtpDaemon::JobNotFound if job.nil?
|
18
18
|
|
19
19
|
rescue RestFtpDaemon::JobNotFound => exception
|
@@ -35,7 +35,7 @@ module RestFtpDaemon
|
|
35
35
|
get "/" do
|
36
36
|
begin
|
37
37
|
# Get jobs to display
|
38
|
-
jobs =
|
38
|
+
jobs = RestFtpDaemon::JobQueue.instance.jobs
|
39
39
|
|
40
40
|
rescue StandardError => exception
|
41
41
|
log_error "Exception: #{exception.message}"
|
@@ -73,14 +73,14 @@ module RestFtpDaemon
|
|
73
73
|
# log_debug params.to_json
|
74
74
|
begin
|
75
75
|
# Create a new job
|
76
|
-
job_id =
|
76
|
+
job_id = RestFtpDaemon::JobQueue.instance.generate_id
|
77
77
|
job = Job.new(job_id, params)
|
78
78
|
|
79
79
|
# And push it to the queue
|
80
|
-
|
80
|
+
RestFtpDaemon::JobQueue.instance.push job
|
81
81
|
|
82
82
|
# Increment a counter
|
83
|
-
|
83
|
+
RestFtpDaemon::Counters.instance.increment :jobs, :received
|
84
84
|
|
85
85
|
rescue JSON::ParserError => exception
|
86
86
|
log_error "JSON::ParserError: #{exception.message}"
|
@@ -44,19 +44,8 @@ module RestFtpDaemon
|
|
44
44
|
### INITIALIZATION
|
45
45
|
def initialize
|
46
46
|
super
|
47
|
-
|
48
|
-
# Check that Queue and Pool are available
|
49
|
-
unless $pool.is_a? RestFtpDaemon::WorkerPool
|
50
|
-
log_error "Metrics.sample: invalid WorkerPool"
|
51
|
-
raise RestFtpDaemon::MissingPool
|
52
|
-
end
|
53
|
-
unless $queue.is_a? RestFtpDaemon::JobQueue
|
54
|
-
log_error "Metrics.sample: invalid JobQueue"
|
55
|
-
raise RestFtpDaemon::MissingQueue
|
56
|
-
end
|
57
47
|
end
|
58
48
|
|
59
|
-
|
60
49
|
### ENDPOINTS
|
61
50
|
get "/" do
|
62
51
|
redirect dashboard_url()
|
@@ -10,18 +10,8 @@ module RestFtpDaemon
|
|
10
10
|
get "/" do
|
11
11
|
status 200
|
12
12
|
|
13
|
-
# Check that Queue and Pool are available
|
14
|
-
unless true
|
15
|
-
log_error "Status API: invalid WorkerPool"
|
16
|
-
return status 501
|
17
|
-
end
|
18
|
-
unless $queue.is_a? RestFtpDaemon::JobQueue
|
19
|
-
log_error "Status API: invalid JobQueue"
|
20
|
-
return status 501
|
21
|
-
end
|
22
|
-
|
23
13
|
# Get counters
|
24
|
-
counters =
|
14
|
+
counters = RestFtpDaemon::Counters.instance.stats
|
25
15
|
|
26
16
|
# Amend counters with legacy attributes
|
27
17
|
if counters[:jobs].is_a? Hash
|
@@ -38,13 +28,13 @@ module RestFtpDaemon
|
|
38
28
|
version: Conf.app_ver,
|
39
29
|
started: Conf.app_started,
|
40
30
|
hostname: `hostname`.to_s.chomp,
|
41
|
-
jobs_count:
|
31
|
+
jobs_count: RestFtpDaemon::JobQueue.instance.jobs_count,
|
42
32
|
|
43
33
|
metrics: Metrics.sample,
|
44
34
|
|
45
35
|
counters: counters,
|
46
36
|
|
47
|
-
workers:
|
37
|
+
workers: RestFtpDaemon::WorkerPool.instance.worker_variables,
|
48
38
|
|
49
39
|
}
|
50
40
|
end
|
@@ -1,31 +1,36 @@
|
|
1
|
-
|
1
|
+
require 'singleton'
|
2
2
|
|
3
|
+
# Queue that stores all the Jobs waiting to be processed or fully processed
|
3
4
|
module RestFtpDaemon
|
4
5
|
class Counters
|
5
|
-
|
6
|
-
# Class options
|
7
|
-
attr_reader :stats
|
6
|
+
include Singleton
|
8
7
|
|
9
8
|
def initialize
|
9
|
+
# Initialize values
|
10
10
|
@stats = {}
|
11
|
-
|
11
|
+
|
12
|
+
# Create mutex
|
13
|
+
@mutex = Mutex.new
|
14
|
+
|
15
|
+
|
16
|
+
set :system, :started_at, Time.now
|
12
17
|
end
|
13
18
|
|
14
19
|
def set group, name, value
|
15
|
-
@
|
20
|
+
@mutex.synchronize do
|
16
21
|
@stats[group] ||= {}
|
17
22
|
@stats[group][name] = value
|
18
23
|
end
|
19
24
|
end
|
20
25
|
|
21
26
|
def get group, name
|
22
|
-
@
|
27
|
+
@mutex.synchronize do
|
23
28
|
@stats[group][name] if @stats[group].is_a? Hash
|
24
29
|
end
|
25
30
|
end
|
26
31
|
|
27
32
|
def add group, name, value
|
28
|
-
@
|
33
|
+
@mutex.synchronize do
|
29
34
|
@stats[group] ||= {}
|
30
35
|
@stats[group][name] ||= 0
|
31
36
|
@stats[group][name] += value
|
@@ -36,5 +41,9 @@ module RestFtpDaemon
|
|
36
41
|
add group, name, 1
|
37
42
|
end
|
38
43
|
|
44
|
+
def stats
|
45
|
+
return @stats.dup
|
46
|
+
end
|
47
|
+
|
39
48
|
end
|
40
49
|
end
|
@@ -1,6 +1,24 @@
|
|
1
1
|
module RestFtpDaemon
|
2
2
|
module ViewsHelper
|
3
3
|
|
4
|
+
def dashboard_feature name, enabled, message_on = "enabled", message_of = "disabled"
|
5
|
+
# Build classes
|
6
|
+
class_status = enabled ? 'enabled' : 'disabled'
|
7
|
+
classes = "btn btn-default feature-#{class_status}"
|
8
|
+
|
9
|
+
# Build title
|
10
|
+
title_status = enabled ? message_on : message_of
|
11
|
+
title = "#{name}: #{title_status}"
|
12
|
+
|
13
|
+
return sprintf(
|
14
|
+
'<div class="%s" title="%s"><img src="/images/feature_%s.png" height="14" alt="%s"/></div>',
|
15
|
+
classes,
|
16
|
+
title,
|
17
|
+
name,
|
18
|
+
title
|
19
|
+
)
|
20
|
+
end
|
21
|
+
|
4
22
|
def dashboard_job_url job
|
5
23
|
"#{MOUNT_JOBS}/#{job.id}" if job.respond_to? :id
|
6
24
|
end
|
data/lib/rest-ftp-daemon/job.rb
CHANGED
@@ -491,8 +491,8 @@ module RestFtpDaemon
|
|
491
491
|
@finished_at = Time.now
|
492
492
|
|
493
493
|
# Update counters
|
494
|
-
|
495
|
-
|
494
|
+
RestFtpDaemon::Counters.instance.increment :jobs, :finished
|
495
|
+
RestFtpDaemon::Counters.instance.add :data, :transferred, @transfer_total
|
496
496
|
end
|
497
497
|
|
498
498
|
def remote_push source, target
|
@@ -658,8 +658,8 @@ module RestFtpDaemon
|
|
658
658
|
end
|
659
659
|
|
660
660
|
# Increment counter for this error
|
661
|
-
|
662
|
-
|
661
|
+
RestFtpDaemon::Counters.instance.increment :errors, error
|
662
|
+
RestFtpDaemon::Counters.instance.increment :jobs, :failed
|
663
663
|
|
664
664
|
# Prepare notification if signal given
|
665
665
|
return unless event
|
@@ -1,7 +1,10 @@
|
|
1
|
-
|
1
|
+
require 'singleton'
|
2
2
|
|
3
|
-
|
3
|
+
# Queue that stores all the Jobs waiting to be processed or fully processed
|
4
|
+
module RestFtpDaemon
|
4
5
|
class JobQueue
|
6
|
+
include Singleton
|
7
|
+
|
5
8
|
include BmcDaemonLib::LoggerHelper
|
6
9
|
include ::NewRelic::Agent::Instrumentation::ControllerInstrumentation
|
7
10
|
include CommonHelpers
|
@@ -11,23 +14,23 @@ module RestFtpDaemon
|
|
11
14
|
attr_reader :jobs
|
12
15
|
|
13
16
|
def initialize
|
14
|
-
#
|
17
|
+
# Initialize values
|
15
18
|
@queues = {}
|
16
19
|
@waitings = {}
|
17
20
|
@jobs = []
|
21
|
+
@last_id = 0
|
18
22
|
|
19
23
|
@queues.taint # enable tainted communication
|
20
24
|
@waitings.taint
|
21
25
|
taint
|
22
26
|
|
23
|
-
#
|
27
|
+
# Create mutex
|
24
28
|
@mutex = Mutex.new
|
25
29
|
|
26
30
|
# Logger
|
27
31
|
@logger = BmcDaemonLib::LoggerPool.instance.get :queue
|
28
32
|
|
29
33
|
# Identifiers generator
|
30
|
-
@last_id = 0
|
31
34
|
@prefix = identifier JOB_IDENT_LEN
|
32
35
|
log_info "JobQueue initialized (prefix: #{@prefix})"
|
33
36
|
end
|
@@ -2,10 +2,6 @@ module RestFtpDaemon
|
|
2
2
|
class Metrics
|
3
3
|
|
4
4
|
def self.sample
|
5
|
-
# Check validity of globals
|
6
|
-
return unless $pool.is_a? RestFtpDaemon::WorkerPool
|
7
|
-
return unless $queue.is_a? RestFtpDaemon::JobQueue
|
8
|
-
|
9
5
|
# Prepare external deps
|
10
6
|
mem = GetProcessMem.new
|
11
7
|
|
@@ -16,10 +12,10 @@ module RestFtpDaemon
|
|
16
12
|
memory: mem.bytes.to_i,
|
17
13
|
threads: Thread.list.count,
|
18
14
|
},
|
19
|
-
jobs_by_status:
|
20
|
-
rate_by_pool:
|
21
|
-
rate_by_targethost:
|
22
|
-
queued_by_pool:
|
15
|
+
jobs_by_status: RestFtpDaemon::JobQueue.instance.jobs_by_status,
|
16
|
+
rate_by_pool: RestFtpDaemon::JobQueue.instance.rate_by(:pool),
|
17
|
+
rate_by_targethost: RestFtpDaemon::JobQueue.instance.rate_by(:targethost),
|
18
|
+
queued_by_pool: RestFtpDaemon::JobQueue.instance.queued_by_pool,
|
23
19
|
workers_by_status: self.workers_count_by_status,
|
24
20
|
}
|
25
21
|
end
|
@@ -31,13 +27,7 @@ module RestFtpDaemon
|
|
31
27
|
# Init
|
32
28
|
counts = {}
|
33
29
|
|
34
|
-
|
35
|
-
unless $pool.is_a? RestFtpDaemon::WorkerPool
|
36
|
-
log_error "Metrics.workers_count_by_status: invalid WorkerPool"
|
37
|
-
return counts
|
38
|
-
end
|
39
|
-
|
40
|
-
$pool.worker_variables.group_by do |wid, vars|
|
30
|
+
RestFtpDaemon::WorkerPool.instance.worker_variables.group_by do |wid, vars|
|
41
31
|
vars[:status]
|
42
32
|
end.each do |status, workers|
|
43
33
|
counts[status] = workers.count
|
File without changes
|
File without changes
|
@@ -1,7 +1,5 @@
|
|
1
1
|
-# coding: utf-8
|
2
2
|
- info_procs = (Facter.value :processorcount).to_i
|
3
|
-
- newrelic_class = Conf.newrelic_enabled? ? 'feature-enabled' : 'feature-disabled'
|
4
|
-
- reload_class = Conf[:allow_reload] ? 'feature-enabled' : 'feature-disabled'
|
5
3
|
|
6
4
|
.footer-signature.pull-left
|
7
5
|
|
@@ -11,23 +9,21 @@
|
|
11
9
|
|
12
10
|
·
|
13
11
|
%a{href: "http://github.com/bmedici/rest-ftp-daemon/"} GitHub
|
12
|
+
|
14
13
|
·
|
15
14
|
%a{href: "http://refactorcop.com/bmedici/rest-ftp-daemon/"} RefactorCop
|
16
15
|
|
17
16
|
|
18
17
|
.footer-indicators.pull-right
|
19
18
|
|
19
|
+
.btn-group.btn-group-sm
|
20
|
+
.btn.btn-default.btn-info Host
|
21
|
+
.btn.btn-default= Conf.host
|
22
|
+
|
20
23
|
.btn-group.btn-group-sm
|
21
24
|
.btn.btn-default.btn-info Features
|
22
|
-
|
23
|
-
|
24
|
-
.btn.btn-default{class: reload_class}
|
25
|
-
%img{src: "/images/reload.png", height: "14", title: "Configuration is hot-reloadable (allow_relaod)"}
|
26
|
-
|
27
|
-
- if Conf.host
|
28
|
-
.btn-group.btn-group-sm
|
29
|
-
.btn.btn-default.btn-info Host
|
30
|
-
.btn.btn-default= Conf.host
|
25
|
+
= dashboard_feature :reload, Conf[:allow_reload], "configuration is hot-reloadable", "configuration changes at startup only"
|
26
|
+
= dashboard_feature :newrelic, Conf.newrelic_enabled?, "active (license found)", "disabled"
|
31
27
|
|
32
28
|
.btn-group.btn-group-sm
|
33
29
|
.btn.btn-default.btn-info IP
|
@@ -2,8 +2,8 @@
|
|
2
2
|
- info_procs = (Facter.value :processorcount).to_i
|
3
3
|
- info_load = Sys::CPU.load_avg.first.to_f
|
4
4
|
- info_norm = info_procs.zero? ? "N/A" : (100 * info_load / info_procs).round(1)
|
5
|
-
- info_trans =
|
6
|
-
- info_processed =
|
5
|
+
- info_trans = RestFtpDaemon::Counters.instance.get :data, :transferred
|
6
|
+
- info_processed = RestFtpDaemon::Counters.instance.get :jobs, :processed
|
7
7
|
- mem = GetProcessMem.new
|
8
8
|
|
9
9
|
|
@@ -1,6 +1,6 @@
|
|
1
1
|
-# coding: utf-8
|
2
|
-
- jobs_by_status =
|
3
|
-
- counts_all =
|
2
|
+
- jobs_by_status = RestFtpDaemon::JobQueue.instance.jobs_by_status
|
3
|
+
- counts_all = RestFtpDaemon::JobQueue.instance.jobs_count
|
4
4
|
- jobs = @paginate.subset
|
5
5
|
|
6
6
|
.btn-group.btn-group-xs.filters
|
@@ -1,8 +1,5 @@
|
|
1
1
|
-# coding: utf-8
|
2
|
-
|
3
|
-
- unless $pool.is_a? RestFtpDaemon::WorkerPool
|
4
|
-
- log_error "Dashboard: invalid WorkerPool"
|
5
|
-
- variables = $pool.worker_variables
|
2
|
+
- variables = RestFtpDaemon::WorkerPool.instance.worker_variables
|
6
3
|
|
7
4
|
%h2 Worker status
|
8
5
|
|
@@ -19,7 +16,7 @@
|
|
19
16
|
%tbody
|
20
17
|
- variables.each do |wid, vars|
|
21
18
|
- status = vars[:status]
|
22
|
-
- alive =
|
19
|
+
- alive = RestFtpDaemon::WorkerPool.instance.worker_alive? wid
|
23
20
|
- trclass = WORKER_STYLES[status]
|
24
21
|
|
25
22
|
- unless alive
|
@@ -1,7 +1,10 @@
|
|
1
|
-
|
1
|
+
require 'singleton'
|
2
2
|
|
3
|
-
|
3
|
+
# Handles a pool of Worker objects
|
4
|
+
module RestFtpDaemon
|
4
5
|
class WorkerPool
|
6
|
+
include Singleton
|
7
|
+
|
5
8
|
include BmcDaemonLib::LoggerHelper
|
6
9
|
include ::NewRelic::Agent::Instrumentation::ControllerInstrumentation
|
7
10
|
|
@@ -22,7 +25,7 @@ module RestFtpDaemon
|
|
22
25
|
@seqno = 0
|
23
26
|
end
|
24
27
|
|
25
|
-
def
|
28
|
+
def start_em_all
|
26
29
|
# Read configuration or initialize with empty hash
|
27
30
|
pools = Conf.at[:pools]
|
28
31
|
pools = {} unless pools.is_a? Hash
|
@@ -50,7 +53,6 @@ module RestFtpDaemon
|
|
50
53
|
log_error "EXCEPTION: #{ex.message}", ex.backtrace
|
51
54
|
end
|
52
55
|
|
53
|
-
|
54
56
|
def worker_variables
|
55
57
|
vars = {}
|
56
58
|
@workers.collect do |wid, worker|
|
@@ -25,9 +25,9 @@ module RestFtpDaemon
|
|
25
25
|
worker_status WORKER_STATUS_CLEANING
|
26
26
|
|
27
27
|
# Cleanup queues according to configured max-age
|
28
|
-
|
29
|
-
|
30
|
-
|
28
|
+
RestFtpDaemon::JobQueue.instance.expire JOB_STATUS_FINISHED, maxage(JOB_STATUS_FINISHED), @config[:debug]
|
29
|
+
RestFtpDaemon::JobQueue.instance.expire JOB_STATUS_FAILED, maxage(JOB_STATUS_FAILED), @config[:debug]
|
30
|
+
RestFtpDaemon::JobQueue.instance.expire JOB_STATUS_QUEUED, maxage(JOB_STATUS_QUEUED), @config[:debug]
|
31
31
|
|
32
32
|
# Force garbage collector
|
33
33
|
GC.start if @config["garbage_collector"]
|
@@ -14,8 +14,6 @@ module RestFtpDaemon
|
|
14
14
|
|
15
15
|
# Check that everything is OK
|
16
16
|
return "invalid timer" unless @config[:timer].to_i > 0
|
17
|
-
# return "invalid WorkerPool" unless $pool.is_a? RestFtpDaemon::WorkerPool
|
18
|
-
# return "invalid JobQueue" unless $queue.is_a? RestFtpDaemon::JobQueue
|
19
17
|
return false
|
20
18
|
end
|
21
19
|
|
@@ -32,7 +32,7 @@ module RestFtpDaemon
|
|
32
32
|
def worker_process
|
33
33
|
# Wait for a job to be available in the queue
|
34
34
|
worker_status WORKER_STATUS_WAITING
|
35
|
-
job =
|
35
|
+
job = RestFtpDaemon::JobQueue.instance.pop @pool
|
36
36
|
|
37
37
|
# Work on this job
|
38
38
|
work_on_job(job)
|
@@ -64,7 +64,7 @@ module RestFtpDaemon
|
|
64
64
|
log_info "retrying job: requeued after delay"
|
65
65
|
|
66
66
|
# Now, requeue this job
|
67
|
-
|
67
|
+
RestFtpDaemon::JobQueue.instance.requeue job
|
68
68
|
end
|
69
69
|
end
|
70
70
|
|
@@ -83,7 +83,7 @@ module RestFtpDaemon
|
|
83
83
|
worker_status WORKER_STATUS_FINISHED, job
|
84
84
|
|
85
85
|
# Increment total processed jobs count
|
86
|
-
|
86
|
+
RestFtpDaemon::Counters.instance.increment :jobs, :processed
|
87
87
|
|
88
88
|
rescue RestFtpDaemon::JobTimeout => ex
|
89
89
|
log_error "JOB TIMED OUT", ex.backtrace
|
data/rest-ftp-daemon.gemspec
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
Gem::Specification.new do |spec|
|
3
3
|
|
4
4
|
# Project version
|
5
|
-
spec.version = "0.
|
5
|
+
spec.version = "0.400.0"
|
6
6
|
|
7
7
|
# Project description
|
8
8
|
spec.name = "rest-ftp-daemon"
|
@@ -21,7 +21,7 @@ Gem::Specification.new do |spec|
|
|
21
21
|
reject{ |f| f =~ /^dashboard.+\.png/ }
|
22
22
|
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
23
23
|
spec.require_paths = ["lib"]
|
24
|
-
spec.required_ruby_version = ">= 2.2"
|
24
|
+
spec.required_ruby_version = ">= 2.2.2"
|
25
25
|
|
26
26
|
|
27
27
|
# Development dependencies
|
@@ -33,7 +33,7 @@ Gem::Specification.new do |spec|
|
|
33
33
|
spec.add_development_dependency "http"
|
34
34
|
|
35
35
|
# Runtime dependencies
|
36
|
-
spec.add_runtime_dependency "bmc-daemon-lib", "~> 0.3.
|
36
|
+
spec.add_runtime_dependency "bmc-daemon-lib", "~> 0.3.3"
|
37
37
|
spec.add_runtime_dependency "json", "~> 1.8"
|
38
38
|
spec.add_runtime_dependency "thin", "~> 1.7"
|
39
39
|
spec.add_runtime_dependency "activesupport", "~> 4.2"
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rest-ftp-daemon
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.400.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Bruno MEDICI
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-08-
|
11
|
+
date: 2016-08-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -100,14 +100,14 @@ dependencies:
|
|
100
100
|
requirements:
|
101
101
|
- - "~>"
|
102
102
|
- !ruby/object:Gem::Version
|
103
|
-
version: 0.3.
|
103
|
+
version: 0.3.3
|
104
104
|
type: :runtime
|
105
105
|
prerelease: false
|
106
106
|
version_requirements: !ruby/object:Gem::Requirement
|
107
107
|
requirements:
|
108
108
|
- - "~>"
|
109
109
|
- !ruby/object:Gem::Version
|
110
|
-
version: 0.3.
|
110
|
+
version: 0.3.3
|
111
111
|
- !ruby/object:Gem::Dependency
|
112
112
|
name: json
|
113
113
|
requirement: !ruby/object:Gem::Requirement
|
@@ -364,10 +364,8 @@ files:
|
|
364
364
|
- lib/rest-ftp-daemon/remote_sftp.rb
|
365
365
|
- lib/rest-ftp-daemon/static/css/bootstrap.css
|
366
366
|
- lib/rest-ftp-daemon/static/css/main.css
|
367
|
-
- lib/rest-ftp-daemon/static/images/
|
368
|
-
- lib/rest-ftp-daemon/static/images/
|
369
|
-
- lib/rest-ftp-daemon/static/images/logo_newrelic_full.png
|
370
|
-
- lib/rest-ftp-daemon/static/images/reload.png
|
367
|
+
- lib/rest-ftp-daemon/static/images/feature_newrelic.png
|
368
|
+
- lib/rest-ftp-daemon/static/images/feature_reload.png
|
371
369
|
- lib/rest-ftp-daemon/uri.rb
|
372
370
|
- lib/rest-ftp-daemon/views/dashboard.haml
|
373
371
|
- lib/rest-ftp-daemon/views/dashboard_counters.haml
|
@@ -404,7 +402,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
404
402
|
requirements:
|
405
403
|
- - ">="
|
406
404
|
- !ruby/object:Gem::Version
|
407
|
-
version:
|
405
|
+
version: 2.2.2
|
408
406
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
409
407
|
requirements:
|
410
408
|
- - ">="
|
Binary file
|
Binary file
|