Skip to content
Last updated

Managing Pools

Pools are managed through the Treasure Workflow API. Each pool has a unique name and a concurrency limit that caps the number of attempts in the pool that can run at the same time. For the full request and response schema of each endpoint, see the Treasure Workflow API reference.

Prerequisites

  • Treasure AI account administrator permissions.
  • A Master API key.
  • The Treasure Workflow API base URL for your region. See Endpoints for the full list. The examples on this page use the US endpoint, https://api-workflow.treasuredata.com.

How the default pool's limit is adjusted

The sum of every pool's concurrency limit always equals the account's total concurrency limit. When you create, update, or delete a pool, Treasure Workflow adjusts the default pool's limit to preserve that sum. You cannot change the default pool's limit directly.

For example, suppose an account begins with only the default pool, with a starting concurrency limit of 200:

Pool nameConcurrency limit
default200

Create a pool named "activation" with a concurrency limit of 50. The default pool's limit drops by 50:

Pool nameConcurrency limit
default150
activation50

Raise the activation pool's limit to 70. The default pool's limit drops by another 20:

Pool nameConcurrency limit
default130
activation70

Delete the activation pool. Its concurrency limit of 70 returns to the default pool:

Pool nameConcurrency limit
default200

See Treasure Workflow Prerequisites and Limitations for the starting concurrency limit of the default pool.

Constraints

  • A pool's concurrency limit cannot be reduced below the number of attempts currently running in that pool. This also applies to the default pool when its limit is reduced indirectly by creating a new pool or by increasing the limit of an existing pool.
  • A pool cannot be deleted while it has any attempts that have not finished, including blocked, queued, and running attempts.
  • A pool cannot be deleted while any pool rule references it. Delete or update the referencing rules before deleting the pool.
  • The default pool cannot be deleted or renamed and its concurrency limit cannot be set directly.

Create a pool

curl -X POST \
    -H 'Authorization: TD1 <api_key>' \
    -H 'Content-Type: application/json' \
    -d '{"name": "activation", "concurrencyLimit": 50}' \
    https://api-workflow.treasuredata.com/api/pools

The pool name must be unique within the account. The new pool's concurrency limit must be no greater than the default pool's current available slots (the default pool's concurrency limit minus the attempts currently running in it).

List pools

curl -H 'Authorization: TD1 <api_key>' \
    https://api-workflow.treasuredata.com/api/pools

Get a pool

curl -H 'Authorization: TD1 <api_key>' \
    https://api-workflow.treasuredata.com/api/pools/<pool_id>

Update a pool

curl -X PATCH \
    -H 'Authorization: TD1 <api_key>' \
    -H 'Content-Type: application/json' \
    -d '{"concurrencyLimit": 70}' \
    https://api-workflow.treasuredata.com/api/pools/<pool_id>

When you raise a pool's limit, the difference is taken from the default pool. When you lower a pool's limit, the difference is returned to the default pool.

Delete a pool

curl -X DELETE \
    -H 'Authorization: TD1 <api_key>' \
    https://api-workflow.treasuredata.com/api/pools/<pool_id>

A pool can be deleted only after every attempt assigned to it has finished and no pool rule references it.

Pool management actions are recorded as Premium Audit Log events. See Premium Audit Log Events for the event names and the operations they cover.

Next step

Once you have created at least one custom pool, write pool rules so that the right attempts are assigned to the right pool.