-
Notifications
You must be signed in to change notification settings - Fork 6
Retainer api discussion
his is a discussion of the desired interface between the Retainer (a.k.a.: LegionJS) and clients - for which we'll be using Scribe as a first example.
From a high-level point of view, these are the required functions:
- client -> Retainer: "I Request N workers"
- Retainer -> client: "There are m of N workers ready"
- Retainer -> client: "Here go your N workers"
- client -> Retainer: "I need D workers more"
- NEW: client -> Retainer: "Please use this video/instructions/pre-task if you can while you have workers sitting in the wait room" --> Before waiting, the task/video is watched, then workers are forwarded to the waiting page (and marked as 'callable'). The waiting page itself has the text instructions and a note that workers can do other tasks / visit other sites while waiting (making people more willing to wait with low pay).
prepare(int numFire, String task) // Tell the retainer you will need N people (soon). Use with negative number to retract a call (i.e. early termination).
call(int numFire, String fireToURL, String task) // Tell the retainer to forward N workers immediately (or as soon as possible)
query_available(String task) // Ask the retainer how many workers are currently available (might not be true on call)
Others: we could include support for some kind of "preserve()" call that tells the system not to give away N workers because you're already prepping for their immediate use. Helps avoid race conditions where 2 clients see the same N workers as ready to be called. Alternatively, we could add an optional priority parameter to the calls.
What can be done and how?
A simple and clean way to implement this is through an interface singleton object. This would allow the Retainer to expose the procedures to be called by the client systems as methods and keep common in-memory state. Keeping the object accessible through a well-known file that can be requireed would allow to configure client systems, e.g. by adding the well-known path to scribe.ini.