Converting old mapping rule format to JSON-based placement rule format

Reviewing how the old colon-separated mapping rule format is converted into the new JSON-based mapping rules format can help you understand the automatic placement rule conversion.

From Cloudera Runtime 7.1.6 placement rules are described in a JSON-based format. This format conversion is automatically done at the first time you use the YARN Queue Manager UI in CDP Private Cloud Base 7.1.6 or higher. If you use Cloudera Runtime 7.1.6 or higher you must use the new JSON-based placement rule format.

Table 1. Mapping rule conversion into the new JSON-based placement rule format
Old mapping rule New JSON-based placement rule
u:username:root.user.queue
{ 
  "type": "user",
  "matches": "username",
  "policy": "custom",
  "customPlacement": "root.user.queue",
  "fallbackResult":"placeDefault"
 }
u:%user:%user
{ 
  "type": "user",
  "matches": "*", 
  "policy": "user", 
  "fallbackResult":"placeDefault" 
}
u:%user:root.parent.%user
{ 
  "type": "user",
  "matches": "*",
  "policy": "user",
  "parentQueue": "root.parent",
  "fallbackResult":"placeDefault" 
}
u:%user:%primary_group
{ 
  "type": "user", 
  "matches": "*", 
  "policy": "primaryGroup",
  "fallbackResult":"placeDefault"
 }
u:%user:%primary_group.%user
{ 
  "type": "user",
  "matches": "*", 
  "policy": "primaryGroupUser", 
  "fallbackResult":"placeDefault" 
}
u:%user:root.groups.%primary_group.%user
{ 
  "type": "user",
  "matches": "*", 
  "policy": "primaryGroupUser", 
  "parentQueue": "root.groups", 
  "fallbackResult":"placeDefault" 
}
u:%user:%secondary_group
{ 
  "type": "user",
  "matches": "*", 
  "policy": "secondaryGroup", 
  "fallbackResult":"placeDefault" 
}
u:%user:%secondary_group.%user
{ 
  "type": "user",
  "matches": "*", 
  "policy": "secondaryGroupUser", 
  "fallbackResult":"placeDefault" 
}
u:%user:root.groups.%secondary_group.%user
{ 
  "type": "user",
  “matches": "*", 
  "policy": "secondaryGroupUser", 
  "parentQueue": "root.groups", 
  "fallbackResult":"placeDefault" 
}
g:hadoop:root.groups.hadoop
{ 
  “type": "group",
  "matches": "hadoop",
  "policy": "custom", 
  "customPlacement": "root.groups.hadoop", 
  "fallbackResult":"placeDefault"
 }
%application:%application 
(application mapping)
{ 
  "type": "user",
  "matches": "*",
  "policy": "applicationName", 
  "fallbackResult":"placeDefault" 
}
hive_query:root.query.hive 
(application mapping)
{ 
  "type": "application",
  "matches": "hive_query", 
  "policy": "custom",
  "customPlacement": "root.query.hive",
  "fallbackResult":"placeDefault" 
}

It's worth noting that %application:%application requires a user type matcher. It is because internally, the "*" is interpreted only for users. If you set the type to application, then the "*" means to match an application which is named "*".