TTMapper
Mapping relates the graph of SQs to the physical system: SQs are assigned to ensembles and told where their outputs should be sent. Mapping is done after compilation and before graph interpretation/execution.
Mapping is done based for a known network of ensembles. There may be constraints on mapping from the graph itself, and it is the Mapper’s responsibility to satisfy these constraints. These constraints may restrict SQs to only run on specific Ensembles (or types of Ensembles) or may specify some multi-SQ constraints like an upper bound on latency.
Within the runtime environment, the mapping should be done using either a static system description or a runtime-generated description provided by the runtime manager (RTM). The RTM should handle mapping as part of the graph instantiation process before it kicks off interpretation by injecting initial input tokens.
- class ticktalkpython.Mapper.TTMapper(graph: TTGraph, ensembles=None)
The TTMapper handles mapping based on a system description (a set of ensembles) and a graph. The exact format of the system description is subject to change, and will likely become more complex as mapping algorithms become more sophisticated
- Parameters:
graph (TTGraph) – The compiled graph representing a TTPython program, which is ready to be mapped to the set of ensembles
ensembles (list(TTEnsembles)) – A set of ensembles composing the system; this is the system description
- static random_mapping(graph: TTGraph, ensembles: dict | list)
Produce a random mapping of the graph onto the ensembles
- Parameters:
graph (TTGraph) – The graph to map
ensembles (list(TTEnsemble) | dict) – The set of ensembles to map the graph onto; this is the system description
- static trivial_mapping(graph, ensemble)
Trivial mapping puts all SQs onto the same ensemble. It is the simplest form of mapping, and is useful for testing basic elements of the graph interpretation and/or code execution. Most of the work here is setting the arc destinations so that we know how to tag output tokens.
- Parameters:
graph (TTGraph) – The graph to map entirely onto a singular ensemble
ensemble (TTEnsemble) – The ensemble to map the entire graph onto
- Returns:
A dictionary using SQ names as keys and ensemble names as values, to represent which SQ the ensemble is mapped onto. This is used to instantiate all the SQs on their correponding ensemble. An SQ is uniquely named and uniquely mapped to one ensemble.
- Return type:
dict
- ticktalkpython.Mapper.assign_mapping(graph: TTGraph, mapping)
Updates the arcs in the given graph with the provided mapping
- Parameters:
graph (TTGraph) – The graph to map entirely onto a singular ensemble
mapping (TTEnsemble) – The ensemble to map the entire graph onto
- Returns:
list of TTArcDestinations
- Return type:
list
- ticktalkpython.Mapper.static_mapping(graph, ensemble_infos)
Given that the graph has SQs with annotated constraints (from TTQuery within the program), the mapping returned will ensure that mapped SQs have a corresponding compatible ensemble
- Parameters:
graph (TTGraph) – The graph to map entirely onto a singular ensemble
ensemble ([TTEnsembleInfo]) – The ensembles to map the entire graph onto
- Returns:
A dictionary using SQ names as keys and ensemble names as values, to represent which SQ the ensemble is mapped onto. This is used to instantiate all the SQs on their correponding ensemble. An SQ is uniquely named and uniquely mapped to one ensemble.
- Return type:
dict