rest-ftp-daemon 0.214.0 → 0.220.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/.gitignore +1 -0
- data/Gemfile.lock +1 -1
- data/bin/rest-ftp-daemon +1 -1
- data/config.ru +1 -1
- data/lib/rest-ftp-daemon.rb +9 -5
- data/lib/rest-ftp-daemon/api/dashboard.rb +1 -1
- data/lib/rest-ftp-daemon/api/debug.rb +6 -19
- data/lib/rest-ftp-daemon/api/jobs.rb +11 -11
- data/lib/rest-ftp-daemon/api/root.rb +8 -5
- data/lib/rest-ftp-daemon/api/status.rb +1 -1
- data/lib/rest-ftp-daemon/constants.rb +7 -3
- data/lib/rest-ftp-daemon/exceptions.rb +1 -0
- data/lib/rest-ftp-daemon/job.rb +40 -39
- data/lib/rest-ftp-daemon/job_queue.rb +10 -17
- data/lib/rest-ftp-daemon/logger.rb +58 -17
- data/lib/rest-ftp-daemon/logger_helper.rb +26 -0
- data/lib/rest-ftp-daemon/logger_pool.rb +13 -13
- data/lib/rest-ftp-daemon/notification.rb +14 -14
- data/lib/rest-ftp-daemon/settings.rb +3 -3
- data/lib/rest-ftp-daemon/worker.rb +58 -0
- data/lib/rest-ftp-daemon/worker_conchita.rb +49 -0
- data/lib/rest-ftp-daemon/worker_job.rb +64 -0
- data/lib/rest-ftp-daemon/worker_pool.rb +48 -104
- data/rest-ftp-daemon.yml.sample +1 -4
- metadata +5 -3
- data/lib/rest-ftp-daemon/api/routes.rb +0 -16
- data/lib/rest-ftp-daemon/conchita.rb +0 -65
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 519c3872919419beaa88f1dc46d3f41fb798effe
|
4
|
+
data.tar.gz: 245b623aeab51fd699aeb7f5842a517ea19b1188
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a5e8da4e45ed4c753f3ce6c978b8b8a070ae73b368db26410743f0c281f631365528cf54362134d8607ee9aa9cb401d0653c73942f43fa121dc43a2d711d99e5
|
7
|
+
data.tar.gz: b595327455aeb85e1f60969f09de446f37dbdfc0ef213d34ee10a93f460b53007104d5dc254b1c37f6df37eebd5fdedd1aa54cf790927a716806802136ca83a6
|
data/.gitignore
CHANGED
data/Gemfile.lock
CHANGED
data/bin/rest-ftp-daemon
CHANGED
@@ -114,7 +114,7 @@ puts "Host \t #{Settings.host}"
|
|
114
114
|
puts "Namespace \t #{Settings.namespace}"
|
115
115
|
puts "Network port \t #{Settings.port}"
|
116
116
|
puts "User:group \t #{Settings.user}:#{Settings.group}" if (Settings.user || Settings.group)
|
117
|
-
puts "Newrelic \t #{Settings.newrelic_enabled? ? Settings.newrelic
|
117
|
+
puts "Newrelic \t #{Settings.newrelic_enabled? ? Settings.at(:debug, :newrelic) : "no"}"
|
118
118
|
# puts Settings.dump
|
119
119
|
puts
|
120
120
|
puts "--- Thin ARGV"
|
data/config.ru
CHANGED
@@ -7,7 +7,7 @@ require 'rest-ftp-daemon'
|
|
7
7
|
$queue = RestFtpDaemon::JobQueue.new
|
8
8
|
|
9
9
|
# Initialize workers and conchita subsystem
|
10
|
-
$pool = RestFtpDaemon::WorkerPool.new
|
10
|
+
$pool = RestFtpDaemon::WorkerPool.new
|
11
11
|
|
12
12
|
# Rack reloader
|
13
13
|
unless Settings.namespace == "production"
|
data/lib/rest-ftp-daemon.rb
CHANGED
@@ -16,6 +16,8 @@ require 'net/http'
|
|
16
16
|
require 'double_bag_ftps'
|
17
17
|
require 'thread'
|
18
18
|
require 'securerandom'
|
19
|
+
require 'singleton'
|
20
|
+
require 'logger'
|
19
21
|
|
20
22
|
require 'newrelic_rpm'
|
21
23
|
require 'get_process_mem'
|
@@ -26,20 +28,22 @@ require 'rest-ftp-daemon/constants'
|
|
26
28
|
require 'rest-ftp-daemon/settings'
|
27
29
|
require 'rest-ftp-daemon/exceptions'
|
28
30
|
require 'rest-ftp-daemon/helpers'
|
31
|
+
require 'rest-ftp-daemon/logger_helper'
|
32
|
+
require 'rest-ftp-daemon/logger_pool'
|
33
|
+
require 'rest-ftp-daemon/logger'
|
29
34
|
require 'rest-ftp-daemon/paginate'
|
30
35
|
require 'rest-ftp-daemon/uri'
|
31
36
|
require 'rest-ftp-daemon/job_queue'
|
32
37
|
# require 'rest-ftp-daemon/worker'
|
33
|
-
require 'rest-ftp-daemon/
|
38
|
+
require 'rest-ftp-daemon/worker'
|
39
|
+
require 'rest-ftp-daemon/worker_conchita'
|
40
|
+
require 'rest-ftp-daemon/worker_job'
|
34
41
|
require 'rest-ftp-daemon/worker_pool'
|
35
|
-
require 'rest-ftp-daemon/logger'
|
36
|
-
require 'rest-ftp-daemon/logger_pool'
|
37
42
|
require 'rest-ftp-daemon/job'
|
38
43
|
require 'rest-ftp-daemon/notification'
|
39
44
|
require 'rest-ftp-daemon/api/root'
|
40
45
|
require 'rest-ftp-daemon/api/jobs'
|
41
|
-
require 'rest-ftp-daemon/api/debug'
|
42
|
-
require 'rest-ftp-daemon/api/routes'
|
43
46
|
require 'rest-ftp-daemon/api/dashboard'
|
44
47
|
require 'rest-ftp-daemon/api/status'
|
48
|
+
require 'rest-ftp-daemon/api/debug'
|
45
49
|
require 'rest-ftp-daemon/api/job_presenter'
|
@@ -5,7 +5,7 @@ module RestFtpDaemon
|
|
5
5
|
####### GET /debug
|
6
6
|
|
7
7
|
get '/raise' do
|
8
|
-
|
8
|
+
log_info "GET /debug"
|
9
9
|
begin
|
10
10
|
raise RestFtpDaemon::DummyException
|
11
11
|
rescue RestFtpDaemon::RestFtpDaemonException => exception
|
@@ -20,24 +20,11 @@ module RestFtpDaemon
|
|
20
20
|
end
|
21
21
|
end
|
22
22
|
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
# print "\t"
|
29
|
-
# print e.class.to_s
|
30
|
-
# print "\t"
|
31
|
-
# puts e.inspect[0..80]
|
32
|
-
# # puts ({
|
33
|
-
# # klass: e.class,
|
34
|
-
# # size: ObjectSpace.memsize_of(e),
|
35
|
-
# # }.inspect)
|
36
|
-
# # puts
|
37
|
-
# end
|
38
|
-
# status 200
|
39
|
-
# []
|
40
|
-
# end
|
23
|
+
get '/routes' do
|
24
|
+
info "GET /routes"
|
25
|
+
status 200
|
26
|
+
return RestFtpDaemon::API::Root::routes
|
27
|
+
end
|
41
28
|
|
42
29
|
end
|
43
30
|
end
|
@@ -9,7 +9,7 @@ module RestFtpDaemon
|
|
9
9
|
requires :id, type: String, desc: 'ID of the Job to read', regexp: /[^\/]+/
|
10
10
|
end
|
11
11
|
get '/jobs/*id' do
|
12
|
-
|
12
|
+
log_info "GET /jobs/#{params[:id]}"
|
13
13
|
|
14
14
|
begin
|
15
15
|
# Get job to display
|
@@ -18,15 +18,15 @@ module RestFtpDaemon
|
|
18
18
|
raise RestFtpDaemon::JobNotFound if job.nil?
|
19
19
|
|
20
20
|
rescue RestFtpDaemon::JobNotFound => exception
|
21
|
-
|
21
|
+
log_error "JobNotFound: #{exception.message}"
|
22
22
|
status 404
|
23
23
|
api_error exception
|
24
24
|
rescue RestFtpDaemonException => exception
|
25
|
-
|
25
|
+
log_error "RestFtpDaemonException: #{exception.message}"
|
26
26
|
status 500
|
27
27
|
api_error exception
|
28
28
|
rescue Exception => exception
|
29
|
-
|
29
|
+
log_error "Exception: #{exception.message}"
|
30
30
|
status 501
|
31
31
|
api_error exception
|
32
32
|
else
|
@@ -42,7 +42,7 @@ module RestFtpDaemon
|
|
42
42
|
desc "List all Jobs"
|
43
43
|
|
44
44
|
get '/jobs/' do
|
45
|
-
|
45
|
+
log_info "GET /jobs"
|
46
46
|
|
47
47
|
begin
|
48
48
|
# Detect QS filters
|
@@ -53,11 +53,11 @@ module RestFtpDaemon
|
|
53
53
|
jobs = $queue.jobs
|
54
54
|
|
55
55
|
rescue RestFtpDaemonException => exception
|
56
|
-
|
56
|
+
log_error "RestFtpDaemonException: #{exception.message}"
|
57
57
|
status 501
|
58
58
|
api_error exception
|
59
59
|
rescue Exception => exception
|
60
|
-
|
60
|
+
log_error "Exception: #{exception.message}"
|
61
61
|
status 501
|
62
62
|
api_error exception
|
63
63
|
else
|
@@ -88,7 +88,7 @@ module RestFtpDaemon
|
|
88
88
|
end
|
89
89
|
|
90
90
|
post '/jobs/' do
|
91
|
-
|
91
|
+
log_info "POST /jobs", params
|
92
92
|
|
93
93
|
begin
|
94
94
|
|
@@ -103,15 +103,15 @@ module RestFtpDaemon
|
|
103
103
|
$queue.counter_inc :jobs_received
|
104
104
|
|
105
105
|
rescue JSON::ParserError => exception
|
106
|
-
|
106
|
+
log_error "JSON::ParserError: #{exception.message}"
|
107
107
|
status 406
|
108
108
|
api_error exception
|
109
109
|
rescue RestFtpDaemonException => exception
|
110
|
-
|
110
|
+
log_error "RestFtpDaemonException: #{exception.message}"
|
111
111
|
status 412
|
112
112
|
api_error exception
|
113
113
|
rescue Exception => exception
|
114
|
-
|
114
|
+
log_error "Exception: #{exception.message}"
|
115
115
|
status 501
|
116
116
|
api_error exception
|
117
117
|
else
|
@@ -5,7 +5,8 @@ module RestFtpDaemon
|
|
5
5
|
|
6
6
|
####### CLASS CONFIG
|
7
7
|
|
8
|
-
|
8
|
+
helpers RestFtpDaemon::LoggerHelper
|
9
|
+
|
9
10
|
logger RestFtpDaemon::LoggerPool.instance.get :api
|
10
11
|
|
11
12
|
do_not_route_head!
|
@@ -33,12 +34,14 @@ module RestFtpDaemon
|
|
33
34
|
|
34
35
|
helpers do
|
35
36
|
|
36
|
-
def
|
37
|
-
Root.logger
|
38
|
-
lines: lines,
|
39
|
-
origin: self.class.to_s
|
37
|
+
def logger
|
38
|
+
Root.logger
|
40
39
|
end
|
41
40
|
|
41
|
+
# def log_context
|
42
|
+
# {}
|
43
|
+
# end
|
44
|
+
|
42
45
|
def api_error exception
|
43
46
|
{
|
44
47
|
:error => exception.message,
|
@@ -1,7 +1,7 @@
|
|
1
1
|
# Terrific constants
|
2
2
|
APP_NAME = "rest-ftp-daemon"
|
3
3
|
APP_NICK = "rftpd"
|
4
|
-
APP_VER = "0.
|
4
|
+
APP_VER = "0.220.0"
|
5
5
|
|
6
6
|
|
7
7
|
# Jobs and workers
|
@@ -22,7 +22,11 @@ LOG_COL_JID = JOB_IDENT_LEN+3+2
|
|
22
22
|
LOG_COL_ID = 6
|
23
23
|
LOG_TRIM_LINE = 80
|
24
24
|
LOG_DUMPS = File.dirname(__FILE__) + '/../../log/'
|
25
|
-
|
25
|
+
LOG_ROTATION = 'daily'
|
26
|
+
LOG_FORMAT_TIME = "%Y-%m-%d %H:%M:%S"
|
27
|
+
LOG_FORMAT_PREFIX = "%s %s\t%-#{LOG_PIPE_LEN.to_i}s\t"
|
28
|
+
LOG_FORMAT_MESSAGE = "%#{-LOG_COL_WID.to_i}s\t%#{-LOG_COL_JID.to_i}s\t%#{-LOG_COL_ID.to_i}s"
|
29
|
+
LOG_NEWLINE = "\n"
|
26
30
|
|
27
31
|
# Notifications
|
28
32
|
NOTIFY_PREFIX = "rftpd"
|
@@ -45,7 +49,7 @@ WORKER_STYLES = {
|
|
45
49
|
:done => :success,
|
46
50
|
:dead => :danger
|
47
51
|
}
|
48
|
-
PAGINATE_MAX =
|
52
|
+
PAGINATE_MAX = 40
|
49
53
|
|
50
54
|
|
51
55
|
# Configuration defaults
|
@@ -6,6 +6,7 @@ module RestFtpDaemon
|
|
6
6
|
|
7
7
|
class MissingQueue < RestFtpDaemonException; end
|
8
8
|
class MissingPool < RestFtpDaemonException; end
|
9
|
+
class InvalidWorkerNumber < RestFtpDaemonException; end
|
9
10
|
|
10
11
|
class JobException < RestFtpDaemonException; end
|
11
12
|
class JobTimeout < RestFtpDaemonException; end
|
data/lib/rest-ftp-daemon/job.rb
CHANGED
@@ -1,5 +1,7 @@
|
|
1
1
|
module RestFtpDaemon
|
2
2
|
class Job
|
3
|
+
include LoggerHelper
|
4
|
+
attr_reader :logger
|
3
5
|
|
4
6
|
if Settings.newrelic_enabled?
|
5
7
|
include ::NewRelic::Agent::Instrumentation::ControllerInstrumentation
|
@@ -65,14 +67,14 @@ module RestFtpDaemon
|
|
65
67
|
@updated_at = Time.now
|
66
68
|
|
67
69
|
# Send first notification
|
68
|
-
|
70
|
+
log_info "Job.initialize notify[queued] notify_after_sec[#{@notify_after_sec}] update_every_kb[#{@update_every_kb}]"
|
69
71
|
client_notify :queued
|
70
72
|
end
|
71
73
|
|
72
74
|
def process
|
73
75
|
# Update job's status
|
74
76
|
@error = nil
|
75
|
-
|
77
|
+
log_info "Job.process starting"
|
76
78
|
|
77
79
|
# Prepare job
|
78
80
|
begin
|
@@ -110,7 +112,7 @@ module RestFtpDaemon
|
|
110
112
|
else
|
111
113
|
# Prepare done !
|
112
114
|
newstatus :prepared
|
113
|
-
|
115
|
+
log_info "Job.process notify[started]"
|
114
116
|
client_notify :started
|
115
117
|
end
|
116
118
|
|
@@ -183,7 +185,7 @@ module RestFtpDaemon
|
|
183
185
|
else
|
184
186
|
# All done !
|
185
187
|
newstatus JOB_STATUS_FINISHED
|
186
|
-
|
188
|
+
log_info "Job.process notify[ended]"
|
187
189
|
client_notify :ended
|
188
190
|
end
|
189
191
|
|
@@ -318,7 +320,7 @@ module RestFtpDaemon
|
|
318
320
|
|
319
321
|
# Log detected names
|
320
322
|
source_names = source_matches.map{ |s| Helpers.extract_filename s }
|
321
|
-
|
323
|
+
log_info "Job.transfer sources #{source_names.inspect}"
|
322
324
|
|
323
325
|
# Asserts and counters
|
324
326
|
raise RestFtpDaemon::JobSourceNotFound if source_matches.empty?
|
@@ -371,15 +373,11 @@ module RestFtpDaemon
|
|
371
373
|
|
372
374
|
private
|
373
375
|
|
374
|
-
def
|
375
|
-
|
376
|
-
|
377
|
-
|
378
|
-
|
379
|
-
wid: @wid,
|
380
|
-
jid: @id,
|
381
|
-
lines: lines,
|
382
|
-
origin: self.class.to_s
|
376
|
+
def log_context
|
377
|
+
{
|
378
|
+
wid: @wid,
|
379
|
+
jid: @id
|
380
|
+
}
|
383
381
|
end
|
384
382
|
|
385
383
|
def newstatus name
|
@@ -406,7 +404,7 @@ module RestFtpDaemon
|
|
406
404
|
raise RestFtpDaemon::JobAssertionFailed, "ftp_init/1" if @target_method.nil?
|
407
405
|
raise RestFtpDaemon::JobAssertionFailed, "ftp_init/2" if @target_url.nil?
|
408
406
|
|
409
|
-
|
407
|
+
log_info "Job.ftp_init target_method [#{@target_method}]"
|
410
408
|
case @target_method
|
411
409
|
when :ftp
|
412
410
|
@ftp = Net::FTP.new
|
@@ -415,7 +413,7 @@ module RestFtpDaemon
|
|
415
413
|
@ftp.ssl_context = DoubleBagFTPS.create_ssl_context(:verify_mode => OpenSSL::SSL::VERIFY_NONE)
|
416
414
|
@ftp.ftps_mode = DoubleBagFTPS::EXPLICIT
|
417
415
|
else
|
418
|
-
|
416
|
+
log_info "Job.ftp_init unknown scheme [#{@target_url.scheme}]"
|
419
417
|
railse RestFtpDaemon::JobTargetUnsupported
|
420
418
|
end
|
421
419
|
|
@@ -442,7 +440,7 @@ module RestFtpDaemon
|
|
442
440
|
def ftp_finished
|
443
441
|
# Close FTP connexion and free up memory
|
444
442
|
@ftp.close
|
445
|
-
|
443
|
+
log_info "Job.ftp_finished closed"
|
446
444
|
@ftp = nil
|
447
445
|
|
448
446
|
# FTP debug mode ?
|
@@ -465,7 +463,7 @@ module RestFtpDaemon
|
|
465
463
|
|
466
464
|
# Method assertions
|
467
465
|
host = @target_url.host
|
468
|
-
|
466
|
+
log_info "Job.ftp_connect [#{host}]"
|
469
467
|
raise RestFtpDaemon::JobAssertionFailed, "ftp_connect/1" if @ftp.nil?
|
470
468
|
raise RestFtpDaemon::JobAssertionFailed, "ftp_connect/2" if @target_url.nil?
|
471
469
|
|
@@ -481,25 +479,25 @@ module RestFtpDaemon
|
|
481
479
|
|
482
480
|
# use "anonymous" if user is empty
|
483
481
|
login = @target_url.user || "anonymous"
|
484
|
-
|
482
|
+
log_info "Job.ftp_login [#{login}]"
|
485
483
|
|
486
484
|
@ftp.login login, @target_url.password
|
487
485
|
end
|
488
486
|
|
489
487
|
def ftp_chdir_or_buildpath path
|
490
488
|
# Method assertions
|
491
|
-
|
489
|
+
log_info "Job.ftp_chdir [#{path}] mkdir: #{@mkdir}"
|
492
490
|
newstatus :ftp_chdir
|
493
491
|
raise RestFtpDaemon::JobAssertionFailed, "ftp_chdir_or_buildpath/1" if path.nil?
|
494
492
|
|
495
493
|
# Extract directory from path
|
496
494
|
if @mkdir
|
497
495
|
# Split dir in parts
|
498
|
-
|
496
|
+
log_info "Job.ftp_chdir buildpath [#{path}]"
|
499
497
|
ftp_buildpath path
|
500
498
|
else
|
501
499
|
# Directly chdir if not mkdir requested
|
502
|
-
|
500
|
+
log_info "Job.ftp_chdir chdir [#{path}]"
|
503
501
|
@ftp.chdir path
|
504
502
|
end
|
505
503
|
end
|
@@ -515,7 +513,7 @@ module RestFtpDaemon
|
|
515
513
|
rescue Net::FTPPermError => exception
|
516
514
|
# If not possible because the directory is missing
|
517
515
|
parent = Helpers.extract_parent(path)
|
518
|
-
|
516
|
+
log_info "#{pref} chdir failed - parent [#{parent}]"
|
519
517
|
|
520
518
|
# And only if we still have something to "dive up into"
|
521
519
|
if parent
|
@@ -523,18 +521,18 @@ module RestFtpDaemon
|
|
523
521
|
ftp_buildpath parent
|
524
522
|
|
525
523
|
# Then finally create this dir and chdir
|
526
|
-
|
524
|
+
log_info "#{pref} > now mkdir [#{path}]"
|
527
525
|
@ftp.mkdir path
|
528
526
|
|
529
527
|
# And get into it (this chdir is not rescue'd on purpose in order to throw the ex)
|
530
|
-
|
528
|
+
log_info "#{pref} > now chdir [#{path}]"
|
531
529
|
@ftp.chdir(path)
|
532
530
|
end
|
533
531
|
|
534
532
|
end
|
535
533
|
|
536
534
|
# Now we were able to chdir inside, just tell it
|
537
|
-
|
535
|
+
log_info "#{pref} > ftp.pwd [#{@ftp.pwd}]"
|
538
536
|
end
|
539
537
|
|
540
538
|
def ftp_presence target_name
|
@@ -548,7 +546,7 @@ module RestFtpDaemon
|
|
548
546
|
|
549
547
|
# Get file list, sometimes the response can be an empty value
|
550
548
|
results = @ftp.list(target_name) rescue nil
|
551
|
-
|
549
|
+
log_info "Job.ftp_presence: #{results.inspect}"
|
552
550
|
|
553
551
|
# Result can be nil or a list of files
|
554
552
|
return false if results.nil?
|
@@ -557,13 +555,13 @@ module RestFtpDaemon
|
|
557
555
|
|
558
556
|
def ftp_transfer source_filename, target_name = nil
|
559
557
|
# Method assertions
|
560
|
-
|
558
|
+
log_info "Job.ftp_transfer source: #{source_filename}"
|
561
559
|
raise RestFtpDaemon::JobAssertionFailed, "ftp_transfer/1" if @ftp.nil?
|
562
560
|
raise RestFtpDaemon::JobAssertionFailed, "ftp_transfer/2" if source_filename.nil?
|
563
561
|
|
564
562
|
# Use source filename if target path provided none (typically with multiple sources)
|
565
563
|
target_name ||= Helpers.extract_filename source_filename
|
566
|
-
|
564
|
+
log_info "Job.ftp_transfer target: #{target_name}"
|
567
565
|
set :source_current, target_name
|
568
566
|
|
569
567
|
# Check for target file presence
|
@@ -572,11 +570,11 @@ module RestFtpDaemon
|
|
572
570
|
if present
|
573
571
|
if @overwrite
|
574
572
|
# delete it first
|
575
|
-
|
573
|
+
log_info "Job.ftp_transfer removing target file"
|
576
574
|
@ftp.delete(target_name)
|
577
575
|
else
|
578
576
|
# won't overwrite then stop here
|
579
|
-
|
577
|
+
log_info "Job.ftp_transfer failed: target file exists"
|
580
578
|
raise RestFtpDaemon::JobTargetFileExists
|
581
579
|
end
|
582
580
|
end
|
@@ -585,7 +583,7 @@ module RestFtpDaemon
|
|
585
583
|
target_real = target_name
|
586
584
|
if @tempfile
|
587
585
|
target_real = "#{target_name}.temp-#{Helpers.identifier(JOB_TEMPFILE_LEN)}"
|
588
|
-
|
586
|
+
log_info "Job.ftp_transfer tempfile: #{target_real}"
|
589
587
|
end
|
590
588
|
|
591
589
|
# Start transfer
|
@@ -606,7 +604,7 @@ module RestFtpDaemon
|
|
606
604
|
# Rename temp file to target_temp
|
607
605
|
if @tempfile
|
608
606
|
newstatus JOB_STATUS_RENAMING
|
609
|
-
|
607
|
+
log_info "Job.ftp_transfer renaming: #{target_name}"
|
610
608
|
@ftp.rename target_real, target_name
|
611
609
|
end
|
612
610
|
|
@@ -615,7 +613,7 @@ module RestFtpDaemon
|
|
615
613
|
|
616
614
|
# Done
|
617
615
|
set :source_current, nil
|
618
|
-
|
616
|
+
log_info "Job.ftp_transfer finished"
|
619
617
|
end
|
620
618
|
|
621
619
|
def ftp_transfer_block block
|
@@ -639,7 +637,7 @@ module RestFtpDaemon
|
|
639
637
|
stack << (Helpers.format_bytes @transfer_total, "B")
|
640
638
|
stack << (Helpers.format_bytes bitrate0, "bps")
|
641
639
|
stack2 = stack.map{ |txt| ("%#{LOG_PIPE_LEN.to_i}s" % txt)}.join("\t")
|
642
|
-
|
640
|
+
log_info "Job.ftp_transfer #{stack2}"
|
643
641
|
|
644
642
|
# Update time pointer
|
645
643
|
@transfer_pointer_at = Time.now
|
@@ -668,7 +666,7 @@ module RestFtpDaemon
|
|
668
666
|
RestFtpDaemon::Notification.new @notify, payload
|
669
667
|
|
670
668
|
rescue Exception => ex
|
671
|
-
|
669
|
+
log_error "Job.client_notify EXCEPTION: #{ex.inspect}"
|
672
670
|
end
|
673
671
|
|
674
672
|
def get_bitrate total, last_timestamp
|
@@ -685,9 +683,9 @@ module RestFtpDaemon
|
|
685
683
|
|
686
684
|
message = "Job.oops event[#{event.to_s}] error[#{error.to_s}] ex[#{exception.class}] #{exception.message}"
|
687
685
|
if include_backtrace
|
688
|
-
|
686
|
+
log_error message, exception.backtrace
|
689
687
|
else
|
690
|
-
|
688
|
+
log_error message
|
691
689
|
end
|
692
690
|
|
693
691
|
# Close ftp connexion if open
|
@@ -718,7 +716,10 @@ module RestFtpDaemon
|
|
718
716
|
end
|
719
717
|
|
720
718
|
if Settings.newrelic_enabled?
|
721
|
-
add_transaction_tracer :
|
719
|
+
add_transaction_tracer :prepare, :category => :task
|
720
|
+
add_transaction_tracer :transfer, :category => :task
|
721
|
+
add_transaction_tracer :client_notify, :category => :task
|
722
|
+
add_transaction_tracer :initialize, :category => :task
|
722
723
|
end
|
723
724
|
|
724
725
|
end
|