lib/hako/schedulers/ecs.rb in hako-0.15.2 vs lib/hako/schedulers/ecs.rb in hako-0.15.3
- old
+ new
@@ -393,11 +393,11 @@
# @param [Array<String>] commands
# @param [Hash<String, String>] env
# @return [Aws::ECS::Types::Task]
def run_task(task_definition, commands, env)
environment = env.map { |k, v| { name: k, value: v } }
- ecs_client.run_task(
+ result = ecs_client.run_task(
cluster: @cluster,
task_definition: task_definition.task_definition_arn,
overrides: {
container_overrides: [
{
@@ -407,10 +407,17 @@
},
],
},
count: 1,
started_by: 'hako oneshot',
- ).tasks[0]
+ )
+ result.failures.each do |failure|
+ Hako.logger.error("#{failure.arn} #{failure.reason}")
+ end
+ if result.tasks.empty?
+ raise 'No tasks started'
+ end
+ result.tasks[0]
end
# @return [Fixnum]
def wait_for_oneshot_finish
containers = wait_for_task(@task)