[This is preliminary documentation and is subject to change.]
A coordinator that assigns work items to zero or more matching workers. When a worker is free, it is assigned a matching item if
there is one, otherwise it is assigned an item that matched to no workers if there is one, otherwise it is assigned an item from
a worker that has the maximal number of remaining unassigned items.
Inheritance Hierarchy
Microsoft.Research.Naiad.Frameworks.WorkGeneratorMatchingCoordinatorTInput, TCategory, TWorkStub, TWorkDescription, TWorkerDescription
Microsoft.Research.Naiad.Frameworks.Storage.DfsDfsBaseCoordinatorTWorkDescription
Namespace: Microsoft.Research.Naiad.Frameworks.WorkGenerator
Assembly: Microsoft.Research.Naiad.WorkGenerator (in Microsoft.Research.Naiad.WorkGenerator.dll) Version: 0.5.0.0 (0.5.0.0)
Syntax
C#
public abstract class MatchingCoordinator<TInput, TCategory, TWorkStub, TWorkDescription, TWorkerDescription> : ICoordinator<TInput, TWorkDescription, TWorkerDescription>
Type Parameters
- TInput
- Type of an input record: each input expands to some number of work items
- TCategory
- Type of a work item category
- TWorkStub
- Type of a work item stub, expanded to a work item once the worker is chosen
- TWorkDescription
- Type of a work item description
- TWorkerDescription
- Type of a worker description: this is translated to a TQueueKey to find a match
The MatchingCoordinatorTInput, TCategory, TWorkStub, TWorkDescription, TWorkerDescription type exposes the following members.
Constructors
Name | Description | |
---|---|---|
MatchingCoordinatorTInput, TCategory, TWorkStub, TWorkDescription, TWorkerDescription |
Create a new MatchingCoordinator
|
Methods
Name | Description | |
---|---|---|
AddInput |
Implements ICoordinator.AddInput. Takes an input record and calls the user-supplied function provided in
the constructor, to translate the input into a set of work items, each of which is annotated with a list
of zero or more categories. As workers become ready, their work will be assigned from these items.
| |
AssignWork |
Implements ICoordinator.AssignWork. Given a worker that is now free, assign it a work item if any remain.
If there is an item matching the worker it will be returned; otherwise if there is an item that wasn't matched
to any worker it will be returned; otherwise an item from another category's queue that has a maximal number of
pending items will be returned. If there are no items remaining to be assigned, this returns false.
| |
EnumerateWork |
Given an input item, return a list of work items, each with a list of categories
| |
ExpandWorkItem |
Convert a work item stub to a work item once it is known which category, if any, it was matched to
| |
MapWorkerToQueue |
Given a worker, return a matching queue from this.waitingWork (and fill in its key to categoryKey)
or null if there is no matching queue
| |
NotifyQueueAddition |
called whenever a new worker queue is added
| |
NotifyQueueRemoval |
called whenever an existing worker queue becomes empty and is deleted
|
Fields
Name | Description | |
---|---|---|
waitingWork |
For each category with outstanding work, a queue of unused matches. There is an invariant that every value in
this dictionary has Count greater than 0
|
See Also