mirror of
https://github.com/lancedb/lancedb.git
synced 2026-11-26 20:44:00 +00:00
feat: profile Enterprise Function workers from official clients
This commit is contained in:
@@ -247,6 +247,43 @@ Request cancellation. Cancelling a finished operation is a no-op.
|
||||
|
||||
***
|
||||
|
||||
### captureProfile()
|
||||
|
||||
```ts
|
||||
captureProfile(workerId, options): Promise<FunctionProfile>
|
||||
```
|
||||
|
||||
Request a profile of a running Enterprise Function worker session.
|
||||
Returns the accepted identity without waiting for recording to finish.
|
||||
Requires System Operate permission and server profiling support. The server
|
||||
pins the worker, Python session and execution epoch. One capture per job
|
||||
can be active. Captures add workload-dependent overhead.
|
||||
|
||||
GPU tracing requires initialized PyTorch CUDA/CUPTI. CPU sampling requires
|
||||
readable per-thread procfs and is unavailable in dedicated sandboxes.
|
||||
|
||||
#### Parameters
|
||||
|
||||
* **workerId**: `string`
|
||||
|
||||
* **options**: [`FunctionProfileOptions`](../interfaces/FunctionProfileOptions.md) = `{}`
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<[`FunctionProfile`](../interfaces/FunctionProfile.md)>
|
||||
|
||||
#### Example
|
||||
|
||||
```ts
|
||||
const profile = await job.captureProfile("worker-id", {
|
||||
kind: "gpu", durationSeconds: 2,
|
||||
});
|
||||
await job.waitForProfile(profile.profileId, { timeoutMs: 60_000 });
|
||||
await job.exportProfile(profile.profileId, "gpu.trace.json");
|
||||
```
|
||||
|
||||
***
|
||||
|
||||
### events()
|
||||
|
||||
```ts
|
||||
@@ -276,6 +313,29 @@ per fragment. `filter` is a SQL-like expression over the `state`,
|
||||
|
||||
***
|
||||
|
||||
### exportProfile()
|
||||
|
||||
```ts
|
||||
exportProfile(profileId, path): Promise<void>
|
||||
```
|
||||
|
||||
Write a completed capture's JSON after successful retrieval. Open CPU
|
||||
exports in speedscope and GPU exports in Perfetto. GPU activity durations
|
||||
can overlap and are not utilization; Python operator attribution and GPU
|
||||
allocation stacks are excluded. Filesystem errors propagate to the caller.
|
||||
|
||||
#### Parameters
|
||||
|
||||
* **profileId**: `string`
|
||||
|
||||
* **path**: `string`
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`void`>
|
||||
|
||||
***
|
||||
|
||||
### history()
|
||||
|
||||
```ts
|
||||
@@ -294,6 +354,48 @@ Walk retained history one page at a time using the server's continuation.
|
||||
|
||||
***
|
||||
|
||||
### profileArtifact()
|
||||
|
||||
```ts
|
||||
profileArtifact(profileId): Promise<Record<string, unknown>>
|
||||
```
|
||||
|
||||
Retrieve a completed capture's actual JSON: speedscope for CPU,
|
||||
tracemalloc for Python allocations, or Chrome Trace Event JSON for GPU.
|
||||
Truncation flags are preserved. Retention is at most one hour and eight
|
||||
captures per job, until earlier scratch reclamation or archival.
|
||||
Permission, expired-artifact and unsupported-server errors propagate.
|
||||
|
||||
#### Parameters
|
||||
|
||||
* **profileId**: `string`
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`Record`<`string`, `unknown`>>
|
||||
|
||||
***
|
||||
|
||||
### profileStatus()
|
||||
|
||||
```ts
|
||||
profileStatus(profileId): Promise<FunctionProfile>
|
||||
```
|
||||
|
||||
Fetch capture identity and status, including retained lookup after refresh.
|
||||
Failed captures return status "failed" with the server's error reason.
|
||||
This never changes the parent job's cached state.
|
||||
|
||||
#### Parameters
|
||||
|
||||
* **profileId**: `string`
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<[`FunctionProfile`](../interfaces/FunctionProfile.md)>
|
||||
|
||||
***
|
||||
|
||||
### progress()
|
||||
|
||||
```ts
|
||||
@@ -422,3 +524,26 @@ can also be reopened with `Connection.openJob`; query IDs cannot.
|
||||
```ts
|
||||
const result = await job.wait({ timeoutMs: 60_000, onProgress: console.log });
|
||||
```
|
||||
|
||||
***
|
||||
|
||||
### waitForProfile()
|
||||
|
||||
```ts
|
||||
waitForProfile(profileId, options): Promise<FunctionProfile>
|
||||
```
|
||||
|
||||
Wait for a capture with a configurable timeout and polling cadence.
|
||||
Defaults to 60 seconds with two seconds between requests. A timeout stops
|
||||
only this wait; the capture and Function refresh continue. A failed capture
|
||||
rejects with its server-reported reason. Keep its ID to wait again.
|
||||
|
||||
#### Parameters
|
||||
|
||||
* **profileId**: `string`
|
||||
|
||||
* **options**: [`FunctionProfileWaitOptions`](../interfaces/FunctionProfileWaitOptions.md) = `{}`
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<[`FunctionProfile`](../interfaces/FunctionProfile.md)>
|
||||
|
||||
@@ -109,6 +109,9 @@
|
||||
- [FunctionErrorRecord](interfaces/FunctionErrorRecord.md)
|
||||
- [FunctionErrors](interfaces/FunctionErrors.md)
|
||||
- [FunctionErrorsOptions](interfaces/FunctionErrorsOptions.md)
|
||||
- [FunctionProfile](interfaces/FunctionProfile.md)
|
||||
- [FunctionProfileOptions](interfaces/FunctionProfileOptions.md)
|
||||
- [FunctionProfileWaitOptions](interfaces/FunctionProfileWaitOptions.md)
|
||||
- [FunctionRefreshPlanningConfig](interfaces/FunctionRefreshPlanningConfig.md)
|
||||
- [FunctionRefreshPodResources](interfaces/FunctionRefreshPodResources.md)
|
||||
- [FunctionRetryPolicy](interfaces/FunctionRetryPolicy.md)
|
||||
@@ -195,6 +198,8 @@
|
||||
- [DeltaVersion](type-aliases/DeltaVersion.md)
|
||||
- [ExprLike](type-aliases/ExprLike.md)
|
||||
- [FieldLike](type-aliases/FieldLike.md)
|
||||
- [FunctionProfileKind](type-aliases/FunctionProfileKind.md)
|
||||
- [FunctionProfileStatus](type-aliases/FunctionProfileStatus.md)
|
||||
- [IntoSql](type-aliases/IntoSql.md)
|
||||
- [IntoVector](type-aliases/IntoVector.md)
|
||||
- [JobProgressCallback](type-aliases/JobProgressCallback.md)
|
||||
|
||||
@@ -0,0 +1,126 @@
|
||||
[**@lancedb/lancedb**](../README.md) • **Docs**
|
||||
|
||||
***
|
||||
|
||||
[@lancedb/lancedb](../globals.md) / FunctionProfile
|
||||
|
||||
# Interface: FunctionProfile
|
||||
|
||||
A capture identity and status snapshot. Keep profileId for retained lookup
|
||||
after the Function refresh completes. Timestamp fields are epoch milliseconds.
|
||||
|
||||
## Properties
|
||||
|
||||
### artifactId
|
||||
|
||||
```ts
|
||||
readonly artifactId: null | string;
|
||||
```
|
||||
|
||||
***
|
||||
|
||||
### completedAtMillis
|
||||
|
||||
```ts
|
||||
readonly completedAtMillis: null | number;
|
||||
```
|
||||
|
||||
***
|
||||
|
||||
### deadlineAtMillis
|
||||
|
||||
```ts
|
||||
readonly deadlineAtMillis: number;
|
||||
```
|
||||
|
||||
***
|
||||
|
||||
### durationSeconds
|
||||
|
||||
```ts
|
||||
readonly durationSeconds: number;
|
||||
```
|
||||
|
||||
***
|
||||
|
||||
### error
|
||||
|
||||
```ts
|
||||
readonly error: null | string;
|
||||
```
|
||||
|
||||
The server's capture failure reason; this is not a refresh job failure.
|
||||
|
||||
***
|
||||
|
||||
### executionEpoch
|
||||
|
||||
```ts
|
||||
readonly executionEpoch: number;
|
||||
```
|
||||
|
||||
***
|
||||
|
||||
### expiresAtMillis
|
||||
|
||||
```ts
|
||||
readonly expiresAtMillis: number;
|
||||
```
|
||||
|
||||
Upper retention bound; job scratch reclamation can remove artifacts sooner.
|
||||
|
||||
***
|
||||
|
||||
### jobId
|
||||
|
||||
```ts
|
||||
readonly jobId: string;
|
||||
```
|
||||
|
||||
***
|
||||
|
||||
### kind
|
||||
|
||||
```ts
|
||||
readonly kind: FunctionProfileKind;
|
||||
```
|
||||
|
||||
***
|
||||
|
||||
### profileId
|
||||
|
||||
```ts
|
||||
readonly profileId: string;
|
||||
```
|
||||
|
||||
***
|
||||
|
||||
### requestedAtMillis
|
||||
|
||||
```ts
|
||||
readonly requestedAtMillis: number;
|
||||
```
|
||||
|
||||
***
|
||||
|
||||
### sessionSlot
|
||||
|
||||
```ts
|
||||
readonly sessionSlot: number;
|
||||
```
|
||||
|
||||
***
|
||||
|
||||
### status
|
||||
|
||||
```ts
|
||||
readonly status: FunctionProfileStatus;
|
||||
```
|
||||
|
||||
***
|
||||
|
||||
### workerId
|
||||
|
||||
```ts
|
||||
readonly workerId: string;
|
||||
```
|
||||
@@ -0,0 +1,39 @@
|
||||
[**@lancedb/lancedb**](../README.md) • **Docs**
|
||||
|
||||
***
|
||||
|
||||
[@lancedb/lancedb](../globals.md) / FunctionProfileOptions
|
||||
|
||||
# Interface: FunctionProfileOptions
|
||||
|
||||
Options for requesting a Function worker capture.
|
||||
|
||||
## Properties
|
||||
|
||||
### durationSeconds?
|
||||
|
||||
```ts
|
||||
optional durationSeconds: number;
|
||||
```
|
||||
|
||||
1–30 seconds for CPU/memory, default 10; 1–5 for GPU, default 5.
|
||||
|
||||
***
|
||||
|
||||
### kind?
|
||||
|
||||
```ts
|
||||
optional kind: FunctionProfileKind;
|
||||
```
|
||||
|
||||
CPU samples, retained Python allocations, or PyTorch CUDA activities.
|
||||
|
||||
***
|
||||
|
||||
### sessionSlot?
|
||||
|
||||
```ts
|
||||
optional sessionSlot: number;
|
||||
```
|
||||
|
||||
Python execution session within the worker; default zero.
|
||||
@@ -0,0 +1,29 @@
|
||||
[**@lancedb/lancedb**](../README.md) • **Docs**
|
||||
|
||||
***
|
||||
|
||||
[@lancedb/lancedb](../globals.md) / FunctionProfileWaitOptions
|
||||
|
||||
# Interface: FunctionProfileWaitOptions
|
||||
|
||||
Client-side controls while waiting for a Function worker capture.
|
||||
|
||||
## Properties
|
||||
|
||||
### pollIntervalMs?
|
||||
|
||||
```ts
|
||||
optional pollIntervalMs: number;
|
||||
```
|
||||
|
||||
Delay between status requests; defaults to 2,000 ms and must be positive.
|
||||
|
||||
***
|
||||
|
||||
### timeoutMs?
|
||||
|
||||
```ts
|
||||
optional timeoutMs: number;
|
||||
```
|
||||
|
||||
Maximum wait including HTTP requests and sleeps; defaults to 60,000 ms.
|
||||
@@ -0,0 +1,13 @@
|
||||
[**@lancedb/lancedb**](../README.md) • **Docs**
|
||||
|
||||
***
|
||||
|
||||
[@lancedb/lancedb](../globals.md) / FunctionProfileKind
|
||||
|
||||
# Type Alias: FunctionProfileKind
|
||||
|
||||
```ts
|
||||
type FunctionProfileKind: "cpu" | "gpu" | "memory";
|
||||
```
|
||||
|
||||
Evidence collected from one Function worker's Python execution session.
|
||||
@@ -0,0 +1,13 @@
|
||||
[**@lancedb/lancedb**](../README.md) • **Docs**
|
||||
|
||||
***
|
||||
|
||||
[@lancedb/lancedb](../globals.md) / FunctionProfileStatus
|
||||
|
||||
# Type Alias: FunctionProfileStatus
|
||||
|
||||
```ts
|
||||
type FunctionProfileStatus: "pending" | "capturing" | "complete" | "failed";
|
||||
```
|
||||
|
||||
A capture's lifecycle, independent of its parent refresh job.
|
||||
@@ -755,6 +755,12 @@ with BlobReader(read_range, len(payload)) as reader:
|
||||
|
||||
::: lancedb.job.JobFailureInfo
|
||||
|
||||
::: lancedb.profiling.FunctionProfile
|
||||
|
||||
::: lancedb.profiling.FunctionProfileKind
|
||||
|
||||
::: lancedb.profiling.FunctionProfileStatus
|
||||
|
||||
::: lancedb.sql.Query
|
||||
|
||||
::: lancedb.sql.AsyncQuery
|
||||
|
||||
Reference in New Issue
Block a user