Skip to main content

Home

Regular Expressions (regex) (EMR)

You can add regular expressions (regex) to AutoActions templates when you narrow the scope of User , Cluster, Queue, and Application Name with Only or Except. You can specify regular expressions in the Transform box. Ensure to always select a scope before you specify the regex.

In the following example, regex is used to define the user scope.

{
"enabled": true,
"admin": true,
"policy_name": "Long running YARN application",
"policy_id": 1109,
"instance_id": "1435116062919541652",
"entity_type": "yarn",
"name_by_user": "Long running YARN application",
"description_by_user": "",
"created_by": "admin",
"last_edited_by": "admin",
"created_at": 1675658023822,
"updated_at": 1675658023822,
"rules": [
{
"scope": "apps",
"metric": "elapsedTime",
"compare": ">=",
"state": "running",
"value": 0
}
],
"actions": [

],
"cluster_mode": 0,
"cluster_list": [

],
"cluster_transform": "",
"queue_mode": 0,
"queue_list": [

],
"queue_transform": "",
"user_mode": 2,
"user_list": [
"vlad",
"jsmith"
],
"user_transform": "regex/^.*[.](.+)[.](.+)$/$2/",
"app_mode": 1,
"app_list": [

],
"sustain_mode": 0,
"sustain_time": 0,
"time_mode": 0
}

Note

Keyword regex is mandatory. regex keyword is similar to substitute s in regular expressions.