Collects the sub tasks that a map-reduce pipeline job splits its work into, built up by a script's map function. An instance of this class is passed as the subTaskList argument into a JS-exec map-reduce job's map function. The script calls one of the addXxxTask methods once per unit of work it wants processed, and the resulting MapReduceSubTask instances are then queued for the job's reduce phase to work through.


Methods

addTask(String title, Map<String,Serializable> props)

Returns: void

Adds a sub task carrying an arbitrary map of properties, as key value pairs, for the reduce phase to process.

ParameterDescription
titlea human-readable title identifying this sub task
propsthe properties this sub task carries through to the reduce phase

addSinglePropertyTask(String title, String propName, Serializable propValue)

Returns: void

Adds a sub task carrying a single named property for the reduce phase to process.

ParameterDescription
titlea human-readable title identifying this sub task
propNamethe name of the single property carried by this sub task
propValuethe value of the single property carried by this sub task

addRangeTask(String title, long start, long finish)

Returns: void

Adds a sub task carrying a numeric range, stored as "start" and "finish" properties, for the reduce phase to process - for example a batch covering IDs 0-99, then a second sub task covering 100-199.

ParameterDescription
titlea human-readable title identifying this sub task
startthe inclusive start of the range this sub task covers
finishthe inclusive end of the range this sub task covers

addIdsListTask(String title, ArrayList<Serializable> IDs)

Returns: void

Adds a sub task carrying a specific list of IDs, stored as a "listOfIds" property, for the reduce phase to process as a single batch.

ParameterDescription
titlea human-readable title identifying this sub task
IDsthe list of IDs this sub task should process

size()

Returns: int

The number of sub tasks added to this list so far.

To get full access to the Kademi Hub existing customers can login here, or new customers can register here.