Written by Nikhil Jali on April 10, 2015.
The Worker Manager(WM) performs the task of managing an active worker pool, storing information regarding each worker and keeps track of remuneration. The WM is provided as a self-sufficient class with numerous methods that serve as APIs to the other modules in the project. For each worker, an instance of the worker class is instantiated. However, the interface is with the class itself thereby abstracting away the complexity of handling the low level information of each worker and the pool. The WM has the following functions:
Worker addition and login:
For new workers sign-ups, an object is created in a database. The workers can then be logged in upon which they are added onto an idle list and their profile is made online. Similarly, if the worker or WM chooses to logout the worker after task completion, remuneration is provided and the worker is made offline. These are provided as APIs to the TM and Authentication Manager(AM). Also upon login, socket objects corresponding to each worker are stored within the worker class instance.
Each worker's task completion history, remuneration and point system for how good a leafer, brancher or sapper is recorded. The worker profile is provided as a way of also motivating the worker with non-monetary incentives.
Active worker pool management:
Maintaining an active on-demand worker pool is key to being able to complete tasks quickly. This is achieved by keeping the worker's HIT page open and indicating task assignment through alerts in the title of the page. Also, the WM is able to calculate if more workers would be required and interfaces with the AM to put out HITs on Amazon Mechanical Turk(AMT) to add workers to the pool. Similarly, an excess work-force is reduced by remunerating workers on task completion and logging them out.
Worker assignment and task completion:
This is provided as an API to the TM where specific type of workers can be requested for by providing a Task Id. Upon selecting an active, idle and type of worker, the Worker Id is returned to the TM. At the same time, the Task Id is linked to the particular worker to keep track of what tasks are being assigned to each worker. Upon task completion, the Worker Id is returned to the idle pool waiting to be given additional tasks and the remuneration counter is updated. If the number of workers far exceed the number required to maintain a sufficient active pool, the excess workers upon task completion are remunerated and logged out of the system.