Skip to content

Commit 90beaa2

Browse files
authored
Merge pull request #126 from RLOpenCatalyst/topic-release
1.15.0 build updates
2 parents 895507d + 5fe7401 commit 90beaa2

6 files changed

Lines changed: 108 additions & 14 deletions

File tree

cft-templates/pcluster.yaml

Lines changed: 28 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
AWSTemplateFormatVersion: 2010-09-09
22

3-
Description: Sets up an pcluster on AWS
3+
Description: Sets up an pcluster on AWS version 3.0 test
44
Metadata:
55
AWS::CloudFormation::Interface:
66
ParameterGroups:
@@ -17,6 +17,7 @@ Metadata:
1717
- HeadNodeInstanceType
1818
- VpcId
1919
- HeadNodeSubnetId
20+
- FileSystemType
2021
- FileSystemId
2122
- Label:
2223
default: Scheduler Configuration
@@ -113,9 +114,14 @@ Parameters:
113114
Type: String
114115
Description: Enter the AMI Id of a custom AMI if you wish to use a non-default AMI. e.g. ami-12345678. The AMI Id entered should exist in this project account and region
115116
Default: default
117+
FileSystemType:
118+
Type: String
119+
Description: Choose the fileSystem type you want to mount on headnode leave it as NONE if don't want to mount any filesystem.
120+
AllowedValues: [NONE,EFS, FSxForLustre]
121+
Default: NONE
116122
FileSystemId:
117123
Type: String
118-
Description: Enter the File System Id of the FSx for Lustre file system which you want to use. e.g. fs-12345678. Leave this field to default if you do not want to use FSx for Lustre
124+
Description: Enter the File System Id of the EFS/FSxForLustre file system which you want to use. e.g. fs-12345678. Leave this field to default if you do not want to use any file system
119125
Default: default
120126
QueueCapacityType:
121127
Description: The type of the compute resources used in the queue. Supported values are ONDEMAND or SPOT
@@ -216,6 +222,25 @@ Resources :
216222
- route53:*
217223
- ssm:*
218224
- fsx:*
225+
- elasticfilesystem:Backup
226+
- elasticfilesystem:CreateFileSystem
227+
- elasticfilesystem:CreateMountTarget
228+
- elasticfilesystem:CreateTags
229+
- elasticfilesystem:CreateAccessPoint
230+
- elasticfilesystem:CreateReplicationConfiguration
231+
- elasticfilesystem:DeleteFileSystem
232+
- elasticfilesystem:DeleteMountTarget
233+
- elasticfilesystem:DeleteTags
234+
- elasticfilesystem:DeleteAccessPoint
235+
- elasticfilesystem:DeleteFileSystemPolicy
236+
- elasticfilesystem:DeleteReplicationConfiguration
237+
- elasticfilesystem:DescribeBackupPolicy
238+
- elasticfilesystem:DescribeMountTargets
239+
- elasticfilesystem:DescribeFileSystems
240+
- elasticfilesystem:PutFileSystemPolicy
241+
- elasticfilesystem:PutLifecycleConfiguration
242+
- elasticfilesystem:PutBackupPolicy
243+
- elasticfilesystem:DescribeMountTargetSecurityGroups
219244
Resource: "*"
220245
InstanceSecurityGroup:
221246
Type: AWS::EC2::SecurityGroup
@@ -261,7 +286,7 @@ Resources :
261286
trap '/opt/aws/bin/cfn-signal --exit-code 1 --resource EC2Instance --region ${AWS::Region} --stack ${AWS::StackName}' ERR
262287
sudo yum update -y --security
263288
cd /home/ec2-user/parallel-update
264-
sudo -u ec2-user ./Provision-pcluster.sh ${Scheduler} ${AWS::Region} ${HeadNodeInstanceType} ${HeadNodeSubnetId} ${KeyPair} ${ComputeNodeInstanceType} ${ComputeEnvMinvCpus} ${ComputeEnvMaxvCpus} ${ComputeNodeSubnetId} ${ComputeEnvDesiredvCpus} ${SpotBidPercentage} ${AWS::StackName} ${CustomAMI} ${FileSystemId} ${QueueCapacityType} ${DisableSimultaneousMultithreading} $efaEnabled ${PlacementGroup}
289+
sudo -u ec2-user ./Provision-pcluster.sh ${Scheduler} ${AWS::Region} ${HeadNodeInstanceType} ${HeadNodeSubnetId} ${KeyPair} ${ComputeNodeInstanceType} ${ComputeEnvMinvCpus} ${ComputeEnvMaxvCpus} ${ComputeNodeSubnetId} ${ComputeEnvDesiredvCpus} ${SpotBidPercentage} ${AWS::StackName} ${CustomAMI} ${FileSystemId} ${QueueCapacityType} ${DisableSimultaneousMultithreading} $efaEnabled ${PlacementGroup} ${FileSystemType}
265290
/opt/aws/bin/cfn-signal --exit-code 0 --resource EC2Instance --region ${AWS::Region} --stack ${AWS::StackName}
266291
sleep 10
267292
aws ec2 stop-instances --instance-ids `wget -qO- http://instance-data/latest/meta-data/instance-id`

cft-templates/sagemaker-template-with-url.yml

Lines changed: 61 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,14 @@ Parameters:
99
AllowedValues:
1010
- ml.t2.medium
1111
- ml.t3.medium
12+
- ml.m5.large
13+
- ml.m5.xlarge
14+
- ml.m5.2xlarge
15+
- ml.m5.4xlarge
16+
- ml.g4dn.large
17+
- ml.g4dn.xlarge
18+
- ml.g4dn.2xlarge
19+
- ml.g4dn.4xlarge
1220
ConstraintDescription: Must select a valid notebook instance type.
1321
Default: ml.t3.medium
1422
Description: Select Instance type for the SageMaker Notebook. e.g.ml.t3.medium
@@ -35,12 +43,63 @@ Resources:
3543
Properties:
3644
InstanceType: !Ref NotebookInstanceType
3745
RoleArn: !GetAtt SageMakerRole.Arn
38-
LifecycleConfigName: 'Research-Portal-Setup'
46+
PlatformIdentifier: notebook-al2-v2
47+
LifecycleConfigName: !GetAtt NotebookLifeCycleConfig.NotebookInstanceLifecycleConfigName
3948
Tags:
4049
- Key: cost_resource
4150
Value: !Sub ${AWS::StackName}
4251
- Key: Name
43-
Value: !Sub ${AWS::StackName}
52+
Value: !Sub ${AWS::StackName}
53+
54+
NotebookLifeCycleConfig:
55+
Type: AWS::SageMaker::NotebookInstanceLifecycleConfig
56+
Properties:
57+
OnStart:
58+
- Content:
59+
Fn::Base64: !Sub |
60+
#!/bin/bash
61+
62+
set -e
63+
64+
function get_tag()
65+
{
66+
67+
NOTEBOOK_ARN=$(jq '.ResourceArn' /opt/ml/metadata/resource-metadata.json --raw-output)
68+
TAG_NAME=$1
69+
local value=$(aws sagemaker list-tags --resource-arn $NOTEBOOK_ARN | jq -r --arg TAG_NAME "$TAG_NAME" .'Tags[] | select(.Key == $TAG_NAME).Value' --raw-output)
70+
echo "$value"
71+
}
72+
73+
# PARAMETERS
74+
DATA_BUCKET=$(get_tag "DATA_BUCKET")
75+
76+
#Set Environment variables
77+
if [[ $DATA_BUCKET != '' ]]
78+
then
79+
touch /etc/profile.d/jupyter-env.sh
80+
echo "export 'DATA_BUCKET'=$DATA_BUCKET" >> /etc/profile.d/jupyter-env.sh
81+
fi
82+
83+
84+
#Copy Sample notebook from S3
85+
86+
TEMPLATE_NOTEBOOK_BUCKET=$(get_tag "TEMPLATE_NOTEBOOK_BUCKET")
87+
TEMPLATE_NOTEBOOK_DIRECTORY="/home/ec2-user/sample-notebooks/research_portal_templates/getting_started"
88+
89+
# Copy the files only when the bucket exists
90+
91+
if aws s3api head-bucket --bucket "$TEMPLATE_NOTEBOOK_BUCKET" 2>/dev/null; then
92+
mkdir -p $TEMPLATE_NOTEBOOK_DIRECTORY
93+
aws s3 cp s3://$TEMPLATE_NOTEBOOK_BUCKET/ $TEMPLATE_NOTEBOOK_DIRECTORY/ --recursive
94+
chown -R "ec2-user":"ec2-user" $TEMPLATE_NOTEBOOK_DIRECTORY
95+
else
96+
echo "Template bucket not found. Skipping sample notebook creation"
97+
fi
98+
99+
systemctl restart jupyter-server
100+
101+
102+
44103
Outputs:
45104
SageMakerNotebookInstanceARN:
46105
Description: "ARN for the newly created SageMaker Notebook Instance"

docker-compose.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ services:
1818
- sp2net
1919

2020
cc-3102:
21-
image: 045938549113.dkr.ecr.us-east-2.amazonaws.com/researchportal:_fd_1.14.2_b1452
21+
image: 045938549113.dkr.ecr.us-east-2.amazonaws.com/researchportal:_fd_1.15.0_b1480
2222
secrets:
2323
- source: sp2prod-config.json
2424
target: /rlc/cc/server/app/config/config.json
@@ -42,7 +42,7 @@ services:
4242
command: /bin/bash start.sh
4343

4444
scheduler-3102:
45-
image: 045938549113.dkr.ecr.us-east-2.amazonaws.com/researchportal:_fd_1.14.2_b1452
45+
image: 045938549113.dkr.ecr.us-east-2.amazonaws.com/researchportal:_fd_1.15.0_b1480
4646
secrets:
4747
- source: sp2prod-config.json
4848
target: /rlc/cc/server/app/config/config.json
@@ -62,7 +62,7 @@ services:
6262
command: node ./app/scheduler/app.js
6363

6464
notificationsink:
65-
image: 045938549113.dkr.ecr.us-east-2.amazonaws.com/notificationsink:1.14.0_b3
65+
image: 045938549113.dkr.ecr.us-east-2.amazonaws.com/notificationsink:1.15.0_b1
6666
secrets:
6767
- source: sp2prod-config.json
6868
target: /opt/app/config/config.json

packer-rg.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,13 @@
66
"awsRegion": "",
77
"RG_HOME": "/opt/deploy/sp2",
88
"RG_SRC": "/home/ubuntu",
9-
"amiName": "Ubuntu20.04_MongoDB3.6_Docker-ce20.10"
9+
"amiName": "RG-AMI-1.15.0"
1010
},
1111
"builders": [
1212
{
1313
"type": "amazon-ebs",
1414
"profile": "{{user `awsProfile`}}",
15-
"iam_instance_profile": "packer-role-test",
15+
"iam_instance_profile": "packer-role1",
1616
"region": "{{user `awsRegion`}}",
1717
"vpc_id": "{{user `vpcId`}}",
1818
"subnet_id": "{{user `subnetId`}}",

products/PCluster/machine-images/config/infra/files/pcluster/Provision-pcluster.sh

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ QueueCapacityType=${15}
4646
disableSimultaneousMultithreading=${16}
4747
efa=${17}
4848
placementGroup=${18}
49+
FileSystemType=${19}
4950

5051
IFS='-' read -ra TRIMMED <<< "$CustomAMI"
5152
CustomAMIStartsWith=${TRIMMED[0]}
@@ -54,8 +55,13 @@ if [ "$scheduler" == "slurm" ]; then
5455
if [ "$CustomAMIStartsWith" == "ami" ]; then
5556
yq -i ".Image.CustomAmi=\"$CustomAMI\"" slurm.yaml
5657
fi
57-
if [ "$FileSystemId" != "default" ]; then
58-
yq -i '.SharedStorage=[{"MountDir": "/fsx", "Name":"RG_Filesysytem", "StorageType": "FsxLustre", "FsxLustreSettings":{"FileSystemId":"'$FileSystemId'"}}]' slurm.yaml
58+
if [ "$FileSystemType" == "FSxForLustre" ] && [ "$FileSystemId" != "default" ]; then
59+
echo "Mounting $FileSystemId FSxForLustre filesystem to headnode"
60+
yq -i '.SharedStorage=[{"MountDir": "/fsx", "Name":"RG_Fsx_Filesysytem", "StorageType": "FsxLustre", "FsxLustreSettings":{"FileSystemId":"'$FileSystemId'"}}]' slurm.yaml
61+
fi
62+
if [ "$FileSystemType" == "EFS" ] && [ "$FileSystemId" != "default" ]; then
63+
echo "Mounting $FileSystemId EFS filesystem to headnode"
64+
yq -i '.SharedStorage=[{"MountDir": "/efs", "Name":"RG_Efs_Filesysytem", "StorageType": "Efs", "EfsSettings":{"FileSystemId":"'$FileSystemId'"}}]' slurm.yaml
5965
fi
6066
yq -i ".Region=\"$Region\"" slurm.yaml
6167
yq -i ".HeadNode.InstanceType=\"$headnodeinstancetype\"" slurm.yaml
@@ -79,6 +85,10 @@ else
7985
if [ "$CustomAMIStartsWith" == "ami" ]; then
8086
yq -i ".Image.CustomAmi=\"$CustomAMI\"" batch.yaml
8187
fi
88+
if [ "$FileSystemType" == "EFS" ] && [ "$FileSystemId" != "default" ]; then
89+
echo "Mounting $FileSystemId EFS filesystem to headnode"
90+
yq -i '.SharedStorage=[{"MountDir": "/efs", "Name":"RG_Efs_Filesysytem", "StorageType": "Efs", "EfsSettings":{"FileSystemId":"'$FileSystemId'"}}]' batch.yaml
91+
fi
8292
yq -i ".Region=\"$Region\"" batch.yaml
8393
yq -i ".HeadNode.InstanceType=\"$headnodeinstancetype\"" batch.yaml
8494
yq -i ".HeadNode.Networking.SubnetId=\"$headnodesubnetId\"" batch.yaml

provisioners/provision-ecr.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#!/bin/bash -xe
22
sudo docker login -u AWS -p $(aws ecr get-login-password --region us-east-2) 045938549113.dkr.ecr.us-east-2.amazonaws.com
3-
sudo docker pull 045938549113.dkr.ecr.us-east-2.amazonaws.com/researchportal:_fd_1.14.2_b1452
3+
sudo docker pull 045938549113.dkr.ecr.us-east-2.amazonaws.com/researchportal:_fd_1.15.0_b1480
44
sudo docker pull 045938549113.dkr.ecr.us-east-2.amazonaws.com/nginx:latest
5-
sudo docker pull 045938549113.dkr.ecr.us-east-2.amazonaws.com/notificationsink:1.14.0_b3
5+
sudo docker pull 045938549113.dkr.ecr.us-east-2.amazonaws.com/notificationsink:1.15.0_b1

0 commit comments

Comments
 (0)