rest-ftp-daemon 0.94.4 → 0.95.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: eb821dc634f6867b5475e98868b9e6562117ebd2
4
- data.tar.gz: 953acf9755629a9ebae2afaac8f1f54438358afb
3
+ metadata.gz: 9df54e0c451475506949a750afee4f8c774b3ae7
4
+ data.tar.gz: 7d73e198e3b5e9d732db27937010cfa912057752
5
5
  SHA512:
6
- metadata.gz: e1f92e85d401a25533c0239e8798ea71cc6d3862aec7e176c6ff3dd8486396cab93977abd7d94866820a165ac23f4e4e1a6db7f218cb58db6db4aa43ca79875e
7
- data.tar.gz: 6d6d0b77b70bf07a84a39918be28502f45ae71ab8ea6641dbf7ecec9aaa667d212c07963294c2e09f24dd8e91770d7af9d10ddc46928d3750b9aed4baa57eef5
6
+ metadata.gz: 2c3f2f4e7331e3cfb09b0c61005d16429ea3a2a0ac54a223d61c6cb06b45b259ba6d90db6ddf75d851d1d4afc7f28c9f9a069a273795f3828c974783eb699492
7
+ data.tar.gz: 5cee703b40eb48e6bebc4e78b80d792fe4de5a024b70f6a9b1a72e4fbae56490abb84c3015fb420e6404a95035d650ff5a832aaae5883ffaf2cff19cd4dcda99
@@ -22,7 +22,8 @@ parser = OptionParser.new do |opts|
22
22
  opts.on("", "--dev") { APP_ENV = "development" }
23
23
  opts.on("-p", "--port PORT", "use PORT") { |port| options["port"] = port.to_i }
24
24
  opts.on("-w", "--workers COUNT", "Use COUNT worker threads") { |count| options["workers"] = count.to_i }
25
- opts.on("-d", "--daemonize", "Run daemonized in the background") { |bool| options["daemonize"] = bool }
25
+ opts.on("-d", "--daemonize", "Run daemonized in the background") { |bool| options["daemonize"] = true }
26
+ opts.on("-f", "--foreground", "Run in the foreground") { |bool| options["daemonize"] = false }
26
27
  opts.on("-P", "--pid FILE", "File to store PID") { |file| options["pidfile"] = file }
27
28
  opts.on("-u", "--user NAME", "User to run daemon as (use with -g)") { |user| options["user"] = user }
28
29
  opts.on("-g", "--group NAME", "Group to run daemon as (use with -u)"){ |group| options["group"] = group }
@@ -18,7 +18,7 @@ module RestFtpDaemon
18
18
  expose :error
19
19
  expose :status
20
20
 
21
- expose :started_at
21
+ expose :queued_at
22
22
  expose :updated_at
23
23
  expose :age
24
24
 
@@ -1,7 +1,7 @@
1
1
  # Terrific constants
2
2
  APP_NAME = "rest-ftp-daemon"
3
3
  APP_CONF = "/etc/#{APP_NAME}.yml"
4
- APP_VER = "0.94.4"
4
+ APP_VER = "0.95.2"
5
5
 
6
6
  # Some global constants
7
7
  IDENT_JOB_LEN = 4
@@ -20,4 +20,3 @@ APP_LIBS = File.dirname(__FILE__)
20
20
 
21
21
  # Debugging
22
22
  DEBUG_FTP_COMMANDS = false
23
-
@@ -14,7 +14,7 @@ module RestFtpDaemon
14
14
  attr_reader :error
15
15
  attr_reader :status
16
16
 
17
- attr_reader :started_at
17
+ attr_reader :queued_at
18
18
  attr_reader :updated_at
19
19
 
20
20
  attr_reader :params
@@ -43,7 +43,7 @@ module RestFtpDaemon
43
43
  @logger = RestFtpDaemon::Logger.new(:workers, "JOB #{id}")
44
44
 
45
45
  # Flag current job
46
- @started_at = Time.now
46
+ @queued_at = Time.now
47
47
  @status = :created
48
48
 
49
49
  # Send first notification
@@ -51,6 +51,12 @@ module RestFtpDaemon
51
51
  client_notify "rftpd.queued"
52
52
  end
53
53
 
54
+ def close
55
+ # Close logger
56
+ info "Job.close"
57
+ @logger.close
58
+ end
59
+
54
60
  def process
55
61
  # Update job's status
56
62
  @error = nil
@@ -107,6 +113,9 @@ module RestFtpDaemon
107
113
  rescue Errno::ECONNREFUSED => exception
108
114
  return oops "rftpd.ended", exception, :job_connexion_refused
109
115
 
116
+ rescue SocketError => exception
117
+ return oops "rftpd.ended", exception, :job_socket_error
118
+
110
119
  rescue Timeout::Error, Errno::ETIMEDOUT => exception
111
120
  return oops "rftpd.ended", exception, :job_timeout
112
121
 
@@ -160,8 +169,8 @@ module RestFtpDaemon
160
169
  protected
161
170
 
162
171
  def age
163
- return 0 if @started_at.nil?
164
- (Time.now - @started_at).round(2)
172
+ return 0 if @queued_at.nil?
173
+ (Time.now - @queued_at).round(2)
165
174
  end
166
175
 
167
176
  def wander time
@@ -337,6 +346,8 @@ module RestFtpDaemon
337
346
 
338
347
  # Prepare notification if signal given
339
348
  return unless signal_name
349
+
350
+ # Send the real notification
340
351
  client_notify signal_name, error_name, notif_status
341
352
  end
342
353
 
@@ -47,7 +47,7 @@
47
47
  %th W
48
48
  %th source
49
49
  %th target
50
- %th started
50
+ %th queued
51
51
  %th status
52
52
  %th progress
53
53
  %th error
@@ -64,13 +64,13 @@
64
64
 
65
65
 
66
66
  .row
67
- .col-md-7
67
+ .col-md-6
68
68
  = render :dashboard_tokens, {tokens: Settings.endpoints || {}}
69
69
 
70
70
  .col-md-3
71
71
  = render :dashboard_workers
72
72
 
73
- .col-md-2
73
+ .col-md-3
74
74
  = render :dashboard_counters
75
75
 
76
76
  %br
@@ -5,6 +5,7 @@
5
5
  - source_processed = job.get(:source_processed) || 0
6
6
  - source_processing = job.get(:source_processing)
7
7
  - presented = present job, :with => RestFtpDaemon::API::Entities::JobPresenter, hide_params: true
8
+ - errmsg = job.get :error_message
8
9
 
9
10
  - if !job.error.nil?
10
11
  - trclass = "danger"
@@ -25,8 +26,6 @@
25
26
  = job.priority
26
27
 
27
28
  %td
28
-
29
-
30
29
  - unless job.wid.nil?
31
30
  .label.label-warning.flag= "w#{job.wid}"
32
31
 
@@ -40,7 +39,7 @@
40
39
  = Helpers.highlight_tokens job.target
41
40
 
42
41
  %td
43
- = Helpers.datetime_short(job.started_at)
42
+ = Helpers.datetime_short(job.queued_at)
44
43
 
45
44
  %td
46
45
  = job.status
@@ -60,7 +59,9 @@
60
59
  - unless source_processing.nil?
61
60
  %small= " (#{source_processing})"
62
61
  - else
63
- = Helpers.text_or_empty(job.error)
62
+ .error{title: errmsg}
63
+ = Helpers.text_or_empty(job.error)
64
+
64
65
 
65
66
  %td.nobr.text-right
66
67
  = Helpers.format_bytes(size, "B")
@@ -56,6 +56,7 @@ module RestFtpDaemon
56
56
  job.wid = wid
57
57
  job.process
58
58
  info "worker [#{wid}] processed [#{job.id}]"
59
+ job.close
59
60
  worker_status wid, :done
60
61
 
61
62
  # Increment total processed jobs count
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.94.4
4
+ version: 0.95.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Bruno MEDICI
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-12-02 00:00:00.000000000 Z
11
+ date: 2014-12-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler