Tamas Domok created YARN-11514:
----------------------------------

             Summary: Extend SchedulerResponse with capacityVector
                 Key: YARN-11514
                 URL: https://issues.apache.org/jira/browse/YARN-11514
             Project: Hadoop YARN
          Issue Type: Sub-task
            Reporter: Tamas Domok


The goal is to add the *capacityVector* to the Scheduler response (XML/JSON).

 - CapacitySchedulerQueueInfo.java
 - PartitionQueueCapacitiesInfo.java

The proposed format in the design doc (YARN-10888):

{code:json}
{
   "capacityVector": {
      "memory-mb": "30%",
      "vcores": "16"
   }
}
{code}

{code:xml}
<?xml version="1.0" encoding="UTF-8" ?>
<capacityVector>
  <memory-mb>30%</memory-mb>
  <vcores>16</vcores>
</capacityVector>
{code}

Unfortunately the current jsonProvider (MoxyJsonFeature or JettisonFeature not 
sure) serialise map structures in the following way:

{code:json}
{
  "capacityVector":{
    "entry":[
      {
        "key":"memory-mb",
        "value":"12288"
      },
      {
        "key":"vcores",
        "value":"86%"
      }
    ]
  }
}
{code}

{code:xml}
<?xml version="1.0" encoding="UTF-8"?>
<capacityVector>
   <entry>
      <key>memory-mb</key>
      <value>1288</value>
   </entry>
   <entry>
      <key>vcores</key>
      <value>12</value>
   </entry>
</capacityVector>
{code}

Based on some research with the following two dependencies we could achieve the 
proposed format:
 - jersey-media-json-jackson (this one is used in the apps catalog already)
 - jackson-dataformat-xml

Some concerns:
 - 2 more dependencies
 - for the XML when the content depends on the runtime content of the map is 
not XSD friendly
 - name is capacityVector but it's represented in a map

An alternative could be to just store the capacityVector as a string, but then 
clients needs to parse it, and it's not particularly nice either:

{code:json}
{
   "capacityVector": "[\"memory-mb\":  12288, \"vcores\":  86%]"
}
{code}

{code:xml}
<?xml version="1.0" encoding="UTF-8" ?>
<capacityVector>[&quot;memory-mb&quot;:  12288, &quot;vcores&quot;:  
86%]</capacityVector>
{code}



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

---------------------------------------------------------------------
To unsubscribe, e-mail: yarn-issues-unsubscr...@hadoop.apache.org
For additional commands, e-mail: yarn-issues-h...@hadoop.apache.org

Reply via email to