Anvil.Queue (Anvil v0.1.1)

View Source

GenServer that manages a labeling queue.

Handles sample assignment, label submission, and queue state management.

Summary

Functions

Adds labelers to the queue.

Adds samples to the queue.

Returns a specification to start this module under a supervisor.

Gets all assignments for the queue.

Gets all labels for the queue.

Gets the next assignment for a labeler.

Starts a queue process.

Submits a label for an assignment.

Functions

add_labelers(queue, labelers)

@spec add_labelers(pid() | atom(), [String.t()]) :: :ok

Adds labelers to the queue.

add_samples(queue, samples)

@spec add_samples(pid() | atom(), [map()]) :: :ok | {:error, term()}

Adds samples to the queue.

child_spec(init_arg)

Returns a specification to start this module under a supervisor.

See Supervisor.

get_assignments(queue, filters \\ [])

@spec get_assignments(
  pid() | atom(),
  keyword()
) :: [Anvil.Assignment.t()]

Gets all assignments for the queue.

get_labels(queue, filters \\ [])

@spec get_labels(
  pid() | atom(),
  keyword()
) :: [Anvil.Label.t()]

Gets all labels for the queue.

get_next_assignment(queue, labeler_id)

@spec get_next_assignment(pid() | atom(), String.t()) ::
  {:ok, Anvil.Assignment.t()} | {:error, term()}

Gets the next assignment for a labeler.

skip_assignment(queue, assignment_id, opts \\ [])

@spec skip_assignment(pid() | atom(), String.t(), keyword()) ::
  {:ok, Anvil.Assignment.t()} | {:error, term()}

Skips an assignment.

start_assignment(queue, assignment_id)

@spec start_assignment(pid() | atom(), String.t()) ::
  {:ok, Anvil.Assignment.t()} | {:error, term()}

Starts an assignment.

start_link(opts)

@spec start_link(keyword()) :: GenServer.on_start()

Starts a queue process.

submit_label(queue, assignment_id, values)

@spec submit_label(pid() | atom(), String.t(), map()) ::
  {:ok, Anvil.Label.t()} | {:error, term()}

Submits a label for an assignment.