Skip to content
This repository was archived by the owner on Aug 9, 2023. It is now read-only.

Commit 918ed9d

Browse files
authored
Merge pull request #156 from crabba/all-in-one
Add nextflow-and-core template
2 parents 2d06382 + ad992af commit 918ed9d

File tree

3 files changed

+286
-8
lines changed

3 files changed

+286
-8
lines changed

src/templates/gwfcore/gwfcore-root.template.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -78,9 +78,9 @@ Parameters:
7878
Description: Does this bucket already exist?
7979
Type: String
8080
AllowedValues:
81-
- Yes
82-
- No
83-
Default: No
81+
- "Yes"
82+
- "No"
83+
Default: "No"
8484
DefaultCEMinvCpus:
8585
Description: The minimum number of CPUs for the default Batch Compute Environment
8686
Type: Number

src/templates/gwfcore/gwfcore-s3.template.yaml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,15 +32,15 @@ Parameters:
3232
Type: String
3333
Description: Does this bucket already exist? If not, it will be created.
3434
AllowedValues:
35-
- Yes
36-
- No
37-
Default: No
35+
- "Yes"
36+
- "No"
37+
Default: "No"
3838

3939
Conditions:
4040
BucketDoesNotExist:
4141
Fn::Equals:
4242
- !Ref ExistingBucket
43-
- No
43+
- "No"
4444
GenerateBucketName:
4545
Fn::Equals:
4646
- !Ref S3BucketName
@@ -82,4 +82,4 @@ Outputs:
8282
- BucketDoesNotExist
8383
- !GetAtt S3Bucket.Arn
8484
- !Join [":::", ["arn:aws:s3", !Ref S3BucketName]]
85-
...
85+
...
Lines changed: 278 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,278 @@
1+
---
2+
AWSTemplateFormatVersion: '2010-09-09'
3+
Description: >-
4+
(WWPS-GLS-WF-NEXTFLOW-AIO) Creates the complete set of resources needed to run
5+
genomics workflows using Nextflow on AWS Batch
6+
7+
8+
Mappings:
9+
TagMap:
10+
default:
11+
architecture: "genomics-workflows"
12+
solution: "nextflow"
13+
tags:
14+
- Key: "architecture"
15+
Value: "genomics-workflows"
16+
- Key: "solution"
17+
Value: "nextflow"
18+
19+
20+
Metadata:
21+
AWS::CloudFormation::Interface:
22+
ParameterGroups:
23+
- Label:
24+
default: "VPC"
25+
Parameters:
26+
- Namespace
27+
- VpcId
28+
- SubnetIds
29+
- Label:
30+
default: "Data Storage"
31+
Parameters:
32+
- S3DataBucketName
33+
- ExistingDataBucket
34+
- Label:
35+
default: "AWS Batch"
36+
Parameters:
37+
- DefaultCEMinvCpus
38+
- DefaultCEMaxvCpus
39+
- PriorityCEMinvCpus
40+
- PriorityCEMaxvCpus
41+
- Label:
42+
default: "Nextflow Resources"
43+
Parameters:
44+
- S3NextflowPrefix
45+
- S3LogsDirPrefix
46+
- S3WorkDirPrefix
47+
- NextflowVersion
48+
- NextflowVersionSpecified
49+
50+
ParameterLabels:
51+
Namespace:
52+
default: Namespace
53+
VpcId:
54+
default: VPC ID
55+
SubnetIds:
56+
default: VPC Subnet IDs
57+
S3DataBucketName:
58+
default: S3 Data Bucket Name
59+
ExistingDataBucket:
60+
default: Existing Data Bucket?
61+
DefaultCEMinvCpus:
62+
default: Default Min vCPU
63+
DefaultCEMaxvCpus:
64+
default: Default Max vCPU
65+
PriorityCEMinvCpus:
66+
default: High Priority Min vCPU
67+
PriorityCEMaxvCpus:
68+
default: High Priority Max vCPU
69+
S3NextflowPrefix:
70+
default: S3 Nextflow Prefix
71+
S3LogsDirPrefix:
72+
default: S3 Logs Dir Prefix
73+
S3WorkDirPrefix:
74+
default: S3 Work Dir Prefix
75+
NextflowVersion:
76+
default: Nextflow Version
77+
NextflowVersionSpecified:
78+
default: Nextflow Version Specified?
79+
TemplateRootUrl:
80+
default: Template Root URL
81+
82+
83+
Parameters:
84+
Namespace:
85+
Type: String
86+
Description: Namespace (e.g. project name) to use to label resources. Between 4-20 letters, digits, and '-', starting with a letter.
87+
AllowedPattern: "^[a-zA-Z]{1}[a-zA-Z0-9\\-]{3,19}$"
88+
ConstraintDescription: "Between 4-20 letters, digits, '-', starting with a letter"
89+
Default: "nextflow"
90+
91+
VpcId:
92+
Type: AWS::EC2::VPC::Id
93+
Description: 'The VPC to create security groups and deploy AWS Batch to. NOTE: Must be the same VPC as the provided subnet IDs.'
94+
SubnetIds:
95+
Type: List<AWS::EC2::Subnet::Id>
96+
Description: 'Subnets you want your batch compute environment to launch in. We recommend private subnets. NOTE: Must be from the VPC provided.'
97+
98+
S3DataBucketName:
99+
Description: >-
100+
A S3 bucket name for storing analysis results
101+
The bucket name must respect the S3 bucket naming conventions
102+
(can contain lowercase letters, numbers, periods and hyphens).
103+
If left blank a unique bucket name will be generated.
104+
105+
Type: String
106+
Default: ""
107+
AllowedPattern: "((?=^.{3,63}$)(?!^(\\d+\\.)+\\d+$)(^(([a-z0-9]|[a-z0-9][a-z0-9\\-]*[a-z0-9])\\.)*([a-z0-9]|[a-z0-9][a-z0-9\\-]*[a-z0-9])$)|(^.{0}$))"
108+
ConstraintDescription: "Must respect S3 bucket naming conventions"
109+
110+
ExistingDataBucket:
111+
Description: Does this data bucket already exist?
112+
Type: String
113+
AllowedValues:
114+
- "Yes"
115+
- "No"
116+
Default: "No"
117+
DefaultCEMinvCpus:
118+
Description: The minimum number of CPUs for the default Batch Compute Environment
119+
Type: Number
120+
Default: 0
121+
DefaultCEMaxvCpus:
122+
Description: The maximum number of CPUs for the default Batch Compute Environment
123+
Type: Number
124+
Default: 100
125+
PriorityCEMinvCpus:
126+
Description: The minimum number of CPUs for the high-priority Batch Compute Environment
127+
Type: Number
128+
Default: 0
129+
PriorityCEMaxvCpus:
130+
Description: The maximum number of CPUs for the high-priority Batch Compute Environment
131+
Type: Number
132+
Default: 100
133+
134+
S3NextflowPrefix:
135+
Type: String
136+
Description: >-
137+
(Optional) Parent folder in the GWFCore bucket for metadata folders.
138+
Default: _nextflow
139+
S3LogsDirPrefix:
140+
Type: String
141+
Description: >-
142+
(Optional) Folder in the GWFCore bucket under the {Nextflow Prefix}
143+
for session cache and logs.
144+
Default: logs
145+
S3WorkDirPrefix:
146+
Type: String
147+
Description: >-
148+
(Optional) Folder in the GWFCore bucket under the {Nextflow Prefix}
149+
that contains workflow intermediate results
150+
Default: runs
151+
NextflowVersion:
152+
Type: String
153+
Default: latest
154+
AllowedValues:
155+
- latest
156+
- specify ...
157+
Description: >-
158+
Version of Nextflow to use. Select "specify ..." to provide a specific version.
159+
NextflowVersionSpecified:
160+
Type: String
161+
Description: >-
162+
Specific version of Nextflow to use. Must match a released version number - e.g. "20.04.1".
163+
Default: ""
164+
165+
ArtifactBucketName:
166+
Type: String
167+
Default: aws-genomics-workflows
168+
Description: >-
169+
S3 Bucket where distrubution artifacts and additions scripts are stored
170+
ArtifactBucketPrefix:
171+
Type: String
172+
Default: artifacts # dist: pin_version
173+
Description: >-
174+
Prefix in ArtifactBucketName where distribution artifacts and additions scripts are stored
175+
176+
TemplateRootUrl:
177+
Type: String
178+
Description: >-
179+
Root URL for where nested templates are stored
180+
Default: https://aws-genomics-workflows.s3.amazonaws.com/templates
181+
ConstraintDescription: >-
182+
Must be a valid S3 URL
183+
AllowedPattern: "https://[a-z0-9-./]{0,}s3([a-z0-9-.]+)*\\.amazonaws\\.com/[a-z0-9-./]{3,}"
184+
185+
186+
Resources:
187+
GenomicsWorkflowStack:
188+
Type: AWS::CloudFormation::Stack
189+
Properties:
190+
TemplateURL: !Sub ${TemplateRootUrl}/gwfcore/gwfcore-root.template.yaml
191+
Parameters:
192+
Namespace: !Sub ${Namespace}-gwfcore
193+
VpcId: !Ref VpcId
194+
SubnetIds: !Join [",", !Ref SubnetIds ]
195+
S3BucketName: !Ref S3DataBucketName
196+
ExistingBucket: !Ref ExistingDataBucket
197+
DefaultCEMinvCpus: !Ref DefaultCEMinvCpus
198+
DefaultCEMaxvCpus: !Ref DefaultCEMaxvCpus
199+
PriorityCEMinvCpus: !Ref PriorityCEMinvCpus
200+
PriorityCEMaxvCpus: !Ref PriorityCEMaxvCpus
201+
ArtifactBucketName: !Ref ArtifactBucketName
202+
ArtifactBucketPrefix: !Ref ArtifactBucketPrefix
203+
TemplateRootUrl: !Ref TemplateRootUrl
204+
Tags: !FindInMap ["TagMap", "default", "tags"]
205+
206+
NextflowStack:
207+
Type: AWS::CloudFormation::Stack
208+
DependsOn: GenomicsWorkflowStack
209+
Properties:
210+
TemplateURL: !Sub ${TemplateRootUrl}/nextflow/nextflow-resources.template.yaml
211+
Parameters:
212+
Namespace: !Sub ${Namespace}-nextflow
213+
GWFCoreNamespace: !Sub "${Namespace}-gwfcore"
214+
S3NextflowPrefix: !Ref S3NextflowPrefix
215+
S3LogsDirPrefix: !Ref S3LogsDirPrefix
216+
S3WorkDirPrefix: !Ref S3WorkDirPrefix
217+
NextflowVersion: !Ref NextflowVersion
218+
NextflowVersionSpecified: !Ref NextflowVersionSpecified
219+
TemplateRootUrl: !Ref TemplateRootUrl
220+
Tags: !FindInMap ["TagMap", "default", "tags"]
221+
222+
223+
Outputs:
224+
NextflowContainerImage:
225+
Value: !GetAtt NextflowStack.Outputs.NextflowContainerImage
226+
Export:
227+
Name: !Sub "${Namespace}-NextflowContainerImage"
228+
229+
NextflowJobDefinition:
230+
Value: !GetAtt NextflowStack.Outputs.NextflowJobDefinition
231+
Export:
232+
Name: !Sub "${Namespace}-NextflowJobDefinition"
233+
Description: >-
234+
Batch Job Definition that creates a nextflow head node for running workflows
235+
236+
S3NextFlowBucket:
237+
Value: !GetAtt NextflowStack.Outputs.NextflowBucket
238+
Export:
239+
Name: !Sub "${Namespace}-NextflowBucket"
240+
Description: >-
241+
S3 Bucket used to store Nextflow metadata (session cache, logs, and intermediate results)
242+
S3NextflowLogsDir:
243+
Value: !GetAtt NextflowStack.Outputs.LogsDir
244+
Export:
245+
Name: !Sub "${Namespace}-NextflowLogsDir"
246+
Description: >-
247+
S3 URI where nextflow session cache and logs are stored.
248+
S3NextflowWorkDir:
249+
Value: !GetAtt NextflowStack.Outputs.WorkDir
250+
Export:
251+
Name: !Sub "${Namespace}-NextflowWorkDir"
252+
Description: >-
253+
S3 URI where workflow intermediate results are stored.
254+
255+
VpcId:
256+
Description: >-
257+
The VPC created for your Nextflow stack.
258+
Value: !Ref VpcId
259+
S3DataBucket:
260+
Value: !GetAtt 'GenomicsWorkflowStack.Outputs.S3BucketName'
261+
Export:
262+
Name: !Sub "${Namespace}-DataBucket"
263+
Description: >-
264+
S3 bucket for storing genomics workflow input and output data
265+
BatchDefaultQueue:
266+
Value: !GetAtt 'GenomicsWorkflowStack.Outputs.DefaultJobQueueArn'
267+
Export:
268+
Name: !Sub "${Namespace}-DefaultJobQueue"
269+
Description: >-
270+
The default AWS Batch job queue for workflow jobs, based on EC2 SPOT instances
271+
BatchPriorityQueue:
272+
Value: !GetAtt 'GenomicsWorkflowStack.Outputs.PriorityJobQueueArn'
273+
Export:
274+
Name: !Sub "${Namespace}-PriorityJobQueue"
275+
Description: >-
276+
AWS Batch job queue for high priority workflow jobs, based on EC2 On-Demand
277+
instances
278+
...

0 commit comments

Comments
 (0)