Rule Enterprise
Use the Workload Management (WLM) API to create, retrieve, update, and delete WLM rules.
The rule object includes a rules array (also called the ruleset). Each object in the rules array represents an individual rule. Dremio processes rules in the order they are listed within the rules array: the highest-priority rule is listed first, and the lowest-priority rule is listed last.
Rule Object{
"tag": "VmqwaZ90VY4=",
"rules": [
{
"name": "High Cost Reflections",
"conditions": "query_type() = 'Reflections' AND query_cost() >= 30000000",
"acceptId": "1990e713-3cd2-458c-89e1-68995c2c1047",
"acceptName": "High Cost Reflections",
"action": "PLACE",
"id": "fa1ec87d-923b-414c-9064-e079f39f5c49"
},
{
"name": "Low Cost Reflections",
"conditions": "query_type() = 'Reflections' AND query_cost() < 30000000",
"acceptId": "0dbc50a0-034d-40f6-92f7-ff11eda0c760",
"acceptName": "Low Cost Reflections",
"action": "PLACE",
"id": "dcf15b80-403c-4eba-b600-41ea9319e103"
},
{
"name": "COPY & OPTIMIZATION Rule",
"conditions": "query_label() in ('COPY','OPTIMIZATION')",
"acceptId": "450ea2a5-9a64-4679-99cb-7b01bf6bba27",
"acceptName": "COPY & OPTIMIZATION Queue",
"action": "PLACE",
"id": "a7f27aea-1e23-4699-8846-51e731c219e9"
},
{
"name": "High Cost User Queries",
"conditions": "query_cost() >= 30000000",
"acceptId": "c2917cce-b566-4c6a-be63-2e28488a6928",
"acceptName": "High Cost User Queries",
"action": "PLACE",
"id": "880d84a2-548d-4040-b6ba-a5371e87aecf"
},
{
"name": "Low Cost User Queries",
"conditions": "query_cost() < 30000000",
"acceptId": "a254d63e-9b0e-41be-af4a-1acc5bfe2332",
"acceptName": "Low Cost User Queries",
"action": "PLACE",
"id": "c0fa6e0b-e479-497b-846a-ad543009a309"
}
],
"defaultRule": {
"name": "All Other Queries",
"action": "REJECT",
"id": "8df37560-68c5-45a6-8e1f-4ee2e8438f81"
}
}
Rule Attributes
{{< api-section file="data/software-api/wlm.json" data="ruleAttributes" >}}
rules
{{< api-section file="data/software-api/wlm.json" data="ruleRulesAttributes" >}}
defaultRule
{{< api-section file="data/software-api/wlm.json" data="ruledefaultRuleAttributes" >}}
Creating or Updating a Rule
Create or update a WLM rule.
In the WLM API, you interact with the ruleset in the rules array rather than individual rules themselves. To add or update an individual rule, you must include the entire rules array in the request body. It is not necessary to specify the ID for the rule you want to delete in the request URL.
Method and URLPUT /api/v3/wlm/rule
Parameters
{{< api-section file="data/software-api/wlm.json" data="createUpdateRuleParameters" >}}
rules
{{< api-section file="data/software-api/wlm.json" data="ruleRulesParameters" >}}
defaultRule
{{< api-section file="data/software-api/wlm.json" data="ruledefaultRuleParameters" >}}
This example request demonstrates how to add a DevOps and Engineering rule to the ruleset:
curl -X PUT 'https://{DREMIO_ORIGIN}/api/v3/wlm/rule' \
--header 'Authorization: _dremio{tokenstring}' \
--header 'Content-Type: application/json' \
--data-raw '{
"tag": "VmqwaZ90VY4=",
"rules": [
{
"name": "DevOps and Engineering",
"conditions": "is_member('DevOps') OR is_member('Engineering')",
"acceptId": "b9g7r35c-bda9-e4fb-bagf-9ceaceb9f7c1",
"acceptName": "DevOps and Eng Testing",
"action": "PLACE"
},
{
"name": "High Cost Reflections",
"conditions": "query_type() = 'Reflections' AND query_cost() >= 30000000",
"acceptId": "1990e713-3cd2-458c-89e1-68995c2c1047",
"acceptName": "High Cost Reflections",
"action": "PLACE",
"id": "fa1ec87d-923b-414c-9064-e079f39f5c49"
},
{
"name": "Low Cost Reflections",
"conditions": "query_type() = 'Reflections' AND query_cost() < 30000000",
"acceptId": "0dbc50a0-034d-40f6-92f7-ff11eda0c760",
"acceptName": "Low Cost Reflections",
"action": "PLACE",
"id": "dcf15b80-403c-4eba-b600-41ea9319e103"
},
{
"name": "COPY & OPTIMIZATION Rule",
"conditions": "query_label() in ('COPY','OPTIMIZATION')",
"acceptId": "450ea2a5-9a64-4679-99cb-7b01bf6bba27",
"acceptName": "COPY & OPTIMIZATION Queue",
"action": "PLACE",
"id": "a7f27aea-1e23-4699-8846-51e731c219e9"
},
{
"name": "High Cost User Queries",
"conditions": "query_cost() >= 30000000",
"acceptId": "c2917cce-b566-4c6a-be63-2e28488a6928",
"acceptName": "High Cost User Queries",
"action": "PLACE",
"id": "880d84a2-548d-4040-b6ba-a5371e87aecf"
},
{
"name": "Low Cost User Queries",
"conditions": "query_cost() < 30000000",
"acceptId": "a254d63e-9b0e-41be-af4a-1acc5bfe2332",
"acceptName": "Low Cost User Queries",
"action": "PLACE",
"id": "c0fa6e0b-e479-497b-846a-ad543009a309"
}
],
"defaultRule": {
"name": "All Other Queries",
"action": "REJECT",
"id": "8df37560-68c5-45a6-8e1f-4ee2e8438f81"
}
}'
{
"tag": "3uzixTFD134=",
"rules": [
{
"name": "DevOps and Engineering",
"conditions": "is_member('DevOps') OR is_member('Engineering')",
"acceptId": "b9g7r35c-bda9-e4fb-bagf-9ceaceb9f7c1",
"acceptName": "DevOps and Eng Testing",
"action": "PLACE",
"id": "e4983ad5-cd4b-4b4a-9410-b5c37021ce34"
},
{
"name": "High Cost Reflections",
"conditions": "query_type() = 'Reflections' AND query_cost() >= 30000000",
"acceptId": "1990e713-3cd2-458c-89e1-68995c2c1047",
"acceptName": "High Cost Reflections",
"action": "PLACE",
"id": "fa1ec87d-923b-414c-9064-e079f39f5c49"
},
{
"name": "Low Cost Reflections",
"conditions": "query_type() = 'Reflections' AND query_cost() < 30000000",
"acceptId": "0dbc50a0-034d-40f6-92f7-ff11eda0c760",
"acceptName": "Low Cost Reflections",
"action": "PLACE",
"id": "dcf15b80-403c-4eba-b600-41ea9319e103"
},
{
"name": "COPY & OPTIMIZATION Rule",
"conditions": "query_label() in ('COPY','OPTIMIZATION')",
"acceptId": "450ea2a5-9a64-4679-99cb-7b01bf6bba27",
"acceptName": "COPY & OPTIMIZATION Queue",
"action": "PLACE",
"id": "a7f27aea-1e23-4699-8846-51e731c219e9"
},
{
"name": "High Cost User Queries",
"conditions": "query_cost() >= 30000000",
"acceptId": "c2917cce-b566-4c6a-be63-2e28488a6928",
"acceptName": "High Cost User Queries",
"action": "PLACE",
"id": "880d84a2-548d-4040-b6ba-a5371e87aecf"
},
{
"name": "Low Cost User Queries",
"conditions": "query_cost() < 30000000",
"acceptId": "a254d63e-9b0e-41be-af4a-1acc5bfe2332",
"acceptName": "Low Cost User Queries",
"action": "PLACE",
"id": "c0fa6e0b-e479-497b-846a-ad543009a309"
}
],
"defaultRule": {
"name": "All Other Queries",
"action": "REJECT",
"id": "8df37560-68c5-45a6-8e1f-4ee2e8438f81"
}
}
To change the order in which Dremio processes rules, send a PUT request that lists the rules in the desired order within the rules array, with the highest-priority rule listed first, and the lowest-priority rule listed last.
This example request reorders the rules so that the COPY & OPTIMIZATION Rule will be the highest-priority rule:
curl -X PUT 'https://{DREMIO_ORIGIN}/api/v3/wlm/rule' \
--header 'Authorization: _dremio{tokenstring}' \
--header 'Content-Type: application/json' \
--data-raw '{
"tag": "VmqwaZ90VY4=",
"rules": [
{
"name": "COPY & OPTIMIZATION Rule",
"conditions": "query_label() in ('COPY','OPTIMIZATION')",
"acceptId": "450ea2a5-9a64-4679-99cb-7b01bf6bba27",
"acceptName": "COPY & OPTIMIZATION Queue",
"action": "PLACE",
"id": "a7f27aea-1e23-4699-8846-51e731c219e9"
},
{
"name": "High Cost Reflections",
"conditions": "query_type() = 'Reflections' AND query_cost() >= 30000000",
"acceptId": "1990e713-3cd2-458c-89e1-68995c2c1047",
"acceptName": "High Cost Reflections",
"action": "PLACE",
"id": "fa1ec87d-923b-414c-9064-e079f39f5c49"
},
{
"name": "Low Cost Reflections",
"conditions": "query_type() = 'Reflections' AND query_cost() < 30000000",
"acceptId": "0dbc50a0-034d-40f6-92f7-ff11eda0c760",
"acceptName": "Low Cost Reflections",
"action": "PLACE",
"id": "dcf15b80-403c-4eba-b600-41ea9319e103"
},
{
"name": "High Cost User Queries",
"conditions": "query_cost() >= 30000000",
"acceptId": "c2917cce-b566-4c6a-be63-2e28488a6928",
"acceptName": "High Cost User Queries",
"action": "PLACE",
"id": "880d84a2-548d-4040-b6ba-a5371e87aecf"
},
{
"name": "Low Cost User Queries",
"conditions": "query_cost() < 30000000",
"acceptId": "a254d63e-9b0e-41be-af4a-1acc5bfe2332",
"acceptName": "Low Cost User Queries",
"action": "PLACE",
"id": "c0fa6e0b-e479-497b-846a-ad543009a309"
}
],
"defaultRule": {
"name": "All Other Queries",
"action": "REJECT",
"id": "8df37560-68c5-45a6-8e1f-4ee2e8438f81"
}
}'
{
"tag": "3uzixTFD134=",
"rules": [
{
"name": "COPY & OPTIMIZATION Rule",
"conditions": "query_label() in ('COPY','OPTIMIZATION')",
"acceptId": "450ea2a5-9a64-4679-99cb-7b01bf6bba27",
"acceptName": "COPY & OPTIMIZATION Queue",
"action": "PLACE",
"id": "a7f27aea-1e23-4699-8846-51e731c219e9"
},
{
"name": "High Cost Reflections",
"conditions": "query_type() = 'Reflections' AND query_cost() >= 30000000",
"acceptId": "1990e713-3cd2-458c-89e1-68995c2c1047",
"acceptName": "High Cost Reflections",
"action": "PLACE",
"id": "fa1ec87d-923b-414c-9064-e079f39f5c49"
},
{
"name": "Low Cost Reflections",
"conditions": "query_type() = 'Reflections' AND query_cost() < 30000000",
"acceptId": "0dbc50a0-034d-40f6-92f7-ff11eda0c760",
"acceptName": "Low Cost Reflections",
"action": "PLACE",
"id": "dcf15b80-403c-4eba-b600-41ea9319e103"
},
{
"name": "High Cost User Queries",
"conditions": "query_cost() >= 30000000",
"acceptId": "c2917cce-b566-4c6a-be63-2e28488a6928",
"acceptName": "High Cost User Queries",
"action": "PLACE",
"id": "880d84a2-548d-4040-b6ba-a5371e87aecf"
},
{
"name": "Low Cost User Queries",
"conditions": "query_cost() < 30000000",
"acceptId": "a254d63e-9b0e-41be-af4a-1acc5bfe2332",
"acceptName": "Low Cost User Queries",
"action": "PLACE",
"id": "c0fa6e0b-e479-497b-846a-ad543009a309"
}
],
"defaultRule": {
"name": "All Other Queries",
"action": "REJECT",
"id": "8df37560-68c5-45a6-8e1f-4ee2e8438f81"
}
}
Response Status Codes
{{< api-responses file="data/software-api/wlm.json" data="createUpdateRuleResponses" >}}
Retrieving All Rules
Retrieve all WLM rules.
Method and URLGET /api/v3/wlm/rule
curl -X GET 'https://{DREMIO_ORIGIN}/api/v3/wlm/rule' \
--header 'Authorization: _dremio{tokenstring}' \
--header 'Content-Type: application/json'
{
"tag": "3uzixTFD134=",
"rules": [
{
"name": "DevOps and Engineering",
"conditions": "is_member('DevOps') OR is_member('Engineering')",
"acceptId": "b9g7r35c-bda9-e4fb-bagf-9ceaceb9f7c1",
"acceptName": "DevOps and Eng Testing",
"action": "PLACE",
"id": "e4983ad5-cd4b-4b4a-9410-b5c37021ce34"
},
{
"name": "High Cost Reflections",
"conditions": "query_type() = 'Reflections' AND query_cost() >= 30000000",
"acceptId": "1990e713-3cd2-458c-89e1-68995c2c1047",
"acceptName": "High Cost Reflections",
"action": "PLACE",
"id": "fa1ec87d-923b-414c-9064-e079f39f5c49"
},
{
"name": "Low Cost Reflections",
"conditions": "query_type() = 'Reflections' AND query_cost() < 30000000",
"acceptId": "0dbc50a0-034d-40f6-92f7-ff11eda0c760",
"acceptName": "Low Cost Reflections",
"action": "PLACE",
"id": "dcf15b80-403c-4eba-b600-41ea9319e103"
},
{
"name": "COPY & OPTIMIZATION Rule",
"conditions": "query_label() in ('COPY','OPTIMIZATION')",
"acceptId": "450ea2a5-9a64-4679-99cb-7b01bf6bba27",
"acceptName": "COPY & OPTIMIZATION Queue",
"action": "PLACE",
"id": "a7f27aea-1e23-4699-8846-51e731c219e9"
},
{
"name": "High Cost User Queries",
"conditions": "query_cost() >= 30000000",
"acceptId": "c2917cce-b566-4c6a-be63-2e28488a6928",
"acceptName": "High Cost User Queries",
"action": "PLACE",
"id": "880d84a2-548d-4040-b6ba-a5371e87aecf"
},
{
"name": "Low Cost User Queries",
"conditions": "query_cost() < 30000000",
"acceptId": "a254d63e-9b0e-41be-af4a-1acc5bfe2332",
"acceptName": "Low Cost User Queries",
"action": "PLACE",
"id": "c0fa6e0b-e479-497b-846a-ad543009a309"
}
],
"defaultRule": {
"name": "All Other Queries",
"action": "REJECT",
"id": "8df37560-68c5-45a6-8e1f-4ee2e8438f81"
}
}
Response Status Codes
{{< api-responses file="data/software-api/wlm.json" data="retrieveRuleResponses" >}}
Deleting a Rule
Delete a WLM rule from the ruleset.
In the WLM API, you interact with the ruleset in the rules array rather than individual rules themselves. To delete a rule, send a PUT request that omits the rule from the rules array. It is not necessary to specify the ID for the rule you want to delete in the request URL.
The default rule can be updated but cannot be deleted.
PUT /api/v3/wlm/rule/
This example request demonstrates how to remove the DevOps and Engineering rule added in the Create or Update a Rule example:
curl -X PUT 'https://{DREMIO_ORIGIN}/api/v3/wlm/rule' \
--header 'Authorization: _dremio{tokenstring}' \
--header 'Content-Type: application/json' \
--data-raw '{
"tag": "3uzixTFD134=",
"rules": [
{
"name": "High Cost Reflections",
"conditions": "query_type() = 'Reflections' AND query_cost() >= 30000000",
"acceptId": "1990e713-3cd2-458c-89e1-68995c2c1047",
"acceptName": "High Cost Reflections",
"action": "PLACE",
"id": "fa1ec87d-923b-414c-9064-e079f39f5c49"
},
{
"name": "Low Cost Reflections",
"conditions": "query_type() = 'Reflections' AND query_cost() < 30000000",
"acceptId": "0dbc50a0-034d-40f6-92f7-ff11eda0c760",
"acceptName": "Low Cost Reflections",
"action": "PLACE",
"id": "dcf15b80-403c-4eba-b600-41ea9319e103"
},
{
"name": "COPY & OPTIMIZATION Rule",
"conditions": "query_label() in ('COPY','OPTIMIZATION')",
"acceptId": "450ea2a5-9a64-4679-99cb-7b01bf6bba27",
"acceptName": "COPY & OPTIMIZATION Queue",
"action": "PLACE",
"id": "a7f27aea-1e23-4699-8846-51e731c219e9"
},
{
"name": "High Cost User Queries",
"conditions": "query_cost() >= 30000000",
"acceptId": "c2917cce-b566-4c6a-be63-2e28488a6928",
"acceptName": "High Cost User Queries",
"action": "PLACE",
"id": "880d84a2-548d-4040-b6ba-a5371e87aecf"
},
{
"name": "Low Cost User Queries",
"conditions": "query_cost() < 30000000",
"acceptId": "a254d63e-9b0e-41be-af4a-1acc5bfe2332",
"acceptName": "Low Cost User Queries",
"action": "PLACE",
"id": "c0fa6e0b-e479-497b-846a-ad543009a309"
}
],
"defaultRule": {
"name": "All Other Queries",
"action": "REJECT",
"id": "8df37560-68c5-45a6-8e1f-4ee2e8438f81"
}
}'
{
"tag": "VmqwaZ90VY4=",
"rules": [
{
"name": "High Cost Reflections",
"conditions": "query_type() = 'Reflections' AND query_cost() >= 30000000",
"acceptId": "1990e713-3cd2-458c-89e1-68995c2c1047",
"acceptName": "High Cost Reflections",
"action": "PLACE",
"id": "fa1ec87d-923b-414c-9064-e079f39f5c49"
},
{
"name": "Low Cost Reflections",
"conditions": "query_type() = 'Reflections' AND query_cost() < 30000000",
"acceptId": "0dbc50a0-034d-40f6-92f7-ff11eda0c760",
"acceptName": "Low Cost Reflections",
"action": "PLACE",
"id": "dcf15b80-403c-4eba-b600-41ea9319e103"
},
{
"name": "COPY & OPTIMIZATION Rule",
"conditions": "query_label() in ('COPY','OPTIMIZATION')",
"acceptId": "450ea2a5-9a64-4679-99cb-7b01bf6bba27",
"acceptName": "COPY & OPTIMIZATION Queue",
"action": "PLACE",
"id": "a7f27aea-1e23-4699-8846-51e731c219e9"
},
{
"name": "High Cost User Queries",
"conditions": "query_cost() >= 30000000",
"acceptId": "c2917cce-b566-4c6a-be63-2e28488a6928",
"acceptName": "High Cost User Queries",
"action": "PLACE",
"id": "880d84a2-548d-4040-b6ba-a5371e87aecf"
},
{
"name": "Low Cost User Queries",
"conditions": "query_cost() < 30000000",
"acceptId": "a254d63e-9b0e-41be-af4a-1acc5bfe2332",
"acceptName": "Low Cost User Queries",
"action": "PLACE",
"id": "c0fa6e0b-e479-497b-846a-ad543009a309"
}
],
"defaultRule": {
"name": "All Other Queries",
"action": "REJECT",
"id": "8df37560-68c5-45a6-8e1f-4ee2e8438f81"
}
}
Response Status Codes
{{< api-responses file="data/software-api/wlm.json" data="deleteRuleResponses" >}}