Anvil.Assignment (Anvil v0.1.1)
View SourceRepresents a labeling task assigned to a specific labeler.
Tracks the lifecycle of an assignment from creation through completion, expiration, or skipping.
Summary
Functions
Completes an assignment with a label ID.
Expires an assignment that has passed its deadline.
Returns the labeling time in seconds, or nil if not completed.
Creates a new pending assignment.
Checks if the assignment is past its deadline.
Skips an assignment with an optional reason.
Starts an assignment, transitioning from :pending to :in_progress.
Types
@type status() :: :pending | :in_progress | :completed | :expired | :skipped
@type t() :: %Anvil.Assignment{ attempts: non_neg_integer(), completed_at: DateTime.t() | nil, created_at: DateTime.t(), deadline: DateTime.t() | nil, expired_at: DateTime.t() | nil, id: String.t(), label_id: String.t() | nil, labeler_id: String.t(), queue_id: String.t(), sample_id: String.t(), skip_reason: String.t() | nil, skipped_at: DateTime.t() | nil, started_at: DateTime.t() | nil, status: status() }
Functions
Completes an assignment with a label ID.
Expires an assignment that has passed its deadline.
@spec labeling_time_seconds(t()) :: non_neg_integer() | nil
Returns the labeling time in seconds, or nil if not completed.
Creates a new pending assignment.
Checks if the assignment is past its deadline.
Skips an assignment with an optional reason.
@spec start(t(), pos_integer()) :: {:ok, t()} | {:error, term()}
Starts an assignment, transitioning from :pending to :in_progress.