Module: AWSCDK::Batch::IFairshareSchedulingPolicy
- Includes:
- ISchedulingPolicy
- Included in:
- FairshareSchedulingPolicy
- Defined in:
- batch/i_fairshare_scheduling_policy.rb
Overview
Represents a Fairshare Scheduling Policy. Instructs the scheduler to allocate ComputeEnvironment vCPUs based on Job shareIdentifiers.
The Faireshare Scheduling Policy ensures that each share gets a certain amount of vCPUs. It does this by deciding how many Jobs of each share to schedule relative to how many jobs of each share are currently being executed by the ComputeEnvironment. The weight factors associated with each share determine the ratio of vCPUs allocated; see the readme for a more in-depth discussion of fairshare policies.
Class Method Summary collapse
Instance Method Summary collapse
-
#apply_removal_policy(policy) ⇒ void
Apply the given removal policy to this resource.
-
#compute_reservation ⇒ Numeric?
Used to calculate the percentage of the maximum available vCPU to reserve for share identifiers not present in the Queue.
-
#env ⇒ AWSCDK::Interfaces::ResourceEnvironment
The environment this resource belongs to.
-
#node ⇒ Constructs::Node
The tree node.
-
#scheduling_policy_arn ⇒ String
The arn of this scheduling policy.
-
#scheduling_policy_name ⇒ String
The name of this scheduling policy.
-
#scheduling_policy_ref ⇒ AWSCDK::Interfaces::AWSBatch::SchedulingPolicyReference
A reference to a SchedulingPolicy resource.
-
#share_decay ⇒ AWSCDK::Duration?
The amount of time to use to measure the usage of each job.
-
#shares ⇒ Array<AWSCDK::Batch::Share>
The shares that this Scheduling Policy applies to.
-
#stack ⇒ AWSCDK::Stack
The stack in which this resource is defined.
-
#with(*mixins) ⇒ Constructs::IConstruct
Applies one or more mixins to this construct.
Class Method Details
.jsii_overridable_methods ⇒ Object
140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 |
# File 'batch/i_fairshare_scheduling_policy.rb', line 140 def self.jsii_overridable_methods { :node => { kind: :property, name: "node", is_optional: false }, :env => { kind: :property, name: "env", is_optional: false }, :stack => { kind: :property, name: "stack", is_optional: false }, :scheduling_policy_ref => { kind: :property, name: "schedulingPolicyRef", is_optional: false }, :scheduling_policy_arn => { kind: :property, name: "schedulingPolicyArn", is_optional: false }, :scheduling_policy_name => { kind: :property, name: "schedulingPolicyName", is_optional: false }, :shares => { kind: :property, name: "shares", is_optional: false }, :compute_reservation => { kind: :property, name: "computeReservation", is_optional: true }, :share_decay => { kind: :property, name: "shareDecay", is_optional: true }, :with => { kind: :method, name: "with", is_optional: false }, :apply_removal_policy => { kind: :method, name: "applyRemovalPolicy", is_optional: false }, } end |
Instance Method Details
#apply_removal_policy(policy) ⇒ void
This method returns an undefined value.
Apply the given removal policy to this resource.
The Removal Policy controls what happens to this resource when it stops being managed by CloudFormation, either because you've removed it from the CDK application or because you've made a change that requires the resource to be replaced.
The resource can be deleted (RemovalPolicy.DESTROY), or left in your AWS
account for data recovery and cleanup later (RemovalPolicy.RETAIN).
135 136 137 138 |
# File 'batch/i_fairshare_scheduling_policy.rb', line 135 def apply_removal_policy(policy) Jsii::Type.check_type(policy, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5SZW1vdmFsUG9saWN5In0=")), "policy") jsii_call_method("applyRemovalPolicy", [policy]) end |
#compute_reservation ⇒ Numeric?
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.
91 92 93 |
# File 'batch/i_fairshare_scheduling_policy.rb', line 91 def compute_reservation() jsii_get_property("computeReservation") end |
#env ⇒ AWSCDK::Interfaces::ResourceEnvironment
The environment this resource belongs to.
For resources that are created and managed in a Stack (those created by
creating new class instances like new Role(), new Bucket(), etc.), this
is always the same as the environment of the stack they belong to.
For referenced resources (those obtained from referencing methods like
Role.fromRoleArn(), Bucket.fromBucketName(), etc.), they might be
different than the stack they were imported into.
32 33 34 |
# File 'batch/i_fairshare_scheduling_policy.rb', line 32 def env() jsii_get_property("env") end |
#node ⇒ Constructs::Node
The tree node.
17 18 19 |
# File 'batch/i_fairshare_scheduling_policy.rb', line 17 def node() jsii_get_property("node") end |
#scheduling_policy_arn ⇒ String
The arn of this scheduling policy.
53 54 55 |
# File 'batch/i_fairshare_scheduling_policy.rb', line 53 def scheduling_policy_arn() jsii_get_property("schedulingPolicyArn") end |
#scheduling_policy_name ⇒ String
The name of this scheduling policy.
60 61 62 |
# File 'batch/i_fairshare_scheduling_policy.rb', line 60 def scheduling_policy_name() jsii_get_property("schedulingPolicyName") end |
#scheduling_policy_ref ⇒ AWSCDK::Interfaces::AWSBatch::SchedulingPolicyReference
A reference to a SchedulingPolicy resource.
46 47 48 |
# File 'batch/i_fairshare_scheduling_policy.rb', line 46 def scheduling_policy_ref() jsii_get_property("schedulingPolicyRef") end |
#share_decay ⇒ AWSCDK::Duration?
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).
105 106 107 |
# File 'batch/i_fairshare_scheduling_policy.rb', line 105 def share_decay() jsii_get_property("shareDecay") end |
#shares ⇒ Array<AWSCDK::Batch::Share>
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.
70 71 72 |
# File 'batch/i_fairshare_scheduling_policy.rb', line 70 def shares() jsii_get_property("shares") end |
#stack ⇒ AWSCDK::Stack
The stack in which this resource is defined.
39 40 41 |
# File 'batch/i_fairshare_scheduling_policy.rb', line 39 def stack() jsii_get_property("stack") end |
#with(*mixins) ⇒ Constructs::IConstruct
Applies one or more mixins to this construct.
Mixins are applied in order. The list of constructs is captured at the start of the call, so constructs added by a mixin will not be visited.
116 117 118 119 120 121 |
# File 'batch/i_fairshare_scheduling_policy.rb', line 116 def with(*mixins) mixins.each_with_index do |item, index| Jsii::Type.check_type(item, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJjb25zdHJ1Y3RzLklNaXhpbiJ9")), "mixins[#{index}]") end jsii_call_method("with", [*mixins]) end |