@pbroom/color-kit/computeScheduling

createPlaneComputeScheduler

Creates a plane compute scheduler that runs requests on the JS backend and records per-workload timing telemetry (EWMA of total time, bucketed by query kinds, workload signature, priority, quality, profile, and estimated budget).

functionimport { createPlaneComputeScheduler } from '@pbroom/color-kit/compute';scheduler.ts:166
function createPlaneComputeScheduler(
  config?: { backends?: Partial<Record<'js', PlaneComputeBackend>>; options?: PlaneComputeSchedulerOptions },
): PlaneComputeScheduler;

Telemetry is in-memory and per scheduler; when maxTelemetryBuckets is reached the least recently used bucket is evicted. Responses gain schedule, and traced responses get bucketKey / scheduleReason in each trace summary.

Parameters

config?{ backends?: Partial<Record<'js', PlaneComputeBackend>>; options?: PlaneComputeSchedulerOptions }default {}
Optional backends and telemetry options.
config.backends?Partial<Record<'js', PlaneComputeBackend>>
Backends by kind. Only js is used; defaults to a new createJsPlaneComputeBackend instance.

Returns

PlaneComputeSchedulerA PlaneComputeScheduler.

Example

TypeScript
import { createPlaneComputeScheduler } from '@pbroom/color-kit/compute';

const scheduler = createPlaneComputeScheduler({ options: { maxTelemetryBuckets: 16 } });
const response = scheduler.run({
  plane: { model: 'oklch', fixed: { h: 250 } },
  queries: [{ kind: 'gamutRegion', gamut: 'srgb' }],
  priority: 'drag',
});

response.result.queryDescriptors.map((d) => d.kind); // → ['gamutRegion']
scheduler.getTelemetrySnapshot().buckets.length; // → 1

See also