Fit Handle
Live reference to a fitting job submitted through a DistributionModelingSession, parallel to ksl.app.session.RunHandle.
The job runs asynchronously on a background coroutine; observe events for lifecycle progress and await result for the terminal outcome. result.await() never throws — it resolves to a FitResult variant for every outcome including cancellation and failure.
Properties
Hot SharedFlow of lifecycle events. Replays a bounded recent history, so a subscriber that attaches shortly after submit returns can initialise its UI without missing the start event on very fast fits. The flow is never closed; it simply stops emitting after the terminal event (FitCompleted, FitFailed, or FitCancelled).
Functions
Synchronously waits for result and returns it via runBlocking. Do not call from inside a coroutine running on the session's own scope, or from a UI thread — those callers should observe result asynchronously instead.
Requests cooperative cancellation. The public lifecycle resolves immediately with a Cancelled result and FitCancelled event as soon as this handle wins the terminal state; the worker is then cancelled. Calling cancel more than once or after the fit has already ended is safe and has no effect.