hako 1.3.2 → 1.3.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
 - data/CHANGELOG.md +6 -0
 - data/lib/hako/schedulers/ecs.rb +20 -6
 - data/lib/hako/version.rb +1 -1
 - metadata +1 -1
 
    
        checksums.yaml
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            ---
         
     | 
| 
       2 
2 
     | 
    
         
             
            SHA1:
         
     | 
| 
       3 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       4 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 3 
     | 
    
         
            +
              metadata.gz: e670cdac7ce5a24b4d82bc026eceaa8068b6422f
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: 6b5a6ca2de09ae0a680e4ff1de903798cb04c78d
         
     | 
| 
       5 
5 
     | 
    
         
             
            SHA512:
         
     | 
| 
       6 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       7 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 6 
     | 
    
         
            +
              metadata.gz: 2ca1d9c75bbc08407d04f1dbc510f695c24b84fb45b8ea03bd56562d7049e010f214dbc8514f413350a880892fbad2f6780ae368cff1e7e4491177c763b6d0cd
         
     | 
| 
      
 7 
     | 
    
         
            +
              data.tar.gz: 6871ae244cf85ac56ff6256fbe6799b1f39540f9823a1288e97b9c67bda32301c32829ecd7cb9b06ebbc0b5dca1df0b86d4b5df48abba4f351a2f92c5b078a5a
         
     | 
    
        data/CHANGELOG.md
    CHANGED
    
    | 
         @@ -1,3 +1,9 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            # 1.3.3 (2017-05-23)
         
     | 
| 
      
 2 
     | 
    
         
            +
            ## Bug fixes
         
     | 
| 
      
 3 
     | 
    
         
            +
            - Fix error of autoscaling for oneshot when container instances are empty
         
     | 
| 
      
 4 
     | 
    
         
            +
            - Fix error when new task definition is registered
         
     | 
| 
      
 5 
     | 
    
         
            +
                - Regression in v1.3.2
         
     | 
| 
      
 6 
     | 
    
         
            +
             
     | 
| 
       1 
7 
     | 
    
         
             
            # 1.3.2 (2017-05-23)
         
     | 
| 
       2 
8 
     | 
    
         
             
            ## Bug fixes
         
     | 
| 
       3 
9 
     | 
    
         
             
            - Pass placement_configurations in oneshot mode
         
     | 
    
        data/lib/hako/schedulers/ecs.rb
    CHANGED
    
    | 
         @@ -357,6 +357,10 @@ module Hako 
     | 
|
| 
       357 
357 
     | 
    
         
             
                    if @force
         
     | 
| 
       358 
358 
     | 
    
         
             
                      return true
         
     | 
| 
       359 
359 
     | 
    
         
             
                    end
         
     | 
| 
      
 360 
     | 
    
         
            +
                    if !actual_definition
         
     | 
| 
      
 361 
     | 
    
         
            +
                      # Initial deployment
         
     | 
| 
      
 362 
     | 
    
         
            +
                      return true
         
     | 
| 
      
 363 
     | 
    
         
            +
                    end
         
     | 
| 
       360 
364 
     | 
    
         
             
                    container_definitions = {}
         
     | 
| 
       361 
365 
     | 
    
         
             
                    actual_definition.container_definitions.each do |c|
         
     | 
| 
       362 
366 
     | 
    
         
             
                      container_definitions[c.name] = c
         
     | 
| 
         @@ -372,9 +376,6 @@ module Hako 
     | 
|
| 
       372 
376 
     | 
    
         
             
                      return true
         
     | 
| 
       373 
377 
     | 
    
         
             
                    end
         
     | 
| 
       374 
378 
     | 
    
         
             
                    !container_definitions.empty?
         
     | 
| 
       375 
     | 
    
         
            -
                  rescue Aws::ECS::Errors::ClientException
         
     | 
| 
       376 
     | 
    
         
            -
                    # Task definition does not exist
         
     | 
| 
       377 
     | 
    
         
            -
                    true
         
     | 
| 
       378 
379 
     | 
    
         
             
                  end
         
     | 
| 
       379 
380 
     | 
    
         | 
| 
       380 
381 
     | 
    
         
             
                  # @param [Hash<String, Hash<String, String>>] actual_volumes
         
     | 
| 
         @@ -406,7 +407,7 @@ module Hako 
     | 
|
| 
       406 
407 
     | 
    
         
             
                  # @param [Array<Hash>] definitions
         
     | 
| 
       407 
408 
     | 
    
         
             
                  # @return [Array<Boolean, Aws::ECS::Types::TaskDefinition>]
         
     | 
| 
       408 
409 
     | 
    
         
             
                  def register_task_definition(definitions)
         
     | 
| 
       409 
     | 
    
         
            -
                    current_task_definition =  
     | 
| 
      
 410 
     | 
    
         
            +
                    current_task_definition = describe_task_definition(@app_id)
         
     | 
| 
       410 
411 
     | 
    
         
             
                    if task_definition_changed?(definitions, current_task_definition)
         
     | 
| 
       411 
412 
     | 
    
         
             
                      new_task_definition = ecs_client.register_task_definition(
         
     | 
| 
       412 
413 
     | 
    
         
             
                        family: @app_id,
         
     | 
| 
         @@ -432,7 +433,7 @@ module Hako 
     | 
|
| 
       432 
433 
     | 
    
         
             
                  # @return [Array<Boolean, Aws::ECS::Types::TaskDefinition]
         
     | 
| 
       433 
434 
     | 
    
         
             
                  def register_task_definition_for_oneshot(definitions)
         
     | 
| 
       434 
435 
     | 
    
         
             
                    family = "#{@app_id}-oneshot"
         
     | 
| 
       435 
     | 
    
         
            -
                    current_task_definition =  
     | 
| 
      
 436 
     | 
    
         
            +
                    current_task_definition = describe_task_definition(family)
         
     | 
| 
       436 
437 
     | 
    
         
             
                    if task_definition_changed?(definitions, current_task_definition)
         
     | 
| 
       437 
438 
     | 
    
         
             
                      new_task_definition = ecs_client.register_task_definition(
         
     | 
| 
       438 
439 
     | 
    
         
             
                        family: family,
         
     | 
| 
         @@ -456,6 +457,13 @@ module Hako 
     | 
|
| 
       456 
457 
     | 
    
         
             
                    end
         
     | 
| 
       457 
458 
     | 
    
         
             
                  end
         
     | 
| 
       458 
459 
     | 
    
         | 
| 
      
 460 
     | 
    
         
            +
                  def describe_task_definition(family)
         
     | 
| 
      
 461 
     | 
    
         
            +
                    ecs_client.describe_task_definition(task_definition: family).task_definition
         
     | 
| 
      
 462 
     | 
    
         
            +
                  rescue Aws::ECS::Errors::ClientException
         
     | 
| 
      
 463 
     | 
    
         
            +
                    # Task definition does not exist
         
     | 
| 
      
 464 
     | 
    
         
            +
                    nil
         
     | 
| 
      
 465 
     | 
    
         
            +
                  end
         
     | 
| 
      
 466 
     | 
    
         
            +
             
     | 
| 
       459 
467 
     | 
    
         
             
                  # @param [String] name
         
     | 
| 
       460 
468 
     | 
    
         
             
                  # @param [Container] container
         
     | 
| 
       461 
469 
     | 
    
         
             
                  # @return [Hash]
         
     | 
| 
         @@ -841,7 +849,13 @@ module Hako 
     | 
|
| 
       841 
849 
     | 
    
         
             
                        raise Error.new("AutoScaling Group '#{@autoscaling_group_for_oneshot}' does not exist")
         
     | 
| 
       842 
850 
     | 
    
         
             
                      end
         
     | 
| 
       843 
851 
     | 
    
         | 
| 
       844 
     | 
    
         
            -
                      container_instances = ecs_client.list_container_instances(cluster: @cluster).flat_map  
     | 
| 
      
 852 
     | 
    
         
            +
                      container_instances = ecs_client.list_container_instances(cluster: @cluster).flat_map do |c|
         
     | 
| 
      
 853 
     | 
    
         
            +
                        if c.container_instance_arns.empty?
         
     | 
| 
      
 854 
     | 
    
         
            +
                          []
         
     | 
| 
      
 855 
     | 
    
         
            +
                        else
         
     | 
| 
      
 856 
     | 
    
         
            +
                          ecs_client.describe_container_instances(cluster: @cluster, container_instances: c.container_instance_arns).container_instances
         
     | 
| 
      
 857 
     | 
    
         
            +
                        end
         
     | 
| 
      
 858 
     | 
    
         
            +
                      end
         
     | 
| 
       845 
859 
     | 
    
         
             
                      if has_capacity?(task_definition, container_instances)
         
     | 
| 
       846 
860 
     | 
    
         
             
                        Hako.logger.info("There's remaining capacity. Start retrying...")
         
     | 
| 
       847 
861 
     | 
    
         
             
                        return true
         
     | 
    
        data/lib/hako/version.rb
    CHANGED