Uploaded image for project: 'Hadoop YARN'
  1. Hadoop YARN
  2. YARN-7069 [Umbrella] YARN Resource Profiles phase#2 enhancements
  3. YARN-7383

Node resource is not parsed correctly for resource names containing dot

    XMLWordPrintableJSON

Details

    • Reviewed

    Description

      Currently when getting resource capabilities in node-resources.xml, the following parsing code is used:

          String[] parts = prop.split("\\.");
          LOG.info("Found resource entry " + prop);
          if (parts.length == 4) {
            String resourceType = parts[3];
            if (!nodeResources.containsKey(resourceType)) {
              nodeResources
                  .put(resourceType, ResourceInformation.newInstance(resourceType));
            }
            String units = getUnits(value);
            Long resourceValue =
                Long.valueOf(value.substring(0, value.length() - units.length()));
            nodeResources.get(resourceType).setValue(resourceValue);
            nodeResources.get(resourceType).setUnits(units);
            if (LOG.isDebugEnabled()) {
              LOG.debug("Setting value for resource type " + resourceType + " to "
                  + resourceValue + " with units " + units);
            }
          }

      If resource names contain dots though (e.g. for resource names in a namespace) this will not parse correctly.

      Attachments

        1. YARN-7383.001.patch
          5 kB
          Gergely Novák
        2. YARN-7383.002.patch
          5 kB
          Gergely Novák

        Activity

          People

            GergelyNovak Gergely Novák
            jhung Jonathan Hung
            Votes:
            0 Vote for this issue
            Watchers:
            7 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: