dragon.ai.inference.reader_utils.ReadWorker
- class ReadWorker[source]
Bases:
objectRead raw inference responses from a queue for simple drivers.
ReadWorkerpolls a response queue until the expected number of prompt responses has been observed. It annotates each response with a monotonically increasingcounterfield and sets the supplied end event when reading is complete or when the user interrupts the process.- __init__(q, end_ev)[source]
Initialize a response reader.
- Parameters:
q (dragon.native.Queue) – Queue from which response dictionaries are read.
end_ev (dragon.native.Event) – Event set when reading completes or is interrupted.
Methods
__init__(q, end_ev)Initialize a response reader.
read(num_prompts)Return responses to the prompter until all prompts are read.
- __init__(q, end_ev)[source]
Initialize a response reader.
- Parameters:
q (dragon.native.Queue) – Queue from which response dictionaries are read.
end_ev (dragon.native.Event) – Event set when reading completes or is interrupted.
- read(num_prompts)[source]
Return responses to the prompter until all prompts are read.
The worker sits inside a loop and continuously reads from a response queue. It exits when the expected number of prompts has been read and the end event is set.
- Parameters:
num_prompts (int ) – Number of expected input prompts to read.