Class: AWSCDK::Batch::Share

Inherits:
Jsii::Struct
  • Object
show all
Defined in:
batch/share.rb

Overview

Represents a group of Job Definitions.

All Job Definitions that declare a share identifier will be considered members of the Share defined by that share identifier.

The Scheduler divides the maximum available vCPUs of the ComputeEnvironment among Jobs in the Queue based on their shareIdentifier and the weightFactor associated with that shareIdentifier.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(share_identifier:, weight_factor:) ⇒ Share

Returns a new instance of Share.

Parameters:

  • share_identifier (String)

    The identifier of this Share.

  • weight_factor (Numeric)

    The weight factor given to this Share.



17
18
19
20
21
22
# File 'batch/share.rb', line 17

def initialize(share_identifier:, weight_factor:)
  @share_identifier = share_identifier
  Jsii::Type.check_type(@share_identifier, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "shareIdentifier")
  @weight_factor = weight_factor
  Jsii::Type.check_type(@weight_factor, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJudW1iZXIifQ==")), "weightFactor")
end

Instance Attribute Details

#share_identifierString (readonly)

The identifier of this Share.

All jobs that specify this share identifier when submitted to the queue will be considered as part of this Share.

Returns:

  • (String)


30
31
32
# File 'batch/share.rb', line 30

def share_identifier
  @share_identifier
end

#weight_factorNumeric (readonly)

The weight factor given to this Share.

The Scheduler decides which jobs to put in the Compute Environment such that the following ratio is equal for each job:

sharevCpu / weightFactor,

where sharev_cpu is the total amount of vCPU given to that particular share; that is, the sum of the vCPU of each job currently in the Compute Environment for that share.

See the readme of this module for a detailed example that shows how these are used, how it relates to compute_reservation, and how share_decay affects these calculations.

Returns:

  • (Numeric)


45
46
47
# File 'batch/share.rb', line 45

def weight_factor
  @weight_factor
end

Class Method Details

.jsii_propertiesObject



47
48
49
50
51
52
# File 'batch/share.rb', line 47

def self.jsii_properties
  {
    :share_identifier => "shareIdentifier",
    :weight_factor => "weightFactor",
  }
end

Instance Method Details

#to_jsiiObject



54
55
56
57
58
59
60
61
# File 'batch/share.rb', line 54

def to_jsii
  result = {}
  result.merge!({
    "shareIdentifier" => @share_identifier,
    "weightFactor" => @weight_factor,
  })
  result.compact
end