This repository has been archived by the owner on May 31, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 82
Support Max vCpu in project contexts #89
Merged
Merged
Changes from 3 commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,3 @@ | ||
export { ApiProxy } from "./api-proxy"; | ||
export { Batch } from "./batch"; | ||
export { ComputeType } from "../types/index"; | ||
export { SecureService } from "./secure-service"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,10 +2,12 @@ import { NestedStack, NestedStackProps } from "monocdk"; | |
import { InstanceType, IVpc } from "monocdk/aws-ec2"; | ||
import { Construct } from "constructs"; | ||
import { LAUNCH_TEMPLATE } from "../../constants"; | ||
import { Batch, ComputeType } from "../../constructs"; | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nit: this space seems unnecessary |
||
import { Batch } from "../../constructs"; | ||
import { ContextAppParameters } from "../../env"; | ||
import { BucketOperations } from "../../../common/BucketOperations"; | ||
import { IRole } from "monocdk/aws-iam"; | ||
import { ComputeResourceType } from "monocdk/aws-batch"; | ||
|
||
export interface BatchStackProps extends NestedStackProps { | ||
/** | ||
|
@@ -34,18 +36,17 @@ export class BatchStack extends NestedStack { | |
super(scope, id, props); | ||
|
||
const { vpc, contextParameters, createSpotBatch, createOnDemandBatch } = props; | ||
|
||
const { artifactBucketName, outputBucketName, readBucketArns = [], readWriteBucketArns = [] } = contextParameters; | ||
if (createSpotBatch) { | ||
this.batchSpot = this.renderBatch("TaskBatchSpot", vpc, contextParameters.instanceTypes, ComputeType.SPOT); | ||
this.batchSpot = this.renderBatch("TaskBatchSpot", vpc, contextParameters, ComputeResourceType.SPOT); | ||
} | ||
if (createOnDemandBatch) { | ||
this.batchOnDemand = this.renderBatch("TaskBatch", vpc, contextParameters.instanceTypes, ComputeType.ON_DEMAND); | ||
this.batchOnDemand = this.renderBatch("TaskBatch", vpc, contextParameters, ComputeResourceType.ON_DEMAND); | ||
} | ||
|
||
const artifactBucket = BucketOperations.importBucket(this, "ArtifactBucket", contextParameters.artifactBucketName); | ||
const outputBucket = BucketOperations.importBucket(this, "OutputBucket", contextParameters.outputBucketName); | ||
const artifactBucket = BucketOperations.importBucket(this, "ArtifactBucket", artifactBucketName); | ||
const outputBucket = BucketOperations.importBucket(this, "OutputBucket", outputBucketName); | ||
|
||
const { readBucketArns = [], readWriteBucketArns = [] } = contextParameters; | ||
readBucketArns.push(artifactBucket.bucketArn); | ||
readWriteBucketArns.push(outputBucket.bucketArn); | ||
|
||
|
@@ -56,11 +57,12 @@ export class BatchStack extends NestedStack { | |
} | ||
} | ||
|
||
private renderBatch(id: string, vpc: IVpc, instanceTypes?: InstanceType[], computeType?: ComputeType): Batch { | ||
private renderBatch(id: string, vpc: IVpc, appParams: ContextAppParameters, computeType?: ComputeResourceType): Batch { | ||
return new Batch(this, id, { | ||
vpc, | ||
instanceTypes, | ||
computeType, | ||
instanceTypes: appParams.instanceTypes, | ||
maxVCpus: appParams.maxVCpus, | ||
launchTemplateData: LAUNCH_TEMPLATE, | ||
awsPolicyNames: ["AmazonSSMManagedInstanceCore", "CloudWatchAgentServerPolicy"], | ||
resourceTags: this.nestedStackParent?.tags.tagValues(), | ||
|
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,4 @@ | ||
export type Maybe<T> = T | undefined; | ||
|
||
export { ComputeType } from "./compute-type"; | ||
export { EngineOptions } from "./engine-options"; | ||
export { ServiceContainer } from "./service-container"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,6 +4,7 @@ import "reflect" | |
|
||
type Summary struct { | ||
Name string | ||
MaxVCpus int | ||
IsSpot bool | ||
InstanceTypes []string | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sweet! I had no idea you could link to other documentation like this