Function: toContext()
Call Signature
Section titled “Call Signature”toContext(
input):Context
Wrap a Context (returned as-is) or AbortSignal (adapted) as an SDK Context.
Parameters
Section titled “Parameters”Returns
Section titled “Returns”Context
Example
Section titled “Example”import { databricks } from "@dbx-tools/appkit";import { getWorkspaceClient } from "@databricks/appkit";
await getWorkspaceClient({}).apiClient.request( { path: "/api/2.0/serving-endpoints", method: "GET", headers: new Headers(), raw: false }, databricks.toContext(request.signal),);Call Signature
Section titled “Call Signature”toContext(
controller,input?):Context
Derive an SDK Context from controller.signal, optionally tying input
into the controller so the controller becomes the single cancellation
source for downstream SDK calls:
AbortSignal: aborting it propagates intocontroller(and from there into every SDK call you pass the returned context to).Context: itscancellationTokenis tied intocontroller, and its other fields (logger,opName,rootClassName,rootFnName,opId) are preserved in the returnedContext. The returned context’scancellationTokenis replaced with one backed bycontroller.signal.
The tie is one-way (parent -> child): aborting controller directly does
NOT cancel input. So a request-level cancel (your loop’s try/finally { controller.abort() }) won’t tear down a caller-supplied AbortSignal it
didn’t own.
Parameters
Section titled “Parameters”controller
Section titled “controller”AbortController
input?
Section titled “input?”Returns
Section titled “Returns”Context