package awscdkbatchalpha import ( _init_ "github.com/aws/aws-cdk-go/awscdkbatchalpha/v2/jsii" _jsii_ "github.com/aws/jsii-runtime-go/runtime" "github.com/aws/aws-cdk-go/awscdk/v2" "github.com/aws/aws-cdk-go/awscdkbatchalpha/v2/internal" "github.com/aws/constructs-go/constructs/v10" ) // 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. // 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. // // Example: // fairsharePolicy := batch.NewFairshareSchedulingPolicy(this, jsii.String("myFairsharePolicy")) // // fairsharePolicy.AddShare(&Share{ // ShareIdentifier: jsii.String("A"), // WeightFactor: jsii.Number(1), // }) // fairsharePolicy.AddShare(&Share{ // ShareIdentifier: jsii.String("B"), // WeightFactor: jsii.Number(1), // }) // batch.NewJobQueue(this, jsii.String("JobQueue"), &JobQueueProps{ // SchedulingPolicy: fairsharePolicy, // }) // // Experimental. type FairshareSchedulingPolicy interface { awscdk.Resource IFairshareSchedulingPolicy ISchedulingPolicy // 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. // Experimental. ComputeReservation() *float64 // The environment this resource belongs to. // // For resources that are created and managed by the CDK // (generally, those created by creating new class instances like Role, Bucket, etc.), // this is always the same as the environment of the stack they belong to; // however, for imported resources // (those obtained from static methods like fromRoleArn, fromBucketName, etc.), // that might be different than the stack they were imported into. // Experimental. Env() *awscdk.ResourceEnvironment // The tree node. // Experimental. Node() constructs.Node // Returns a string-encoded token that resolves to the physical name that should be passed to the CloudFormation resource. // // This value will resolve to one of the following: // - a concrete value (e.g. `"my-awesome-bucket"`) // - `undefined`, when a name should be generated by CloudFormation // - a concrete name generated automatically during synthesis, in // cross-environment scenarios. // Experimental. PhysicalName() *string // The arn of this scheduling policy. // Experimental. SchedulingPolicyArn() *string // The name of this scheduling policy. // Experimental. SchedulingPolicyName() *string // 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). // Experimental. ShareDecay() awscdk.Duration // 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. // Experimental. Shares() *[]*Share // The stack in which this resource is defined. // Experimental. Stack() awscdk.Stack // Add a share this to this Fairshare SchedulingPolicy. // Experimental. AddShare(share *Share) // 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`). // Experimental. ApplyRemovalPolicy(policy awscdk.RemovalPolicy) // Experimental. GeneratePhysicalName() *string // Returns an environment-sensitive token that should be used for the resource's "ARN" attribute (e.g. `bucket.bucketArn`). // // Normally, this token will resolve to `arnAttr`, but if the resource is // referenced across environments, `arnComponents` will be used to synthesize // a concrete ARN with the resource's physical name. Make sure to reference // `this.physicalName` in `arnComponents`. // Experimental. GetResourceArnAttribute(arnAttr *string, arnComponents *awscdk.ArnComponents) *string // Returns an environment-sensitive token that should be used for the resource's "name" attribute (e.g. `bucket.bucketName`). // // Normally, this token will resolve to `nameAttr`, but if the resource is // referenced across environments, it will be resolved to `this.physicalName`, // which will be a concrete name. // Experimental. GetResourceNameAttribute(nameAttr *string) *string // Returns a string representation of this construct. // Experimental. ToString() *string } // The jsii proxy struct for FairshareSchedulingPolicy type jsiiProxy_FairshareSchedulingPolicy struct { internal.Type__awscdkResource jsiiProxy_IFairshareSchedulingPolicy jsiiProxy_ISchedulingPolicy } func (j *jsiiProxy_FairshareSchedulingPolicy) ComputeReservation() *float64 { var returns *float64 _jsii_.Get( j, "computeReservation", &returns, ) return returns } func (j *jsiiProxy_FairshareSchedulingPolicy) Env() *awscdk.ResourceEnvironment { var returns *awscdk.ResourceEnvironment _jsii_.Get( j, "env", &returns, ) return returns } func (j *jsiiProxy_FairshareSchedulingPolicy) Node() constructs.Node { var returns constructs.Node _jsii_.Get( j, "node", &returns, ) return returns } func (j *jsiiProxy_FairshareSchedulingPolicy) PhysicalName() *string { var returns *string _jsii_.Get( j, "physicalName", &returns, ) return returns } func (j *jsiiProxy_FairshareSchedulingPolicy) SchedulingPolicyArn() *string { var returns *string _jsii_.Get( j, "schedulingPolicyArn", &returns, ) return returns } func (j *jsiiProxy_FairshareSchedulingPolicy) SchedulingPolicyName() *string { var returns *string _jsii_.Get( j, "schedulingPolicyName", &returns, ) return returns } func (j *jsiiProxy_FairshareSchedulingPolicy) ShareDecay() awscdk.Duration { var returns awscdk.Duration _jsii_.Get( j, "shareDecay", &returns, ) return returns } func (j *jsiiProxy_FairshareSchedulingPolicy) Shares() *[]*Share { var returns *[]*Share _jsii_.Get( j, "shares", &returns, ) return returns } func (j *jsiiProxy_FairshareSchedulingPolicy) Stack() awscdk.Stack { var returns awscdk.Stack _jsii_.Get( j, "stack", &returns, ) return returns } // Experimental. func NewFairshareSchedulingPolicy(scope constructs.Construct, id *string, props *FairshareSchedulingPolicyProps) FairshareSchedulingPolicy { _init_.Initialize() if err := validateNewFairshareSchedulingPolicyParameters(scope, id, props); err != nil { panic(err) } j := jsiiProxy_FairshareSchedulingPolicy{} _jsii_.Create( "@aws-cdk/aws-batch-alpha.FairshareSchedulingPolicy", []interface{}{scope, id, props}, &j, ) return &j } // Experimental. func NewFairshareSchedulingPolicy_Override(f FairshareSchedulingPolicy, scope constructs.Construct, id *string, props *FairshareSchedulingPolicyProps) { _init_.Initialize() _jsii_.Create( "@aws-cdk/aws-batch-alpha.FairshareSchedulingPolicy", []interface{}{scope, id, props}, f, ) } // Reference an exisiting Scheduling Policy by its ARN. // Experimental. func FairshareSchedulingPolicy_FromFairshareSchedulingPolicyArn(scope constructs.Construct, id *string, fairshareSchedulingPolicyArn *string) IFairshareSchedulingPolicy { _init_.Initialize() if err := validateFairshareSchedulingPolicy_FromFairshareSchedulingPolicyArnParameters(scope, id, fairshareSchedulingPolicyArn); err != nil { panic(err) } var returns IFairshareSchedulingPolicy _jsii_.StaticInvoke( "@aws-cdk/aws-batch-alpha.FairshareSchedulingPolicy", "fromFairshareSchedulingPolicyArn", []interface{}{scope, id, fairshareSchedulingPolicyArn}, &returns, ) return returns } // Checks if `x` is a construct. // // Use this method instead of `instanceof` to properly detect `Construct` // instances, even when the construct library is symlinked. // // Explanation: in JavaScript, multiple copies of the `constructs` library on // disk are seen as independent, completely different libraries. As a // consequence, the class `Construct` in each copy of the `constructs` library // is seen as a different class, and an instance of one class will not test as // `instanceof` the other class. `npm install` will not create installations // like this, but users may manually symlink construct libraries together or // use a monorepo tool: in those cases, multiple copies of the `constructs` // library can be accidentally installed, and `instanceof` will behave // unpredictably. It is safest to avoid using `instanceof`, and using // this type-testing method instead. // // Returns: true if `x` is an object created from a class which extends `Construct`. // Experimental. func FairshareSchedulingPolicy_IsConstruct(x interface{}) *bool { _init_.Initialize() if err := validateFairshareSchedulingPolicy_IsConstructParameters(x); err != nil { panic(err) } var returns *bool _jsii_.StaticInvoke( "@aws-cdk/aws-batch-alpha.FairshareSchedulingPolicy", "isConstruct", []interface{}{x}, &returns, ) return returns } // Returns true if the construct was created by CDK, and false otherwise. // Experimental. func FairshareSchedulingPolicy_IsOwnedResource(construct constructs.IConstruct) *bool { _init_.Initialize() if err := validateFairshareSchedulingPolicy_IsOwnedResourceParameters(construct); err != nil { panic(err) } var returns *bool _jsii_.StaticInvoke( "@aws-cdk/aws-batch-alpha.FairshareSchedulingPolicy", "isOwnedResource", []interface{}{construct}, &returns, ) return returns } // Check whether the given construct is a Resource. // Experimental. func FairshareSchedulingPolicy_IsResource(construct constructs.IConstruct) *bool { _init_.Initialize() if err := validateFairshareSchedulingPolicy_IsResourceParameters(construct); err != nil { panic(err) } var returns *bool _jsii_.StaticInvoke( "@aws-cdk/aws-batch-alpha.FairshareSchedulingPolicy", "isResource", []interface{}{construct}, &returns, ) return returns } func (f *jsiiProxy_FairshareSchedulingPolicy) AddShare(share *Share) { if err := f.validateAddShareParameters(share); err != nil { panic(err) } _jsii_.InvokeVoid( f, "addShare", []interface{}{share}, ) } func (f *jsiiProxy_FairshareSchedulingPolicy) ApplyRemovalPolicy(policy awscdk.RemovalPolicy) { if err := f.validateApplyRemovalPolicyParameters(policy); err != nil { panic(err) } _jsii_.InvokeVoid( f, "applyRemovalPolicy", []interface{}{policy}, ) } func (f *jsiiProxy_FairshareSchedulingPolicy) GeneratePhysicalName() *string { var returns *string _jsii_.Invoke( f, "generatePhysicalName", nil, // no parameters &returns, ) return returns } func (f *jsiiProxy_FairshareSchedulingPolicy) GetResourceArnAttribute(arnAttr *string, arnComponents *awscdk.ArnComponents) *string { if err := f.validateGetResourceArnAttributeParameters(arnAttr, arnComponents); err != nil { panic(err) } var returns *string _jsii_.Invoke( f, "getResourceArnAttribute", []interface{}{arnAttr, arnComponents}, &returns, ) return returns } func (f *jsiiProxy_FairshareSchedulingPolicy) GetResourceNameAttribute(nameAttr *string) *string { if err := f.validateGetResourceNameAttributeParameters(nameAttr); err != nil { panic(err) } var returns *string _jsii_.Invoke( f, "getResourceNameAttribute", []interface{}{nameAttr}, &returns, ) return returns } func (f *jsiiProxy_FairshareSchedulingPolicy) ToString() *string { var returns *string _jsii_.Invoke( f, "toString", nil, // no parameters &returns, ) return returns }