Creating custom YAML files for AWS Parallel Cluster

0

I am trying to follow the tutorial for running FDS/SMV on AWS Parallel Cluster here: https://aws.amazon.com/blogs/compute/fire-dynamics-simulation-cfd-workflow-using-aws-parallelcluster-elastic-fabric-adapter-amazon-fsx-for-lustre-and-nice-dcv/ . I get to the point where it asks me to setup a config file with the following data:

[aws]
aws_region_name = <AWS-REGION>

[global]
sanity_check = true
cluster_template = fds-smv-cluster
update_check = true

[vpc public]
vpc_id = vpc-<VPC-ID>
m ster_subnet_id = subnet-<SUBNET-ID>

[cluster fds-smv-cluster]
key_name = <Key-Name>
vpc_settings = public
compute_instance_type=c5n.18xlarge
m ster_instance_type=c5.xlarge
initial_queue_size = 0
max_queue_size = 100
scheduler=slurm
cluster_type = ondemand
s3_read_write_resource=arn:aws:s3:::fds-smv-bucket-unique*
placement_group = DYNAMIC
placement = compute
base_os = alinux2
tags = {"Name" : "fds-smv"}
disable_hyperthreading = true
fsx_settings = fsxshared
enable_efa = compute
dcv_settings = hpc-dcv

[dcv hpc-dcv]
enable = m ster

[fsx fsxshared]
shared_dir = /fsx
storage_capacity = 1200
import_path = s3://fds-smv-bucket-unique
imported_file_chunk_size = 1024
export_path = s3://fds-smv-bucket-unique

[aliases]
ssh = ssh {CFN_USER}@{M STER_IP} {ARGS}

I am unable to create a YAML file that will be accepted by Parallel Cluster to create-cluster. It returns the error:

{
  "message": "Bad Request: Configuration must be a valid YAML document"
}


I attempted to create a YAML file using AWS Parallel Cluster configure wizard (https://docs.aws.amazon.com/parallelcluster/latest/ug/install-v3-configuring.html) but it does not have all the specifications, like a shared s3 bucket in Fsx, like the tutorial asks for. I tried starting with the wizard created configuration file and editing it so it looks like the YAML files in documentation, but it still returns the same error.

See my edited YAML file here:

Region: us-east-2
Image:
  Os: alinux2
HeadNode:
  InstanceType: c5.xlarge
  Networking:
    SubnetId: subnet-032f3e6409362aff2
  Ssh:
    KeyName: MyKeyPair1
  DisableSimultaneousMultithreading: true
Scheduling:
  Scheduler: slurm
  SlurmQueues:
  - Name: queue1
    CapacityType: ONDEMAND
    ComputeResources:
    - Name: c5n18xlarge
      InstanceType: c5n.18xlarge
      MinCount: 0
      MaxCount: 100
	  Efa:
	    Enabled: true  
    Networking:
      SubnetIds:
      - subnet-032f3e6409362aff2
    Iam:
      S3Access:
        - BucketName: fds-smv-jts-bucket-1
          EnableWriteAccess: True
      AdditionalIamPolicies:
        - Policy: arn:aws:s3:::fds-smv-jts-bucket-1*
SharedStorage:
  - MountDir: /fsx
    StorageType: FsxLustre  
	FsxLustreSettings:
      StorageCapacity: 1200
      ImportedFileChunkSize: 1024
      ExportPath: s3://fds-smv-jts-bucket-1
      ImportPath: s3://fds-smv-jts-bucket-1
Tags:
  - Key: String
    Value: fds-smv
DevSettings
  ClusterTemplate: fds-smv-cluster

Any ideas on how to create the proper YAML file with all the data that is requested for the tutorial?

Thank you!

1 Answer
2
Accepted Answer

In your yaml, you're missing a semicolon after the DevSettings key. I use yamllint (https://pypi.org/project/yamllint/) to lint my yaml files, which may help when validating yaml.

In addition, PCluster 3 includes a configuration converter (https://docs.aws.amazon.com/parallelcluster/latest/ug/pcluster3-config-converter.html). I'd suggest you try to execute that against your pre 3.x configuration file.

You can also find the Parallel Cluster 3 configuration file format here: https://docs.aws.amazon.com/parallelcluster/latest/ug/cluster-configuration-file-v3.html. I think you're looking for the import path and export path associated with an FSX system, which is here (https://docs.aws.amazon.com/parallelcluster/latest/ug/SharedStorage-v3.html#yaml-SharedStorage-FsxLustreSettings-ImportPath) in 3.x configs.

AWS
answered 2 years ago
profile picture
EXPERT
reviewed 10 months ago
  • Thanks. I think all these resources will help a lot. I did not even know there was a lint program for yaml.

  • I used yamllint and could not resolve the following error:

    1:4 error wrong new line character: expected \n (new-lines)

    My first few lines look like this: '

    Region: us-east-2 Image: Os: alinux2 '

    It looks like there was a bug in yamllint that caused it to throw this error for Windows "/n" new line code, which I think you need between the header and the first line. Other than that, this yamllint helped me correct a lot of errors. I took it to Pcluster3 Configuration Converter and got the following error:

    ERROR: Error parsing configuration file cluster-config.yaml. File contains no section headers. file: 'cluster-config.yaml', line: 1 '---\n'

    Also, when trying to use the file as is to create a cluster, I get this error:

    { "configurationValidationErrors": [ { "level": "ERROR", "type": "ConfigSchemaValidator", "message": "[('Scheduling', {'SlurmQueues': {0: {'AdditionalIamPolicies': ['Unknown field.']}}}), ('SharedStorage', {0: {'Name': ['Missing data for required field.']}})]" } ], "message": "Invalid cluster configuration." }

    I think the SlurmQueue needs to be configured first, but I am trying to resolve all of these errors, and I am not sure which is the culprit.

    Thanks!

  • Update: I was able to successfully create a v3 yaml file with the Pcluster3 Configuration Converter by using it on the copy/pasted Ini v2 file from the tutorial.

  • Hi Chris,

    I have tried the above steps, but still i am getting same error.

    { "message": "Bad Request: Configuration must be a valid YAML document" } I have created a pcluster API as mentioned in the aws docs. When i run this from cli it works. When i try to run from API gateway or postman im getting error.

    AWS Doc: https://docs.aws.amazon.com/parallelcluster/latest/ug/tutorials_06_API_use.html

    Please advise how to fix this issue.

    Thanks!

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions