Enclave placement and routing¶
A workload runs on an Enclave only when its runtime settings request Enclave placement, and a Use Case governs which Enclaves the workload can use:
- An organization administrator links one or more Enclaves to a Use Case.
- A workload builder names that Use Case when creating the workload.
- The workload's runtime settings set
runtime.enclaveSelectionPolicy, which decides whether the workload goes to an Enclave and to which one.
Before a Use Case can govern placement, the Enclave must be registered, installed, and ACTIVE, and Enclaves must be turned on for the organization. Turning on Enclaves takes both the ENABLE_COMPUTE_ENCLAVE value on the Hub and the ENABLE_COMPUTE_ENCLAVE entitlement on the organization.
The examples on this page use curl, with DATAROBOT_ENDPOINT and DATAROBOT_API_TOKEN exported, or the DataRobot CLI, with DATAROBOT_CLI_FEATURE_ENCLAVE=true exported.
Link a Use Case to an Enclave¶
An organization administrator links an Enclave to a Use Case through the REST API. To let the scheduler choose among several Enclaves, link them all to the same Use Case. To link one Enclave, send the following request:
curl -s -X POST "${DATAROBOT_ENDPOINT}/useCases/${USE_CASE_ID}/enclaves/${ENCLAVE_ID}/" \
-H "Authorization: Bearer ${DATAROBOT_API_TOKEN}"
To remove a link, send the same request with DELETE. The removal applies the next time an affected workload is rescheduled, such as on a restart or replacement. Running workloads keep serving.
Choose a selection policy¶
The runtime.enclaveSelectionPolicy setting is part of the runtime settings of a workload. The following table shows where a workload runs for each value.
| Value | Where the workload runs |
|---|---|
| Unset (the default) | On the Control Hub, outside any Enclave. |
"availability" |
On any eligible Enclave linked to the Use Case of the workload. The scheduler picks one. |
"manual" |
On the one Enclave named in runtime.enclaves. See Pin a workload to one Enclave. |
Placement is never silent in either direction. If the Use Case has Enclaves linked and the policy is unset, the request is refused rather than placed on the Hub. If the policy asks for an Enclave and none is eligible, the workload doesn't fall back to the Hub.
How the scheduler chooses an Enclave¶
With "availability", an Enclave linked to the Use Case is eligible when:
- It is
ACTIVE. - The caller has deploy access to it.
- It has a compute queue for the resource bundle of the workload.
Grant deploy access¶
Deploy access is granted per Enclave, with one of three roles:
| Role | Grants |
|---|---|
owner |
Full control, including sharing the Enclave. |
user |
View and deploy. The minimum role that can deploy. |
consumer |
View only. |
The user who registers an Enclave is its owner. System administrators can always deploy. To grant a role, send the following request or run the following command:
curl -s -X PATCH "${DATAROBOT_ENDPOINT}/enclaves/${ENCLAVE_ID}/sharedRoles" \
-H "Authorization: Bearer ${DATAROBOT_API_TOKEN}" \
-H "Content-Type: application/json" \
-d '{"operation": "updateRoles", "roles": [{"shareRecipientType": "user", "username": "user@example.com", "role": "USER"}]}'
shareRecipientType can be user, group, or organization. To remove access, set role to NO_ROLE.
dr enclave access grant "$ENCLAVE_ID" --role user --user user@example.com
To grant a group or an organization, use --group or --org. To see who holds a role, run dr enclave access list "$ENCLAVE_ID".
An Enclave belongs to the organization of the user who registered it. By default, an organization restricts sharing to its own members, so grants outside it are refused. Plan one Enclave per organization or have an organization administrator clear Restrict sharing to organization members to share across organizations.
Pin a workload to one Enclave¶
A pin overrides the scheduler. The workload sets runtime.enclaveSelectionPolicy: "manual" and names one Enclave in runtime.enclaves. Pinning is intended for testing and debugging, so it requires a separate pin permission. A pin succeeds only when the caller holds the pin permission, the Enclave is linked to the Use Case of the workload, the caller has deploy access to the Enclave, and the Enclave offers the resource bundle of the workload.
Pinning also requires Enclave role-based access control (RBAC), turned on with ENCLAVE_RBAC_ENABLED=true. Without Enclave RBAC, pin grants succeed but have no effect, and every pin is refused with PLACEMENT_OVERRIDE_NOT_ALLOWED.
System administrators can grant the pin permission to any user or group; organization administrators can grant it within their own organization. To grant the pin permission, send the following request or run the following command:
curl -s -X PATCH "${DATAROBOT_ENDPOINT}/enclaves/access" \
-H "Authorization: Bearer ${DATAROBOT_API_TOKEN}" \
-H "Content-Type: application/json" \
-d '{"permission": "pin", "operation": "grant", "shareRecipientType": "user", "id": "<user-id>"}'
For a group, set shareRecipientType to group. To revoke, set operation to revoke.
dr enclave permission grant --permission pin --user-id <user-id>
For a group, use --group <group-id>. To revoke, use dr enclave permission revoke.
Revoking the permission affects new pins only; already-pinned workloads stay on their Enclave.
How requests reach a workload¶
After a workload is placed, the Control Hub and the Enclave split the work as follows:
| Path | Handled by |
|---|---|
| Create, update, replace, stop | The Hub, which dispatches the workload to the chosen Enclave. |
| Inference requests | The Enclave. The workload endpoint is on the Enclave domain, and served traffic stays in the Enclave. |
| Authentication of inference requests | The Enclave gateway, which checks each caller with the Hub and caches the result. |
| Status, logs, metrics, and traces | Sent from the Enclave to the Hub, so the workload appears in the Hub like any other workload. |
Because served traffic stays in the Enclave, a Control Hub outage pauses new workloads and changes but doesn't stop running workloads from serving known callers.
Placement errors¶
Placement rejections carry a code, which the CLI prints in parentheses after the message. The following table lists each code, what it means, and how to fix it.
| Code | Meaning and fix |
|---|---|
MISSING_USE_CASE |
The workload has no Use Case. Set useCaseId (CLI: --use-case-id). |
ENCLAVE_TARGETING_REQUIRED |
The Use Case has Enclaves linked, but runtime.enclaveSelectionPolicy is unset. Set the policy. |
NO_ELIGIBLE_ENCLAVE |
The Use Case has no Enclaves linked. Link one. |
ENCLAVE_NOT_IN_USE_CASE |
The pinned Enclave isn't linked to the Use Case of the workload. |
PLACEMENT_OVERRIDE_NOT_ALLOWED |
The caller pinned without the pin permission. |
ENCLAVES_UNAVAILABLE |
ENABLE_COMPUTE_ENCLAVE isn't set on the Hub, the organization lacks the ENABLE_COMPUTE_ENCLAVE entitlement, or the Hub value workload-api.drApi.enabled is off. |
A resource-bundle mismatch is reported as no ACTIVE enclave queue matches the requested resource bundle. To fix the mismatch, see Define resource bundles and queues.