rest-ftp-daemon 0.424.0 → 0.424.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: 2d4d6f823c82eb53007aceccb525111fce662019
4
- data.tar.gz: b779d0afa8de9f3f4cf3e935574223f24883e331
3
+ metadata.gz: b7e975d417576100041ffbdaf11a22f811a1e585
4
+ data.tar.gz: 27cb0f4e9a738589e1dd6b3cf957d1e5d8239970
5
5
  SHA512:
6
- metadata.gz: 67fafa5d1998d4d1a7f9b28fdbfb20b6637e2f506eea4799a277caf3d326133d1e56a554991de05329fc44875268e5a6fb43283ec92c595bb50b98de205b166c
7
- data.tar.gz: d0dbc285d27a26120887795803c35f250f415ecc1b9d8fd8a1937be313c1767f4b18d31e987a82c944c7374ea21f67cc218f01b7198c74edf344fc4cd3e60b03
6
+ metadata.gz: 62d898e7c52b0f89a0cf204c47503c98ddae8b210b8ea8a5cfd24f27ebb7d7940f0a0296b5a5299ffbc7bec3ef176e43c95c8128e8fb6167eb1e3b99969d7d6d
7
+ data.tar.gz: e02ef0697b640053766319bf917d974cd648baf64f6b50558a1b89f1c275671c31031502db460e1274d6c93ee4b682d289db5a28389ea44c183d60e6e23889c1
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- rest-ftp-daemon (0.424.0)
4
+ rest-ftp-daemon (0.424.2)
5
5
  activesupport (~> 4.2)
6
6
  api-auth
7
7
  aws-sdk-resources (~> 2)
@@ -5,6 +5,26 @@ module RestFtpDaemon
5
5
  class Jobs < Grape::API
6
6
  include BmcDaemonLib
7
7
 
8
+
9
+ ### EXCEPTIONS HANDLERS
10
+ rescue_from RestFtpDaemon::JobNotFound do |exception|
11
+ exception_error :api_job_not_found, 404, exception
12
+ end
13
+ rescue_from JSON::ParserError do |exception|
14
+ exception_error :api_job_not_found, 404, exception
15
+
16
+ log_error "JSON::ParserError: #{exception.message}"
17
+ error!({error: :api_parse_error, message: exception.message}, 422)
18
+ end
19
+ rescue_from RestFtpDaemon::QueueCantCreateJob do |exception|
20
+ exception_error :api_cant_create_job, 422, exception
21
+ error!({error: :api_cant_create_job, message: exception.message}, 422)
22
+ end
23
+ rescue_from RestFtpDaemonException do |exception|
24
+ exception_error exception_to_error(exception), 500, exception
25
+ Rollbar.error exception
26
+ end
27
+
8
28
  ### ENDPOINTS
9
29
  desc "Read job with ID", http_codes: [
10
30
  { code: 200, message: "Here is the job you requested" },
@@ -15,27 +35,15 @@ module RestFtpDaemon
15
35
  requires :id, type: String, desc: "ID of the Job to read"
16
36
  end
17
37
  get "/:id", requirements: { id: /.*/ } do
18
- begin
19
- # Get job to display
20
- raise RestFtpDaemon::JobNotFound if params[:id].nil?
21
- job = RestFtpDaemon::JobQueue.instance.find_by_id(params[:id]) || RestFtpDaemon::JobQueue.instance.find_by_id(params[:id], true)
22
- raise RestFtpDaemon::JobNotFound if job.nil?
23
-
24
- log_debug "found job: #{job.inspect}"
25
-
26
- rescue RestFtpDaemon::JobNotFound => exception
27
- log_error "JobNotFound: #{exception.message}"
28
- error!({ error: :api_job_not_found, message: exception.message }, 404)
29
-
30
- rescue StandardError => exception
31
- log_error "Exception: #{exception.message}"
32
- error!({ error: :api_exception, message: exception.message }, 500)
33
-
34
- else
35
- status 200
36
- present job, with: RestFtpDaemon::Entities::Job, type: "complete"
37
-
38
- end
38
+ # Get job to display
39
+ raise RestFtpDaemon::JobNotFound if params[:id].nil?
40
+ job = RestFtpDaemon::JobQueue.instance.find_by_id(params[:id]) || RestFtpDaemon::JobQueue.instance.find_by_id(params[:id], true)
41
+ raise RestFtpDaemon::JobNotFound if job.nil?
42
+ log_debug "found job: #{job.inspect}"
43
+
44
+ # Prepare response
45
+ status 200
46
+ present job, with: RestFtpDaemon::Entities::Job, type: "complete"
39
47
  end
40
48
 
41
49
  desc "List all Jobs", http_codes: [
@@ -43,19 +51,12 @@ module RestFtpDaemon
43
51
  ],
44
52
  is_array: true
45
53
  get "/" do
46
- begin
47
- # Get jobs to display
48
- jobs = RestFtpDaemon::JobQueue.instance.jobs
49
-
50
- rescue StandardError => exception
51
- log_error "Exception: #{exception.message}"
52
- error!({ error: :api_exception, message: exception.message }, 500)
53
-
54
- else
55
- status 200
56
- present jobs, with: RestFtpDaemon::Entities::Job
54
+ # Get jobs to display
55
+ jobs = RestFtpDaemon::JobQueue.instance.jobs
57
56
 
58
- end
57
+ # Prepare response
58
+ status 200
59
+ present jobs, with: RestFtpDaemon::Entities::Job
59
60
  end
60
61
 
61
62
  desc "Create a new job"
@@ -119,6 +120,21 @@ module RestFtpDaemon
119
120
  desc: "video: custom options passed to FFMPEG encoder",
120
121
  default: {}
121
122
 
123
+ optional :options, type: Hash, desc: "Options for transfers" do
124
+ optional :overwrite,
125
+ type: Boolean,
126
+ desc: "Overwrites files at target server",
127
+ default: Conf.at(:transfer, :overwrite)
128
+ optional :mkdir,
129
+ type: Boolean,
130
+ desc: "Create missing directories on target server",
131
+ default: Conf.at(:transfer, :mkdir)
132
+ optional :tempfile,
133
+ type: Boolean,
134
+ desc: "Upload to a temp file before renaming it to the target filename",
135
+ default: Conf.at(:transfer, :tempfile)
136
+ end
137
+
122
138
  optional :overwrite,
123
139
  type: Boolean,
124
140
  desc: "Overwrites files at target server",
@@ -140,31 +156,15 @@ module RestFtpDaemon
140
156
  end
141
157
 
142
158
  post "/" do
143
- # log_debug params.to_json
144
- begin
145
- # Add up the new job on the queue
146
- job = RestFtpDaemon::JobQueue.instance.create_job(params)
159
+ # Add up the new job on the queue
160
+ job = RestFtpDaemon::JobQueue.instance.create_job(params)
147
161
 
148
- # Increment a counter
149
- RestFtpDaemon::Counters.instance.increment :jobs, :received
162
+ # Increment a counter
163
+ RestFtpDaemon::Counters.instance.increment :jobs, :received
150
164
 
151
- rescue JSON::ParserError => exception
152
- log_error "JSON::ParserError: #{exception.message}"
153
- error!({error: :api_parse_error, message: exception.message}, 422)
154
-
155
- rescue QueueCantCreateJob => exception
156
- log_error "QueueCantCreateJob: #{exception.message}"
157
- error!({error: :api_cant_create_job, message: exception.message}, 422)
158
-
159
- rescue RestFtpDaemonException => exception
160
- log_error "#{exception.class.to_s} #{exception.message}"
161
- error!({error: exception_to_error(exception), message: exception.message}, 500)
162
-
163
- else
164
- status 201
165
- present job, with: RestFtpDaemon::Entities::Job, hide_params: true
166
-
167
- end
165
+ # Prepare response
166
+ status 201
167
+ present job, with: RestFtpDaemon::Entities::Job, hide_params: true
168
168
  end
169
169
 
170
170
  end
@@ -22,12 +22,37 @@ module RestFtpDaemon
22
22
  def logger
23
23
  Root.logger
24
24
  end
25
+
26
+ def exception_error name, http_code, exception
27
+ # Extract message lines
28
+ lines = exception.message.lines.collect(&:strip).reject(&:empty?)
29
+
30
+ # Log error to file
31
+ log_error "#{http_code} [#{name}] #{lines.shift} ", lines
32
+
33
+ # Return error
34
+ error!({
35
+ error: name,
36
+ http_code: http_code,
37
+ message: exception.message
38
+ }, http_code)
39
+ end
40
+
25
41
  end
26
42
 
27
43
  before do
28
44
  log_request
29
45
  end
30
46
 
47
+
48
+ ## EXCEPTION HANDLERS
49
+ rescue_from :all do |exception|
50
+ Rollbar.error exception
51
+ #error!({error: :internal_server_error, message: exception.message}, 500)
52
+ exception_error :internal_server_error, 500, exception
53
+ end
54
+
55
+
31
56
  ### CLASS CONFIG
32
57
  logger BmcDaemonLib::LoggerPool.instance.get :api
33
58
  do_not_route_head!
@@ -50,12 +75,6 @@ module RestFtpDaemon
50
75
  put "-----"
51
76
  end
52
77
 
53
- ## GLOBAL EXCEPTION HANDLING
54
- rescue_from :all do |exception|
55
- Rollbar.error exception
56
- error_response(message: "Internal server error: #{exception}", status: 500)
57
- end
58
-
59
78
  ### MOUNTPOINTS
60
79
  mount RestFtpDaemon::API::Status => MOUNT_STATUS
61
80
  mount RestFtpDaemon::API::Jobs => MOUNT_JOBS
@@ -16,8 +16,8 @@ JOB_FFMPEG_THREADS = 2
16
16
  JOB_FFMPEG_ATTRIBUTES = [:video_codec, :video_bitrate, :video_bitrate_tolerance, :frame_rate, :resolution, :aspect, :keyframe_interval, :x264_vprofile, :x264_preset, :audio_codec, :audio_bitrate, :audio_sample_rate, :audio_channels]
17
17
 
18
18
  # Internal job infos
19
- INFO_PROGRESS = :work_progress
20
- INFO_BITRATE = :transfer_bitrate
19
+ INFO_PROGRESS = :progress
20
+ INFO_BITRATE = :bitrate
21
21
 
22
22
  # Constants: logger
23
23
  LOG_FORMAT_PROGNAME = "%d\t%s"
@@ -15,7 +15,7 @@ module RestFtpDaemon
15
15
  include BmcDaemonLib::LoggerHelper
16
16
 
17
17
  # Fields to be imported from params
18
- IMPORTED = %w(type priority pool label priority source target overwrite mkdir tempfile video_options video_custom)
18
+ IMPORTED = %w(type priority pool label priority source target overwrite notify mkdir tempfile video_options video_custom)
19
19
 
20
20
  # Class options
21
21
  attr_accessor :wid
@@ -145,63 +145,79 @@ module RestFtpDaemon
145
145
 
146
146
  # Compute final bitrate
147
147
  global_transfer_bitrate = get_bitrate @transfer_total, (Time.now - transfer_started_at)
148
- set_info :transfer_bitrate, global_transfer_bitrate.round(0)
148
+ set_info INFO_BITRATE, global_transfer_bitrate.round(0)
149
149
 
150
150
  # Done
151
151
  set_info :source_current, nil
152
152
  end
153
153
 
154
154
  def update_progress transferred, name = ""
155
- # What's current time ?
156
- now = Time.now
157
- notify_after = @config[:notify_after]
158
-
159
155
  # Update counters
160
156
  @transfer_sent += transferred
161
157
  set_info :work_sent, @transfer_sent
162
158
 
163
159
  # Update job info
164
160
  percent0 = (100.0 * @transfer_sent / @transfer_total).round(0)
165
- set_info INFO_PROGRESS, percent0
166
-
167
- # Update job status after each NOTIFY_UPADE_STATUS
168
- progressed_ago = (now.to_f - @progress_at.to_f)
169
- if (!JOB_UPDATE_INTERVAL.to_f.zero?) && (progressed_ago > JOB_UPDATE_INTERVAL.to_f)
170
- @current_bitrate = running_bitrate @transfer_sent
171
- set_info :transfer_bitrate, @current_bitrate.round(0)
172
-
173
- # Log progress
174
- stack = []
175
- stack << "#{percent0} %"
176
- stack << (format_bytes @transfer_sent, "B")
177
- stack << (format_bytes @transfer_total, "B")
178
- stack << (format_bytes @current_bitrate.round(0), "bps")
179
- stack2 = stack.map { |txt| ("%#{LOG_PIPE_LEN.to_i}s" % txt) }.join("\t")
180
- log_debug "progress #{stack2} \t#{name}"
181
-
182
- # Remember when we last did it
183
- @progress_at = now
184
- end
161
+ set_info INFO_PROGRESS, percent0
162
+
163
+ # What's current time ?
164
+ now = Time.now
165
+
166
+ # Update job status
167
+ update_progress_jobinfo now, percent0, name
185
168
 
186
169
  # Notify if requested
187
- notified_ago = (now.to_f - @notified_at.to_f)
188
- if (!notify_after.nil?) && (notified_ago > notify_after)
189
- # Prepare and send notification
190
- notif_status = {
191
- progress: percent0,
192
- transfer_sent: @transfer_sent,
193
- transfer_total: @transfer_total,
194
- transfer_bitrate: @current_bitrate.round(0),
195
- }
196
- client_notify :progress, status: notif_status
197
-
198
- # Remember when we last did it
199
- @notified_at = now
200
- end
170
+ update_progress_notify now, percent0, name
201
171
  end
202
172
 
203
173
  private
204
174
 
175
+ def update_progress_jobinfo now, percent0, name
176
+ # No delay provided ?
177
+ return if JOB_UPDATE_INTERVAL.to_f.zero?
178
+
179
+ # Still too early to notify again ?
180
+ how_long_ago = (now.to_f - @progress_at.to_f)
181
+ return unless how_long_ago > JOB_UPDATE_INTERVAL.to_f
182
+
183
+ # Update bitrates
184
+ @current_bitrate = running_bitrate @transfer_sent
185
+ set_info INFO_BITRATE, @current_bitrate.round(0)
186
+
187
+ # Log progress
188
+ stack = [
189
+ "#{percent0} %",
190
+ format_bytes(@transfer_sent, "B"),
191
+ format_bytes(@current_bitrate.round(0), "bps")
192
+ ]
193
+ stack2 = stack.map { |txt| ("%#{LOG_PIPE_LEN.to_i}s" % txt) }.join("\t")
194
+ log_debug "progress #{stack2} \t#{name}"
195
+
196
+ # Remember when we last did it
197
+ @progress_at = now
198
+ end
199
+
200
+ def update_progress_notify now, percent0, name
201
+ # No delay provided ?
202
+ return if @config[:notify_after].nil?
203
+
204
+ # Still too early to notify again ?
205
+ how_long_ago = (now.to_f - @notified_at.to_f)
206
+ return unless how_long_ago > @config[:notify_after]
207
+
208
+ # Prepare and send notification
209
+ client_notify :progress, status: {
210
+ progress: percent0,
211
+ transfer_sent: @transfer_sent,
212
+ transfer_total: @transfer_total,
213
+ transfer_bitrate: @current_bitrate.round(0),
214
+ transfer_current: name,
215
+ }
216
+
217
+ # Remember when we last did it
218
+ @notified_at = now
219
+ end
220
+
205
221
  def get_bitrate delta_data, delta_time
206
222
  return nil if delta_time.nil? || delta_time.zero?
207
223
  8 * delta_data.to_f.to_f / delta_time
@@ -35,37 +35,14 @@ module RestFtpDaemon
35
35
  job = RestFtpDaemon::JobQueue.instance.pop @pool
36
36
 
37
37
  # Work on this job
38
- work_on_job(job)
38
+ work_on_job job
39
39
 
40
40
  # Clean job status
41
41
  job.wid = nil
42
42
  #sleep 1
43
43
 
44
- # If job status requires a retry, just restack it
45
- if !job.error
46
- #log_info "job succeeded"
47
-
48
- elsif !(@config[:retry_on].is_a?(Enumerable) && @config[:retry_on].include?(job.error))
49
- log_error "not retrying: error not eligible"
50
-
51
- elsif @config[:retry_for] && (job.age >= @config[:retry_for])
52
- log_error "not retrying: max_age reached (#{@config[:retry_for]} s)"
53
-
54
- elsif @config[:retry_max] && (job.runs >= @config[:retry_max])
55
- log_error "not retrying: max_runs reached (#{@config[:retry_max]} tries)"
56
-
57
- else
58
- # Delay cannot be negative, and will be 1s minimum
59
- retry_after = [@config[:retry_after] || DEFAULT_RETRY_AFTER, 1].max
60
- log_info "retrying job: waiting for #{retry_after} seconds"
61
-
62
- # Wait !
63
- sleep retry_after
64
- log_info "retrying job: requeued after delay"
65
-
66
- # Now, requeue this job
67
- RestFtpDaemon::JobQueue.instance.requeue job
68
- end
44
+ # Handle the retry if needed
45
+ handle_job_result job
69
46
  end
70
47
 
71
48
  def work_on_job job
@@ -92,26 +69,40 @@ module RestFtpDaemon
92
69
  # Inform the job
93
70
  job.oops_you_stop_now ex unless job.nil?
94
71
 
95
- rescue RestFtpDaemon::AttributeMissing => ex
96
- log_error "JOB MISSING ATTRIBUTE", ex.backtrace
72
+ rescue RestFtpDaemon::AssertionFailed, RestFtpDaemon::AttributeMissing, StandardError => ex
73
+ log_error "JOB EXCEPTION ex[#{ex.class}] #{ex.message}", ex.backtrace
97
74
  worker_status WORKER_STATUS_CRASHED
98
75
 
99
76
  # Inform the job
100
- job.oops_you_stop_now ex unless job.nil?
77
+ job.oops_after_crash ex unless job.nil?
78
+ end
101
79
 
102
- rescue RestFtpDaemon::AssertionFailed => ex
103
- log_error "JOB ASSERTION FAILED", ex.backtrace
104
- worker_status WORKER_STATUS_CRASHED
80
+ def handle_job_result job
81
+ # If job status requires a retry, just restack it
82
+ if !job.error
83
+ #log_info "job succeeded"
105
84
 
106
- # Inform the job
107
- job.oops_you_stop_now ex unless job.nil?
85
+ elsif !(@config[:retry_on].is_a?(Enumerable) && @config[:retry_on].include?(job.error))
86
+ log_error "not retrying: error not eligible"
108
87
 
109
- rescue StandardError => ex
110
- log_error "JOB UNHANDLED EXCEPTION ex[#{ex.class}] #{ex.message}", ex.backtrace
111
- worker_status WORKER_STATUS_CRASHED
88
+ elsif @config[:retry_for] && (job.age >= @config[:retry_for])
89
+ log_error "not retrying: max_age reached (#{@config[:retry_for]} s)"
112
90
 
113
- # Inform the job
114
- job.oops_after_crash ex unless job.nil?
91
+ elsif @config[:retry_max] && (job.runs >= @config[:retry_max])
92
+ log_error "not retrying: max_runs reached (#{@config[:retry_max]} tries)"
93
+
94
+ else
95
+ # Delay cannot be negative, and will be 1s minimum
96
+ retry_after = [@config[:retry_after] || DEFAULT_RETRY_AFTER, 1].max
97
+ log_info "retrying job: waiting for #{retry_after} seconds"
98
+
99
+ # Wait !
100
+ sleep retry_after
101
+ log_info "retrying job: requeued after delay"
102
+
103
+ # Now, requeue this job
104
+ RestFtpDaemon::JobQueue.instance.requeue job
105
+ end
115
106
  end
116
107
 
117
108
  end
@@ -2,7 +2,7 @@
2
2
  Gem::Specification.new do |spec|
3
3
 
4
4
  # Project version
5
- spec.version = "0.424.0"
5
+ spec.version = "0.424.2"
6
6
 
7
7
  # Project description
8
8
  spec.name = "rest-ftp-daemon"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rest-ftp-daemon
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.424.0
4
+ version: 0.424.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Bruno MEDICI
@@ -414,8 +414,6 @@ files:
414
414
  - lib/rest-ftp-daemon/api/dashboard.rb
415
415
  - lib/rest-ftp-daemon/api/debug.rb
416
416
  - lib/rest-ftp-daemon/api/jobs.rb
417
- - lib/rest-ftp-daemon/api/root-real.rb
418
- - lib/rest-ftp-daemon/api/root-test.rb
419
417
  - lib/rest-ftp-daemon/api/root.rb
420
418
  - lib/rest-ftp-daemon/api/status.rb
421
419
  - lib/rest-ftp-daemon/constants.rb
@@ -1,80 +0,0 @@
1
- require "grape"
2
- require 'grape-swagger'
3
-
4
- module RestFtpDaemon
5
- module API
6
- class Root < Grape::API
7
- include ::NewRelic::Agent::Instrumentation::ControllerInstrumentation
8
-
9
- ### LOGGING & HELPERS
10
- helpers RestFtpDaemon::CommonHelpers
11
- helpers RestFtpDaemon::ApiHelpers
12
- helpers BmcDaemonLib::LoggerHelper
13
-
14
- helpers do
15
- def log_prefix
16
- ['API', nil, nil]
17
- end
18
-
19
- def logger
20
- Root.logger
21
- end
22
- end
23
-
24
- before do
25
- log_request
26
- end
27
-
28
- ### CLASS CONFIG
29
- logger BmcDaemonLib::LoggerPool.instance.get :api
30
- do_not_route_head!
31
- do_not_route_options!
32
- # version 'v1'
33
- format :json
34
- content_type :json, 'application/json; charset=utf-8'
35
-
36
-
37
- desc 'API Root'
38
-
39
- ### MOUNTPOINTS
40
- # mount RestFtpDaemon::API::Status => MOUNT_STATUS
41
- # mount RestFtpDaemon::API::Jobs => MOUNT_JOBS
42
- # mount RestFtpDaemon::API::Dashbaord => MOUNT_BOARD
43
- # mount RestFtpDaemon::API::Config => MOUNT_CONFIG
44
- # mount RestFtpDaemon::API::Debug => MOUNT_DEBUG
45
-
46
-
47
- ### API Documentation
48
- add_swagger_documentation hide_documentation_path: true,
49
- api_version: BmcDaemonLib::Conf.app_ver,
50
- doc_version: BmcDaemonLib::Conf.app_ver,
51
- mount_path: MOUNT_SWAGGER_JSON,
52
- info: {
53
- title: BmcDaemonLib::Conf.app_name,
54
- version: BmcDaemonLib::Conf.app_ver,
55
- description: "API description for #{BmcDaemonLib::Conf.app_name} #{BmcDaemonLib::Conf.app_ver}",
56
- }
57
- # models: [
58
- # RestFtpDaemon::Entities::Job,
59
- # ]
60
-
61
- ### GLOBAL EXCEPTION HANDLING
62
- # rescue_from :all do |e|
63
- # raise e
64
- # error_response(message: "Internal server error: #{e}", status: 500)
65
- # end
66
-
67
-
68
- ### INITIALIZATION
69
- def initialize
70
- super
71
- end
72
-
73
- ### ENDPOINTS
74
- get "/" do
75
- redirect dashboard_url()
76
- end
77
-
78
- end
79
- end
80
- end
@@ -1,69 +0,0 @@
1
- require "grape"
2
- require 'grape-swagger'
3
-
4
- module RestFtpDaemon
5
- module API
6
- class Root < Grape::API
7
-
8
- ### API Documentation
9
- add_swagger_documentation hide_documentation_path: true,
10
- api_version: Conf.app_ver,
11
- doc_version: Conf.app_ver,
12
- mount_path: MOUNT_SWAGGER_JSON,
13
- info: {
14
- title: Conf.app_name,
15
- version: Conf.app_ver,
16
- description: "API description for #{Conf.app_name} #{Conf.app_ver}",
17
- }
18
-
19
-
20
- namespace :hudson do
21
- desc 'Document root'
22
- get '/' do
23
- end
24
- end
25
-
26
- namespace :hudson do
27
- desc 'This gets something.',
28
- notes: '_test_'
29
-
30
- get '/simple' do
31
- { bla: 'something' }
32
- end
33
- end
34
-
35
- namespace :colorado do
36
- desc 'This gets something for URL using - separator.',
37
- notes: '_test_'
38
-
39
- get '/simple-test' do
40
- { bla: 'something' }
41
- end
42
-
43
-
44
- desc "List all Jobs", http_codes: [
45
- { code: 200, message: "Here are the jobs you requested" },
46
- ],
47
- is_array: true
48
- get "/" do
49
- begin
50
- # Get jobs to display
51
- jobs = RestFtpDaemon::JobQueue.instance.jobs
52
-
53
- rescue StandardError => exception
54
- log_error "Exception: #{exception.message}"
55
- error!({ error: :api_exception, message: exception.message }, 500)
56
-
57
- else
58
- status 200
59
- present jobs, with: RestFtpDaemon::Entities::Job
60
-
61
- end
62
- end
63
-
64
-
65
- end
66
-
67
- end
68
- end
69
- end