Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
8107505
feat(batch): create high level batch constructs
stephnr Oct 26, 2019
745bbd4
chore(batch): add tests for batch job queue
stephnr Oct 27, 2019
4ffdbc1
chore(batch): add tests for batch job definition
stephnr Nov 7, 2019
79b5da5
chore(batch): add tests for batch compute environment
stephnr Nov 8, 2019
20d3dc4
chore(batch): update tests and constructs based on feedback
stephnr Nov 12, 2019
615a13c
chore(batch): rebase on latest of master
stephnr Nov 12, 2019
8e5d251
chore(batch): update tests based on feedback
stephnr Nov 25, 2019
b4c2fb6
chore(batch): update tests to include integrations
stephnr Nov 29, 2019
4e15a37
chore(batch): fix tests for generated service role
stephnr Nov 29, 2019
8390a5a
chore(batch): add support for job def to use ContainerImage
stephnr Nov 30, 2019
b715193
chore(batch): fix file indentation
stephnr Dec 2, 2019
d562d1f
chore(batch): update integration tests
stephnr Dec 5, 2019
0094589
fix(batch): remove unavailable properties for compute-env
stephnr Jan 6, 2020
fd9fd85
fix(batch): fix indentation of compute-env instanceRole
stephnr Jan 6, 2020
7415ff6
fix(batch): fix compute-env instance role
stephnr Jan 6, 2020
ee29805
fix(batch): update props of exported constructs and remove isEnabled …
stephnr Jan 6, 2020
665182a
fix(batch): add double indentation
stephnr Jan 6, 2020
dd5eb3b
fix(batch): spotfleet role to use pseudo variable in spotfleet role
stephnr Jan 6, 2020
60b63d8
fix(batch): compute-env props and job-def does not default the contai…
stephnr Jan 6, 2020
054fce2
fix(batch): job-def indentation
stephnr Jan 6, 2020
958397d
fix(batch): job-queue indentation
stephnr Jan 6, 2020
51dd54c
fix(batch): use .resourceName in fromXXX funcs
stephnr Jan 11, 2020
7ddfd93
update AWS batch changes based on feedback
stephnr Feb 2, 2020
1b7838d
fix `getSpotFleetRole` in Batch compute environment to escape early w…
stephnr Feb 2, 2020
1048746
fix merge-conflicts in AWS Batch
stephnr Feb 2, 2020
0facd30
update aws-batch based on feedback during PR flow
stephnr Feb 4, 2020
cf98cb7
update imports for batch job def
stephnr Feb 4, 2020
043fdfa
chore(aws-batch): update to fix build issues
stephnr Feb 7, 2020
6fae271
chore(aws-batch): fix test issues
stephnr Feb 7, 2020
110a901
chore(aws-batch): fix remaining issues with tests
stephnr Feb 7, 2020
4305219
chore(aws-batch): fix issue with integration tests
stephnr Feb 8, 2020
518edaf
chore(aws-batch): fix integration test expectations
stephnr Feb 9, 2020
ad19323
Merge remote-tracking branch 'remotes/upstream/master'
stephnr Feb 21, 2020
9268345
Merge branch 'master' into master
stephnr Feb 21, 2020
0fb5aca
Merge remote-tracking branch 'origin/master' into cr/batch-2
skinny85 Feb 24, 2020
8f6f8f5
PR comments.
skinny85 Feb 24, 2020
15f5e79
Merge remote-tracking branch 'origin/master' into cr/batch-2
skinny85 Feb 24, 2020
ebcca67
Change Jest to version 24.9.0, and remove package-lock.json.
skinny85 Feb 24, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
458 changes: 458 additions & 0 deletions packages/@aws-cdk/aws-batch/lib/compute-environment.ts

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions packages/@aws-cdk/aws-batch/lib/index.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
// AWS::Batch CloudFormation Resources:
export * from './batch.generated';
export * from './compute-environment';
export * from './job-definition';
export * from './job-queue';
86 changes: 86 additions & 0 deletions packages/@aws-cdk/aws-batch/lib/job-definition-image-config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
import * as ecs from '@aws-cdk/aws-ecs';
import * as iam from '@aws-cdk/aws-iam';
import * as cdk from '@aws-cdk/core';
import { JobDefinitionContainer } from './job-definition';

/**
* TaskDefinitionRole
*
* Defines the required properties of a Batch Job Definition.
*/
interface TaskDefinitionProps {
/**
* Defines the IAM role used when executing this task definition
*/
readonly executionRole: iam.IRole;
}

/**
* Batch Job Task Definition
*
* Defines a Batch Job Task Definition. The properties of this task definition mirrors
* those of an {@link ecs.ContainerDefinition}. This class is a wrapper on that structure.
*/
class TaskDefinition {
/**
* The IAM role used during execution of the task definition. This IAM role should
* contain the relevant access required to interact with resources your application needs to perform.
*/
public readonly executionRole: iam.IRole;

constructor(props: TaskDefinitionProps) {
this.executionRole = props.executionRole;
}

/**
* Internal function to allow the Batch Job task defintion
* to match the CDK requirements of an EC2 task definition.
*
* @internal
*/
// tslint:disable-next-line: no-empty
public _linkContainer() {}

/**
* Retrieves the execution role for this task definition
*/
public obtainExecutionRole(): iam.IRole {
return this.executionRole;
}
}

/**
* The configuration for creating a batch container image.
*/
export class JobDefinitionImageConfig {
/**
* Specifies the name of the container image
*/
public readonly imageName: string;

constructor(scope: cdk.Construct, container: JobDefinitionContainer) {
const config = this.bindImageConfig(scope, container);

this.imageName = config.imageName;
}

private bindImageConfig(scope: cdk.Construct, container: JobDefinitionContainer): ecs.ContainerImageConfig {
return container.image.bind(scope, new ecs.ContainerDefinition(scope, 'Resource-Batch-Job-Container-Definition', {
command: container.command,
cpu: container.vcpus,
image: container.image,
environment: container.environment,
linuxParameters: container.linuxParams,
memoryLimitMiB: container.memoryLimitMiB,
privileged: container.privileged,
readonlyRootFilesystem: container.readOnly,
gpuCount: container.gpuCount,
user: container.user,
taskDefinition: new TaskDefinition({
executionRole: container.jobRole || new iam.LazyRole(scope, 'Resource-Batch-Task-Definition-Role', {
assumedBy: new iam.ServicePrincipal('batch.amazonaws.com')
}),
}) as unknown as ecs.TaskDefinition,
}));
}
}
Loading