lib/hako/schedulers/ecs.rb in hako-0.8.0 vs lib/hako/schedulers/ecs.rb in hako-0.8.1
- old
+ new
@@ -67,12 +67,23 @@
else
Hako.logger.info "Registered task definition: #{task_definition.task_definition_arn}"
end
task = run_task(task_definition, commands)
Hako.logger.info "Started task: #{task.task_arn}"
- exit_code = wait_for_task(task)
+ containers = wait_for_task(task)
Hako.logger.info 'Oneshot task finished'
+ exit_code = 127
+ containers.each do |name, container|
+ if container.exit_code.nil?
+ Hako.logger.info "#{name} has stopped without exit_code: reason=#{container.reason}"
+ else
+ Hako.logger.info "#{name} has stopped with exit_code=#{container.exit_code}"
+ if name == 'app'
+ exit_code = container.exit_code
+ end
+ end
+ end
exit_code
end
def status
service = describe_service
@@ -323,12 +334,10 @@
Hako.logger.info "Stopped at #{task.stopped_at}"
containers = {}
task.containers.each do |c|
containers[c.name] = c
end
- app = containers.fetch('app')
- Hako.logger.info "Exit code is #{app.exit_code}"
- return app.exit_code
+ return containers
end
sleep 1
end
end