Running policies on demand using REST APIs

Manually execute a policy for an Iceberg table when required. Dry run the policy before you initiate maintenance.

For on-demand execution using Restish, see Running policies on demand using the CLI. When a task reaches SUBMITTED status, monitor the associated Spark jobs in Cloudera Data Engineering.
  1. Get the current statistics for the required table using the GET /tables/{tableId}/stats API.
    Perform this step to view the current table statistics to compare them with the expected statistics after the maintenance actions are complete.
  2. Dry run the policy to determine whether the generated maintenance actions are as expected using the PUT /policies/{policyName}/tables/{tableName}/dryrun API. The API evaluates the statistics and then generates only a set of maintenance actions.
  3. Initiate the evaluation phase using the POST /policies/{policyName}/tables/{tableName}/evaluation API.
    The 200 response shows a unique task ID that you can use to monitor the task and the task metadata.
  4. Monitor the status of the task using the GET /tasks or GET /tasks/id/{id} API.
  5. Verify whether the task completed the maintenance actions as expected using the GET /tables/{tableId}/stats API.