Tinkex.TrainingClient.Polling (Tinkex v0.3.4)
View SourceFuture polling and result awaiting for TrainingClient.
This module handles:
- Awaiting forward/backward results from polling tasks
- Unlink tasks to prevent process coupling
- Safe await with error handling
- Response conversion to typed structs
Summary
Functions
Await forward-backward polling tasks and convert results to typed structs.
Await forward-only polling tasks and convert results to typed structs.
Await forward results specifically for custom loss computation.
Poll an unload future and await its result.
Build base poll options from state and user-provided options.
Build poll options with request type metadata.
Safely await a task with timeout and error handling.
Unlink a task to prevent process coupling.
Functions
@spec await_forward_backward_results([Task.t()], module()) :: {:ok, [Tinkex.Types.ForwardBackwardOutput.t()]} | {:error, Tinkex.Error.t()}
Await forward-backward polling tasks and convert results to typed structs.
Returns the results in order. If any task fails, remaining tasks are killed and an error is returned.
@spec await_forward_results([Task.t()], module()) :: {:ok, [Tinkex.Types.ForwardBackwardOutput.t()]} | {:error, Tinkex.Error.t()}
Await forward-only polling tasks and convert results to typed structs.
Similar to await_forward_backward_results but specifically for forward passes.
@spec await_forward_results_for_custom_loss([Task.t()], module()) :: {:ok, [Tinkex.Types.ForwardBackwardOutput.t()]} | {:error, Tinkex.Error.t()}
Await forward results specifically for custom loss computation.
Same as await_forward_results but with clearer naming for custom loss context.
@spec poll_and_await_unload(map(), map(), keyword()) :: {:ok, Tinkex.Types.UnloadModelResponse.t()} | {:error, Tinkex.Error.t()}
Poll an unload future and await its result.
Polls the future, unlinks the task, and converts the result to an UnloadModelResponse.
Build base poll options from state and user-provided options.
Build poll options with request type metadata.
@spec safe_await(module(), Task.t(), timeout()) :: {:ok, any()} | {:error, Tinkex.Error.t()}
Safely await a task with timeout and error handling.
Wraps Task.await with exception and exit handling to ensure errors are returned in a consistent format.
Unlink a task to prevent process coupling.
This allows the task to continue running even if the calling process terminates.