-
Notifications
You must be signed in to change notification settings - Fork 63
Expand file tree
/
Copy pathsimple-farm-stack.ts
More file actions
88 lines (78 loc) · 3.3 KB
/
Copy pathsimple-farm-stack.ts
File metadata and controls
88 lines (78 loc) · 3.3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
import * as cdk from 'aws-cdk-lib';
import { Construct } from 'constructs';
import { CpuLinuxFleet, Farm, JobAttachmentsBucket, Queue } from './deadline';
export interface SimpleFarmStackProps extends cdk.StackProps {
}
/**
* The smallest useful AWS Deadline Cloud farm: one queue, one Linux fleet.
*
* Start here. Jobs submitted to the queue run on spot Linux instances that
* Deadline Cloud launches on demand and shuts down when the work is done, and
* their input and output files travel through job attachments on the S3 bucket
* this stack creates.
*
* The queue's Conda environment installs applications from the
* {@link https://docs.aws.amazon.com/deadline-cloud/latest/userguide/create-queue-environment.html#conda-queue-environment deadline-cloud channel},
* so a job can ask for Blender, Maya, Nuke, or Houdini by name with no further
* setup:
*
* ```bash
* deadline bundle submit blender_render -p CondaPackages=blender
* ```
*
* When you outgrow it:
*
* - to build and publish your own Conda packages, see {@link StarterFarmStack},
* which adds a package build queue and a private S3 Conda channel
* - to run GPU work, see {@link CudaFarmStack}
* - to run Windows jobs, or to route different steps to different hardware, see
* {@link MultiPlatformFarmStack}
*/
export class SimpleFarmStack extends cdk.Stack {
/** The Deadline Cloud farm. */
public readonly farm: Farm;
/** The S3 bucket holding job attachments. */
public readonly jobAttachmentsBucket: JobAttachmentsBucket;
/** The queue jobs are submitted to. */
public readonly queue: Queue;
/** The Linux fleet the queue's jobs run on. */
public readonly fleet: CpuLinuxFleet;
constructor(scope: Construct, id: string, props: SimpleFarmStackProps = {}) {
super(scope, id, props);
this.farm = new Farm(this, 'Farm', {
displayName: 'Simple Deadline Cloud Farm',
description:
'Deadline Cloud farm deployed by the SimpleFarm stack of the starter_farm CDK sample.',
});
this.jobAttachmentsBucket = new JobAttachmentsBucket(this, 'JobAttachmentsBucket');
// One queue, with the Conda queue environment the construct adds by
// default. Its channel list is left alone, so jobs install from the
// deadline-cloud channel and there is no private channel to initialize
// before the farm is usable.
this.queue = new Queue(this, 'Queue', {
farm: this.farm,
displayName: 'Job Queue',
description: 'The Deadline Cloud queue for running jobs.',
jobAttachmentsBucket: this.jobAttachmentsBucket,
});
this.fleet = new CpuLinuxFleet(this, 'Fleet', { farm: this.farm });
this.queue.associateFleet(this.fleet);
new cdk.CfnOutput(this, 'FarmId', {
value: this.farm.farmId,
description: 'The Deadline Cloud farm ID.',
});
new cdk.CfnOutput(this, 'QueueId', {
value: this.queue.queueId,
description: 'The queue ID. Pass this to `deadline bundle submit --queue-id`.',
});
new cdk.CfnOutput(this, 'FleetId', {
value: this.fleet.fleetId,
description: 'The fleet ID.',
});
new cdk.CfnOutput(this, 'JobAttachmentsBucketName', {
value: this.jobAttachmentsBucket.bucketName,
description: 'The S3 bucket holding job attachments.',
});
}
}