Class FairshareSchedulingPolicy
Represents a Fairshare Scheduling Policy. Instructs the scheduler to allocate ComputeEnvironment vCPUs based on Job shareIdentifiers.
Implements
Inherited Members
Namespace: Amazon.CDK.AWS.Batch
Assembly: Amazon.CDK.Lib.dll
Syntax (csharp)
public class FairshareSchedulingPolicy : Resource, IFairshareSchedulingPolicy, ISchedulingPolicy, IResource
Syntax (vb)
Public Class FairshareSchedulingPolicy
Inherits Resource
Implements IFairshareSchedulingPolicy, ISchedulingPolicy, IResource
Remarks
The Faireshare Scheduling Policy ensures that each share gets a certain amount of vCPUs. The scheduler 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.
Resource: AWS::Batch::SchedulingPolicy
ExampleMetadata: infused
Examples
var fairsharePolicy = new FairshareSchedulingPolicy(this, "myFairsharePolicy");
fairsharePolicy.AddShare(new Share {
ShareIdentifier = "A",
WeightFactor = 1
});
fairsharePolicy.AddShare(new Share {
ShareIdentifier = "B",
WeightFactor = 1
});
new JobQueue(this, "JobQueue", new JobQueueProps {
SchedulingPolicy = fairsharePolicy
});
Synopsis
Constructors
FairshareSchedulingPolicy(ByRefValue) | Used by jsii to construct an instance of this class from a Javascript-owned object reference |
FairshareSchedulingPolicy(DeputyBase.DeputyProps) | Used by jsii to construct an instance of this class from DeputyProps |
FairshareSchedulingPolicy(Construct, String, IFairshareSchedulingPolicyProps) |
Properties
ComputeReservation | Used to calculate the percentage of the maximum available vCPU to reserve for share identifiers not present in the Queue. |
SchedulingPolicyArn | The arn of this scheduling policy. |
SchedulingPolicyName | The name of this scheduling policy. |
ShareDecay | The amount of time to use to measure the usage of each job. |
Shares | The shares that this Scheduling Policy applies to. |
Methods
AddShare(IShare) | Add a share this to this Fairshare SchedulingPolicy. |
FromFairshareSchedulingPolicyArn(Construct, String, String) | Reference an exisiting Scheduling Policy by its ARN. |
Constructors
FairshareSchedulingPolicy(ByRefValue)
Used by jsii to construct an instance of this class from a Javascript-owned object reference
protected FairshareSchedulingPolicy(ByRefValue reference)
Parameters
- reference Amazon.JSII.Runtime.Deputy.ByRefValue
The Javascript-owned object reference
FairshareSchedulingPolicy(DeputyBase.DeputyProps)
Used by jsii to construct an instance of this class from DeputyProps
protected FairshareSchedulingPolicy(DeputyBase.DeputyProps props)
Parameters
- props Amazon.JSII.Runtime.Deputy.DeputyBase.DeputyProps
The deputy props
FairshareSchedulingPolicy(Construct, String, IFairshareSchedulingPolicyProps)
public FairshareSchedulingPolicy(Construct scope, string id, IFairshareSchedulingPolicyProps props = null)
Parameters
- scope Constructs.Construct
- id System.String
- props IFairshareSchedulingPolicyProps
Properties
ComputeReservation
Used to calculate the percentage of the maximum available vCPU to reserve for share identifiers not present in the Queue.
public virtual Nullable<double> ComputeReservation { get; }
Property Value
System.Nullable<System.Double>
Remarks
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.
SchedulingPolicyArn
The arn of this scheduling policy.
public virtual string SchedulingPolicyArn { get; }
Property Value
System.String
SchedulingPolicyName
The name of this scheduling policy.
public virtual string SchedulingPolicyName { get; }
Property Value
System.String
ShareDecay
The amount of time to use to measure the usage of each job.
public virtual Duration ShareDecay { get; }
Property Value
Remarks
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).
Shares
The shares that this Scheduling Policy applies to.
public virtual IShare[] Shares { get; }
Property Value
IShare[]
Remarks
Note: It is possible to submit Jobs to the queue with Share Identifiers that are not recognized by the Scheduling Policy.
Methods
AddShare(IShare)
Add a share this to this Fairshare SchedulingPolicy.
public virtual void AddShare(IShare share)
Parameters
- share IShare
FromFairshareSchedulingPolicyArn(Construct, String, String)
Reference an exisiting Scheduling Policy by its ARN.
public static IFairshareSchedulingPolicy FromFairshareSchedulingPolicyArn(Construct scope, string id, string fairshareSchedulingPolicyArn)
Parameters
- scope Constructs.Construct
- id System.String
- fairshareSchedulingPolicyArn System.String
Returns