iron_worker_ng 0.10.2 → 0.10.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (37) hide show
  1. data/bin/iron_worker +130 -323
  2. data/lib/iron_worker_ng/cli.rb +275 -0
  3. data/lib/iron_worker_ng/client.rb +32 -20
  4. data/lib/iron_worker_ng/code/base.rb +45 -37
  5. data/lib/iron_worker_ng/code/builder.rb +4 -3
  6. data/lib/iron_worker_ng/code/container/base.rb +31 -0
  7. data/lib/iron_worker_ng/code/container/dir.rb +31 -0
  8. data/lib/iron_worker_ng/code/container/zip.rb +30 -0
  9. data/lib/iron_worker_ng/code/runtime/binary.rb +1 -3
  10. data/lib/iron_worker_ng/code/runtime/go.rb +1 -3
  11. data/lib/iron_worker_ng/code/runtime/java.rb +2 -3
  12. data/lib/iron_worker_ng/code/runtime/mono.rb +1 -3
  13. data/lib/iron_worker_ng/code/runtime/node.rb +1 -3
  14. data/lib/iron_worker_ng/code/runtime/perl.rb +1 -3
  15. data/lib/iron_worker_ng/code/runtime/php.rb +1 -3
  16. data/lib/iron_worker_ng/code/runtime/python.rb +1 -3
  17. data/lib/iron_worker_ng/code/runtime/ruby.rb +11 -9
  18. data/lib/iron_worker_ng/feature/base.rb +14 -20
  19. data/lib/iron_worker_ng/feature/common/merge_dir.rb +14 -5
  20. data/lib/iron_worker_ng/feature/common/merge_exec.rb +79 -0
  21. data/lib/iron_worker_ng/feature/common/merge_file.rb +13 -4
  22. data/lib/iron_worker_ng/feature/java/merge_jar.rb +12 -0
  23. data/lib/iron_worker_ng/feature/ruby/merge_gem.rb +11 -55
  24. data/lib/iron_worker_ng/feature/ruby/merge_gem_dependency.rb +76 -0
  25. data/lib/iron_worker_ng/fetcher.rb +39 -18
  26. data/lib/iron_worker_ng/version.rb +1 -1
  27. metadata +45 -17
  28. data/lib/iron_worker_ng/code/dir_container.rb +0 -33
  29. data/lib/iron_worker_ng/feature/binary/merge_exec.rb +0 -51
  30. data/lib/iron_worker_ng/feature/go/merge_exec.rb +0 -51
  31. data/lib/iron_worker_ng/feature/java/merge_exec.rb +0 -57
  32. data/lib/iron_worker_ng/feature/mono/merge_exec.rb +0 -51
  33. data/lib/iron_worker_ng/feature/node/merge_exec.rb +0 -51
  34. data/lib/iron_worker_ng/feature/perl/merge_exec.rb +0 -51
  35. data/lib/iron_worker_ng/feature/php/merge_exec.rb +0 -51
  36. data/lib/iron_worker_ng/feature/python/merge_exec.rb +0 -51
  37. data/lib/iron_worker_ng/feature/ruby/merge_exec.rb +0 -53
data/bin/iron_worker CHANGED
@@ -2,69 +2,42 @@
2
2
 
3
3
  require 'optparse'
4
4
  require 'time'
5
- require 'iron_worker_ng'
6
5
 
7
- LOG_GROUP = '------> '
8
- LOG_ENTRY = ' '
6
+ require 'iron_worker_ng'
7
+ require 'iron_worker_ng/cli'
9
8
 
10
9
  class IronWorkerCLILoggerFormatter < ::Logger::Formatter
11
10
  def call(severity, time, proname, msg)
12
- msg = LOG_ENTRY + msg unless msg.start_with?(LOG_GROUP)
11
+ msg = IronWorkerNG::CLI::LOG_ENTRY + msg unless msg.start_with?(IronWorkerNG::CLI::LOG_GROUP)
12
+
13
13
  msg + "\n"
14
14
  end
15
15
  end
16
16
 
17
17
  IronCore::Logger.logger.formatter = IronWorkerCLILoggerFormatter.new
18
18
 
19
- def log(msg)
20
- IronCore::Logger.info 'IronWorkerNG', msg
21
- end
22
-
23
- @env = nil
24
- @project_id = nil
25
-
26
- def create_client
27
- log "#{LOG_GROUP}Detecting Configuration"
28
-
29
- client = IronWorkerNG::Client.new(:env => @env, :project_id => @project_id)
30
-
31
- project = client.projects.get
32
-
33
- log "Project '#{project.name}' with id='#{project.id}'"
34
-
35
- client
36
- end
19
+ @cli = IronWorkerNG::CLI.new
37
20
 
38
21
  def common_opts(opts)
39
22
  opts.on('-e', '--env ENV', 'environment') do |v|
40
- @env = v
23
+ @cli.env = v
41
24
  end
42
25
 
43
26
  opts.on('--project-id PROJECT_ID', 'project_id') do |v|
44
- @project_id = v
27
+ @cli.project_id = v
45
28
  end
46
29
  end
47
30
 
48
- def parse_time(str)
49
- t = Time.parse(str)
50
-
51
- return nil if t == Time.utc(1)
52
-
53
- def t.to_s
54
- strftime('%a %b %-d %T')
55
- end
56
-
57
- return t
58
- end
59
-
60
31
  if $*.size == 1 && ($*[0] == '-v' || $*[0] == '--version')
61
32
  puts IronWorkerNG.full_version
62
33
  exit 0
63
34
  end
64
35
 
65
- if $*.size == 0 || (not ['upload', 'queue', 'retry', 'schedule', 'log', 'run', 'webhook', 'info', 'install'].include?($*[0]))
36
+ commands = ['upload', 'queue', 'retry', 'schedule', 'log', 'run', 'install', 'webhook', 'info']
37
+
38
+ if $*.size == 0 || (not commands.include?($*[0]))
66
39
  puts 'usage: iron_worker COMMAND [OPTIONS]'
67
- puts ' COMMAND: upload, queue, retry, schedule, log, run, webhook, info, install'
40
+ puts " COMMAND: #{commands.join(', ')}"
68
41
  puts ' run iron_worker COMMAND --help to get more information about each command'
69
42
  exit 1
70
43
  end
@@ -78,29 +51,30 @@ if $*.include?('--debug')
78
51
  end
79
52
 
80
53
  if command == 'upload'
54
+ params = {}
81
55
  options = {}
82
56
 
83
- name = nil
84
-
85
57
  opts = OptionParser.new do |opts|
86
58
  opts.banner = "usage: iron_worker upload CODE_PACKAGE_NAME_OR_PATH_TO_WORKERFILE [OPTIONS]"
87
59
 
88
- opts.on('-n', '--name NAME', 'override for code name') do |v|
89
- name = v
60
+ opts.on('-n', '--name NAME', 'override code name') do |v|
61
+ params[:name] = v
90
62
  end
91
63
 
92
64
  opts.on('-c', '--max-concurrency CONCURRENCY', Integer, 'max number of concurrent workers for this code package') do |v|
93
65
  options[:max_concurrency] = v
94
66
  end
95
67
 
96
- if ENV['IRON_BETA'] == '1'
97
- opts.on('-r', '--num-retries NUM_RETRIES', Integer, 'max number of automatic retries on task fail') do |v|
98
- options[:num_retries] = v
99
- end
68
+ opts.on('-r', '--retries NUM_RETRIES', Integer, 'max number of automatic retries on task fail') do |v|
69
+ options[:retries] = v
70
+ end
71
+
72
+ opts.on('-d', '--retries-delay RETRIES_DELAY', Integer, 'delay between each automatic retry') do |v|
73
+ options[:retries_delay] = v
100
74
  end
101
75
 
102
- opts.on('-a', '--async', 'don\'t wait for package build') do |v|
103
- options[:async] = true
76
+ opts.on('-a', '--async', 'don\'t wait for package build if remote build command specified') do |v|
77
+ params[:async] = true
104
78
  end
105
79
 
106
80
  common_opts(opts)
@@ -114,104 +88,57 @@ if command == 'upload'
114
88
  end
115
89
 
116
90
  unless $*.size == 1
117
- puts 'Please specify name or path to workerfile'
91
+ puts 'Please specify code package name or path to workerfile'
118
92
  puts opts
119
93
  exit 1
120
94
  end
121
95
 
122
- client = create_client
123
-
124
- log "#{LOG_GROUP}Discovering workerfile"
125
-
126
- code = IronWorkerNG::Code::Base.new($*[0])
127
-
128
- code.name(name) if name
129
-
130
- log "Code package name is '#{code.name}'"
131
-
132
- log "Max concurrency set to '#{options[:max_concurrency]}'" if options[:max_concurrency]
133
-
134
- if code.remote_build_command
135
- log "#{LOG_GROUP}Remote building '#{code.name}'"
136
-
137
- async = options[:async]
138
-
139
- builder_task_id = client.codes.create(code, options)
140
-
141
- if async
142
- log "Check 'https://hud.iron.io/tq/projects/#{client.api.project_id}/jobs/#{builder_task_id}' for more info"
143
- else
144
- # TODO: output the same info as for builderless upload
145
- end
146
- else
147
- log "#{LOG_GROUP}Uploading code package"
148
-
149
- code_id = client.codes.create(code, options).id
150
- code_info = client.codes.get(code_id)
151
-
152
- log "Code package uploaded with id='#{code_id}' and revision='#{code_info.rev}'"
153
- log "Check 'https://hud.iron.io/tq/projects/#{client.api.project_id}/code/#{code_id}' for more info"
154
- end
96
+ @cli.upload($*[0], params, options)
155
97
  elsif command == 'queue' || command == 'schedule'
156
- payload = nil
157
- payload_file = nil
158
-
159
- priority = nil
160
- timeout = nil
161
- delay = nil
162
-
163
- start_at = nil
164
- end_at = nil
165
- run_times = nil
166
- run_every = nil
167
-
168
- print_id = false
98
+ params = {}
99
+ options = {}
169
100
 
170
101
  opts = OptionParser.new do |opts|
171
102
  opts.banner = "usage: iron_worker #{command} CODE_PACKAGE_NAME [OPTIONS]"
172
103
 
173
104
  opts.on('-p', '--payload PAYLOAD', String, 'payload to pass') do |v|
174
- payload = v
105
+ params[:payload] = v
175
106
  end
176
107
 
177
108
  opts.on('-f', '--payload-file PAYLOAD_FILE', String, 'payload file to pass') do |v|
178
- payload_file = v
109
+ params[:payload] = File.read(v)
179
110
  end
180
111
 
181
112
  opts.on('--priority PRIORITY', Integer, '0 (default), 1, 2') do |v|
182
- priority = v
113
+ options[:priority] = v
183
114
  end
184
115
 
185
116
  opts.on('--timeout TIMEOUT', Integer, 'maximum run time in seconds from 0 to 3600 (default)') do |v|
186
- timeout = v
117
+ options[:timeout] = v
187
118
  end
188
119
 
189
120
  opts.on('--delay DELAY', Integer, 'delay before start in seconds') do |v|
190
- delay = v
121
+ options[:delay] = v
191
122
  end
192
123
 
193
124
  if command == 'schedule'
194
125
  opts.on('--start-at TIME', 'start task at specified time') do |v|
195
- start_at = Time.parse(v)
126
+ options[:start_at] = Time.parse(v)
196
127
  end
197
128
 
198
129
  opts.on('--end-at TIME', 'stop running task at specified time') do |v|
199
- end_at = Time.parse(v)
130
+ options[:end_at] = Time.parse(v)
200
131
  end
201
132
 
202
133
  opts.on('--run-times RUN_TIMES', Integer, 'run task no more times than specified') do |v|
203
- run_times = v
134
+ options[:run_times] = v
204
135
  end
205
136
 
206
137
  opts.on('--run-every RUN_EVERY', Integer, 'run task every RUN_EVERY seconds') do |v|
207
- run_every = v
138
+ options[:run_every] = v
208
139
  end
209
140
  end
210
141
 
211
- opts.on('--print-id', 'prints result id') do |v|
212
- print_id = true
213
- end
214
-
215
142
  common_opts(opts)
216
143
  end
217
144
 
@@ -228,49 +155,13 @@ elsif command == 'queue' || command == 'schedule'
228
155
  exit 1
229
156
  end
230
157
 
231
- name = $*[0]
232
-
233
- if payload.nil? and (not payload_file.nil?)
234
- payload = File.read(payload_file)
235
- end
236
-
237
- options = {}
238
-
239
- options[:priority] = priority unless priority.nil?
240
- options[:timeout] = timeout unless timeout.nil?
241
- options[:delay] = delay unless delay.nil?
242
-
243
- if command == 'schedule'
244
- options[:start_at] = start_at unless start_at.nil?
245
- options[:end_at] = end_at unless end_at.nil?
246
- options[:run_times] = run_times unless run_times.nil?
247
- options[:run_every] = run_every unless run_every.nil?
248
- end
249
-
250
- client = create_client
251
-
252
- id = nil
253
-
254
158
  if command == 'queue'
255
- log "#{LOG_GROUP}Queueing task"
256
-
257
- id = client.tasks.create(name, payload, options).id
258
-
259
- log "#{LOG_GROUP}Worker '#{name}' queued with id='#{id}'"
260
-
261
- log "Check 'https://hud.iron.io/tq/projects/#{client.api.project_id}/jobs/#{id}' for more info"
159
+ @cli.queue($*[0], params, options)
262
160
  else
263
- log "#{LOG_GROUP}Scheduling task"
264
-
265
- id = client.schedules.create(name, payload, options).id
266
-
267
- log "#{LOG_GROUP}Worker '#{name}' scheduled with id='#{id}'"
268
-
269
- log "Check 'https://hud.iron.io/tq/projects/#{client.api.project_id}/scheduled_jobs/#{id}' for more info"
161
+ @cli.schedule($*[0], params, options)
270
162
  end
271
-
272
- puts id if print_id
273
163
  elsif command == 'retry'
164
+ params = {}
274
165
  options = {}
275
166
 
276
167
  opts = OptionParser.new do |opts|
@@ -296,26 +187,16 @@ elsif command == 'retry'
296
187
  exit 1
297
188
  end
298
189
 
299
- task_id = $*.first
300
-
301
- client = create_client
302
-
303
- log "#{LOG_GROUP}Retrying task with id='#{task_id}'"
304
-
305
- retry_task_id = client.tasks.retry(task_id, options).id
306
-
307
- log "Retry task id='#{retry_task_id}'"
308
-
309
- log "Check 'https://hud.iron.io/tq/projects/#{client.api.project_id}/jobs/#{retry_task_id}' for more info"
190
+ @cli.retry($*[0], params, options)
310
191
  elsif command == 'log'
311
- live = false
312
- wait = false
192
+ params = {}
193
+ options = {}
313
194
 
314
195
  opts = OptionParser.new do |opts|
315
196
  opts.banner = "usage: iron_worker log TASK_ID [OPTIONS]"
316
197
 
317
198
  opts.on('-w', '--wait', 'wait for task') do |v|
318
- wait = true
199
+ params[:wait] = true
319
200
  end
320
201
 
321
202
  common_opts(opts)
@@ -334,60 +215,20 @@ elsif command == 'log'
334
215
  exit 1
335
216
  end
336
217
 
337
- task_id = $*.first
338
-
339
- client = create_client
340
-
341
- log "#{LOG_GROUP}Getting log for task with id='#{task_id}'"
342
-
343
- log = ''
344
-
345
- if live
346
- begin
347
- log = client.tasks.log(task_id)
348
- rescue IronCore::Error
349
- end
350
- else
351
- if wait
352
- client.tasks.wait_for(task_id)
353
- end
354
-
355
- log = client.tasks.log(task_id)
356
- end
357
-
358
- print log
359
-
360
- if live
361
- client.tasks.wait_for(task_id) do |task|
362
- if task.status == 'running'
363
- begin
364
- next_log = client.tasks.log(task_id)
365
- print next_log[log.length .. - 1]
366
- log = next_log
367
- rescue IronCore::Error
368
- end
369
- end
370
- end
371
-
372
- begin
373
- next_log = client.tasks.log(task_id)
374
- print next_log[log.length .. - 1]
375
- rescue IronCore::Error
376
- end
377
- end
218
+ @cli.getlog($*[0], params, options)
378
219
  elsif command == 'run'
379
- payload = nil
380
- payload_file = nil
220
+ params = {}
221
+ options = {}
381
222
 
382
223
  opts = OptionParser.new do |opts|
383
224
  opts.banner = "usage: iron_worker run CODE_PACKAGE_NAME_OR_PATH_TO_WORKERFILE [OPTIONS]"
384
225
 
385
226
  opts.on('-p', '--payload PAYLOAD', String, 'payload to pass') do |v|
386
- payload = v
227
+ params[:payload] = v
387
228
  end
388
229
 
389
230
  opts.on('-f', '--payload-file PAYLOAD_FILE', String, 'payload file to pass') do |v|
390
- payload_file = v
231
+ params[:payload] = File.read(v)
391
232
  end
392
233
 
393
234
  common_opts(opts)
@@ -406,20 +247,35 @@ elsif command == 'run'
406
247
  exit 1
407
248
  end
408
249
 
409
- if payload.nil? and (not payload_file.nil?)
410
- payload = File.read(payload_file)
411
- end
250
+ @cli.run($*[0], params, options)
251
+ elsif command == 'install'
252
+ params = {}
253
+ options = {}
412
254
 
413
- log "#{LOG_GROUP}Discovering workerfile"
255
+ opts = OptionParser.new do |opts|
256
+ opts.banner = 'usage: iron_worker install CODE_PACKAGE_NAME_OR_PATH_TO_WORKERFILE [OPTIONS]'
414
257
 
415
- code = IronWorkerNG::Code::Base.new($*.first)
258
+ common_opts(opts)
259
+ end
416
260
 
417
- log "Code package name is '#{code.name}'"
261
+ begin
262
+ opts.parse!
263
+ rescue OptionParser::ParseError
264
+ puts $!.to_s
265
+ exit 1
266
+ end
418
267
 
419
- log "#{LOG_GROUP}Running '#{code.name}'"
268
+ unless $*.size == 1
269
+ puts 'Please specify code package name or path to workerfile'
270
+ puts opts
271
+ exit 1
272
+ end
420
273
 
421
- code.run(payload)
274
+ @cli.install($*[0], params, options)
422
275
  elsif command == 'webhook'
276
+ params = {}
277
+ options = {}
278
+
423
279
  opts = OptionParser.new do |opts|
424
280
  opts.banner = 'usage: iron_worker webhook CODE_PACKAGE_NAME [OPTIONS]'
425
281
 
@@ -439,139 +295,90 @@ elsif command == 'webhook'
439
295
  exit 1
440
296
  end
441
297
 
442
- name = $*[0]
443
-
444
- client = create_client
445
-
446
- log "#{LOG_GROUP}Detecting webhook for code package with name='#{name}'"
447
- log "Use POST to 'https://worker-aws-us-east-1.iron.io/2/projects/#{client.api.project_id}/tasks/webhook?code_name=#{name}&oauth=#{client.api.token}' to invoke worker via webhook"
298
+ @cli.webhook($*[0], params, options)
448
299
  elsif command == 'info'
449
- unless $*.size == 2 or %w(info task ).include? $*.first
450
- puts 'Usage: iron_worker info <code|task|schedule> NAME_OR_ID'
300
+ entities = ['code', 'task', 'schedule']
301
+
302
+ if $*.size == 0 || (not entities.include?($*[0]))
303
+ puts 'usage: iron_worker info ENTITY [OPTIONS]'
304
+ puts " ENTITY: #{entities.join(', ')}"
305
+ puts ' run iron_worker info ENTITY --help to get more information about each entity'
451
306
  exit 1
452
307
  end
453
308
 
454
- entity, id = $*
455
- client = create_client
309
+ entity = $*.shift
456
310
 
457
311
  if entity == 'code'
458
- code = client.codes.list(:all => true).find { |c| c.name == id }
312
+ params = {}
313
+ options = {}
459
314
 
460
- unless code
461
- log "#{LOG_GROUP}Code named '#{id}' not found"
462
- exit 1
463
- end
315
+ opts = OptionParser.new do |opts|
316
+ opts.banner = "usage: iron_worker info code CODE_PACAKGE_NAME [OPTIONS]"
464
317
 
465
- latest_change = parse_time(code.latest_change)
466
- created_at = parse_time(code.created_at)
467
- (<<EOL
468
- #{LOG_GROUP}Code package '#{code.name}'
469
- ID: #{code.id}
470
- Created: #{created_at}
471
- Last Modified: #{latest_change}
472
- Revision: #{code.rev}
473
- All Revisions: https://hud.iron.io/tq/projects/#{client.api.project_id}/code/#{code.id}
474
- Tasks: https://hud.iron.io/tq/projects/#{client.api.project_id}/jobs/#{code.id}/activity
475
- EOL
476
- ).lines.each{ |msg| log msg.chomp }
477
- end
318
+ common_opts(opts)
319
+ end
478
320
 
479
- if entity == 'task'
480
321
  begin
481
- prev_level = IronCore::Logger.logger.level
482
- IronCore::Logger.logger.level = ::Logger::FATAL
483
- task = client.tasks.get(id)
484
- rescue IronCore::Error, Rest::RestError
485
- # iron_core throws exception if id not found
486
- IronCore::Logger.logger.level = prev_level
487
- log "#{LOG_GROUP}Task with id #{id} not found"
488
- exit(1)
489
- ensure
490
- IronCore::Logger.logger.level = prev_level
322
+ opts.parse!
323
+ rescue OptionParser::ParseError
324
+ puts $!.to_s
325
+ exit 1
491
326
  end
492
327
 
493
- queued = parse_time(task.created_at)
494
- started = parse_time(task.start_time)
495
- finished = parse_time(task.end_time)
328
+ unless $*.size == 1
329
+ puts 'Please specify code package name'
330
+ puts opts
331
+ exit 1
332
+ end
496
333
 
497
- if finished
498
- total = finished - started
334
+ @cli.info_code($*[0], params, options)
335
+ elsif entity == 'task'
336
+ params = {}
337
+ options = {}
499
338
 
500
- seconds = total % 60
501
- minutes = (total / 60) % 60
502
- hours = total / (60 * 60)
339
+ opts = OptionParser.new do |opts|
340
+ opts.banner = "usage: iron_worker info task TASK_ID [OPTIONS]"
503
341
 
504
- duration = format("%02d:%02d:%02d", hours, minutes, seconds)
342
+ common_opts(opts)
505
343
  end
506
344
 
507
- log "#{LOG_GROUP}Task id #{id} found"
508
- log "Code Package: '#{task.code_name}', rev #{task.code_rev}, download: https://hud.iron.io/tq/projects/#{client.api.project_id}/code/#{task.code_id}/download?hid=#{task.code_history_id}"
509
- log " Status: #{task.status}"
510
- log " Priority: #{task.priority}" if task.priority
511
- log " Queued: #{queued}"
512
- log " Started: #{started}" if started
513
- log " Finished: #{finished}" if finished
514
- log " Duration: #{duration}" if finished
515
- log " Payload: #{task.payload}" unless task.payload == 'null'
516
- log "Task Details: https://hud.iron.io/tq/projects/#{client.api.project_id}/jobs/#{task.id}"
517
- end
518
-
519
- if entity == 'schedule'
520
345
  begin
521
- prev_level = IronCore::Logger.logger.level
522
- IronCore::Logger.logger.level = ::Logger::FATAL
523
- schedule = client.schedules.get(id)
524
- rescue IronCore::Error, Rest::RestError
525
- # iron_core throws exception if id not found
526
- IronCore::Logger.logger.level = prev_level
527
- log "#{LOG_GROUP}Schedule with id #{id} not found"
528
- exit(1)
529
- ensure
530
- IronCore::Logger.logger.level = prev_level
346
+ opts.parse!
347
+ rescue OptionParser::ParseError
348
+ puts $!.to_s
349
+ exit 1
531
350
  end
532
351
 
533
- start_at = parse_time(schedule.start_at)
534
- end_at = parse_time(schedule.end_at)
535
- next_start = parse_time(schedule.next_start)
536
- last_run_time = parse_time(schedule.last_run_time)
537
-
538
- log "#{LOG_GROUP}Schedule id #{id} found"
539
- log " Code Name: #{schedule.code_name}"
540
- log " Created: #{parse_time(schedule.created_at)}"
541
- log " Message: #{schedule.msg}" if schedule.msg
542
- log " Status: #{schedule.status}"
543
- log " Start: #{start_at}" if start_at
544
- log " End: #{end_at}" if end_at
545
- log "Next Start: #{next_start}" if next_start
546
- log " Run Count: #{schedule.run_count}" if schedule.run_count
547
- log " Payload: #{schedule.payload}" unless schedule.payload == 'null'
548
- log " Details: https://hud.iron.io/tq/projects/#{client.api.project_id}/scheduled_jobs/#{id}"
549
- end
550
- elsif command == 'install'
551
- opts = OptionParser.new do |opts|
552
- opts.banner = 'usage: iron_worker install CODE_PACKAGE_NAME_OR_PATH_TO_WORKERFILE [OPTIONS]'
553
-
554
- common_opts(opts)
555
- end
352
+ unless $*.size == 1
353
+ puts 'Please specify task id'
354
+ puts opts
355
+ exit 1
356
+ end
556
357
 
557
- begin
558
- opts.parse!
559
- rescue OptionParser::ParseError
560
- puts $!.to_s
561
- exit 1
562
- end
358
+ @cli.info_task($*[0], params, options)
359
+ elsif entity == 'schedule'
360
+ params = {}
361
+ options = {}
563
362
 
564
- unless $*.size == 1
565
- puts 'Please specify code package name or path to workerfile'
566
- puts opts
567
- exit 1
568
- end
363
+ opts = OptionParser.new do |opts|
364
+ opts.banner = "usage: iron_worker info schedule SCHEDULE_ID [OPTIONS]"
569
365
 
570
- name = $*[0]
366
+ common_opts(opts)
367
+ end
571
368
 
572
- log "#{LOG_GROUP}Installing worker dependencies for code package with name='#{name}'"
369
+ begin
370
+ opts.parse!
371
+ rescue OptionParser::ParseError
372
+ puts $!.to_s
373
+ exit 1
374
+ end
573
375
 
574
- code = IronWorkerNG::Code::Base.new(name)
376
+ unless $*.size == 1
377
+ puts 'Please specify schedule id'
378
+ puts opts
379
+ exit 1
380
+ end
575
381
 
576
- code.install
382
+ @cli.info_schedule($*[0], params, options)
383
+ end
577
384
  end