Class: AWSCDK::Batch::FairshareSchedulingPolicyProps

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

Overview

Fairshare SchedulingPolicy configuration.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(compute_reservation: nil, scheduling_policy_name: nil, share_decay: nil, shares: nil) ⇒ FairshareSchedulingPolicyProps

Returns a new instance of FairshareSchedulingPolicyProps.

Parameters:

  • compute_reservation (Numeric, nil) (defaults to: nil)

    Used to calculate the percentage of the maximum available vCPU to reserve for share identifiers not present in the Queue.

  • scheduling_policy_name (String, nil) (defaults to: nil)

    The name of this SchedulingPolicy.

  • share_decay (AWSCDK::Duration, nil) (defaults to: nil)

    The amount of time to use to measure the usage of each job.

  • shares (Array<AWSCDK::Batch::Share>, nil) (defaults to: nil)

    The shares that this Scheduling Policy applies to.



11
12
13
14
15
16
17
18
19
20
# File 'batch/fairshare_scheduling_policy_props.rb', line 11

def initialize(compute_reservation: nil, scheduling_policy_name: nil, share_decay: nil, shares: nil)
  @compute_reservation = compute_reservation
  Jsii::Type.check_type(@compute_reservation, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJudW1iZXIifQ==")), "computeReservation") unless @compute_reservation.nil?
  @scheduling_policy_name = scheduling_policy_name
  Jsii::Type.check_type(@scheduling_policy_name, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "schedulingPolicyName") unless @scheduling_policy_name.nil?
  @share_decay = share_decay
  Jsii::Type.check_type(@share_decay, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5EdXJhdGlvbiJ9")), "shareDecay") unless @share_decay.nil?
  @shares = shares.is_a?(Array) ? shares.map { |jsii_v0| jsii_v0.is_a?(Hash) ? ::AWSCDK::Batch::Share.new(**jsii_v0.transform_keys(&:to_sym)) : jsii_v0 } : shares
  Jsii::Type.check_type(@shares, JSON.parse(Base64.strict_decode64("eyJjb2xsZWN0aW9uIjp7ImVsZW1lbnR0eXBlIjp7ImZxbiI6ImF3cy1jZGstbGliLmF3c19iYXRjaC5TaGFyZSJ9LCJraW5kIjoiYXJyYXkifX0=")), "shares") unless @shares.nil?
end

Instance Attribute Details

#compute_reservationNumeric? (readonly)

Note:

Default: - no vCPU is reserved

Used to calculate the percentage of the maximum available vCPU to reserve for share identifiers not present in the Queue.

The percentage reserved is defined by the Scheduler as: (computeReservation/100)^ActiveFairShares where ActiveFairShares is the number of active fair share identifiers.

For example, a computeReservation value of 50 indicates that AWS Batch reserves 50% of the maximum available vCPU if there's only one fair share identifier. It reserves 25% if there are two fair share identifiers. It reserves 12.5% if there are three fair share identifiers.

A computeReservation value of 25 indicates that AWS Batch should reserve 25% of the maximum available vCPU if there's only one fair share identifier, 6.25% if there are two fair share identifiers, and 1.56% if there are three fair share identifiers.

Returns:

  • (Numeric, nil)


39
40
41
# File 'batch/fairshare_scheduling_policy_props.rb', line 39

def compute_reservation
  @compute_reservation
end

#scheduling_policy_nameString? (readonly)

Note:

Default: - generated by CloudFormation

The name of this SchedulingPolicy.

Returns:

  • (String, nil)


44
45
46
# File 'batch/fairshare_scheduling_policy_props.rb', line 44

def scheduling_policy_name
  @scheduling_policy_name
end

#share_decayAWSCDK::Duration? (readonly)

Note:

Default: - 0: only the current job usage is considered

The amount of time to use to measure the usage of each job.

The usage is used to calculate a fair share percentage for each fair share identifier currently in the Queue. A value of zero (0) indicates that only current usage is measured. The decay is linear and gives preference to newer jobs.

The maximum supported value is 604800 seconds (1 week).

Returns:



55
56
57
# File 'batch/fairshare_scheduling_policy_props.rb', line 55

def share_decay
  @share_decay
end

#sharesArray<AWSCDK::Batch::Share>? (readonly)

Note:

Default: - no shares

The shares that this Scheduling Policy applies to.

Note: It is possible to submit Jobs to the queue with Share Identifiers that are not recognized by the Scheduling Policy.

Returns:



63
64
65
# File 'batch/fairshare_scheduling_policy_props.rb', line 63

def shares
  @shares
end

Class Method Details

.jsii_propertiesObject



65
66
67
68
69
70
71
72
# File 'batch/fairshare_scheduling_policy_props.rb', line 65

def self.jsii_properties
  {
    :compute_reservation => "computeReservation",
    :scheduling_policy_name => "schedulingPolicyName",
    :share_decay => "shareDecay",
    :shares => "shares",
  }
end

Instance Method Details

#to_jsiiObject



74
75
76
77
78
79
80
81
82
83
# File 'batch/fairshare_scheduling_policy_props.rb', line 74

def to_jsii
  result = {}
  result.merge!({
    "computeReservation" => @compute_reservation,
    "schedulingPolicyName" => @scheduling_policy_name,
    "shareDecay" => @share_decay,
    "shares" => @shares,
  })
  result.compact
end