Skip to content

(2.10.0 2.11.4) Tags in number interpreted as integer instead of string possible cause value error in Compute resource launch template

chenwany edited this page Jan 27, 2022 · 3 revisions

The issue

When creating cluster with tags set in the cluster configuration, if the tag’s key or value are in number, they are interpreted as integer instead of string, possibly causing unexpected value conversion when tagging compute resources. For example, cluster section with value tags = {"key" : "00000122"} is interpreted as “Key: key, Value: 82” for compute resources launched from launch template, because "00000122" is considered an octal and its string representation is converted to decimal.

This issue affects versions >=2.10.0, <=2.11.4 when creating cluster with number as tags.

The root-cause

ParallelCluster create compute fleet launch templates and pass the tags specified in the cluster configuration through cfn yaml template. The problem is that when yaml passing number without quote, it interprets it as integer instead of string.

- Key: {{ tag.Key }}  
  Value: {{ tag.Value }}

Quotes is needed if the passing value are numbers in case we want to interpret them as string.

- Key: "{{ tag.Key }}"  
  Value: "{{ tag.Value }}"

The workaround

Recommended solution is to upgrade to the latest version of ParallelCluster 3, that do not present the issue. If you are not able to upgrade in the short term, here's the alternative workarounds:

  1. Customer can avoid the problem by not adding 0 at the beginning of the tags. For example, use “112” as value instead of “0112”, because "122" is decimal while "0122" is octal and will be converted.

  2. In the case the customer needs to use the existing cluster, the temporary workaround is to modify the compute launch templates:

  • The launch template name is in the following format: {cluster-name}-{queue-name}-{instance-type}. ParallelCluster create launch template for each compute resource. Therefore the total number of launch templates to modify will be equal to the numbers of compute resources.

  • First, you can go to the ec2-console, launch template, change the ResourceTag, in the row which tags interpreted as wrong value, change the value to the correct one, then save the changes.

  • Secondly, If there are existing compute nodes, you can terminate the instances in the ec2-console, or running pcluster stop and start. Please don’t terminate the headnode.

  • The next time when the compute node is launched, it’ll get the tag with the correct value.

  • Note: This is a temporary workaround and does not support cluster update. If you run a pcluster update to change some configuration of the cluster, you will need to repeat the above steps.

If you are using this approach and have any question, please leave a comment, we would like to to provide further details or a helper script.

Clone this wiki locally