Processor¶
- class lsst.daf.relation.Processor¶
- Bases: - ABC- An inheritable framework for processing multi-engine relation trees. - Individual - Engineclasses have different definitions of what it means to process a relation tree, and no single engine can handle a tree with engines. This class provides a recursive algorithm that fills that role, with abstract method hooks for implementing- Transferand- Materializeoperations.- Notes - The - Processoralgorithm walks the tree recursively until it either finds:- a - Relationwith a- Relation.payloadthat is not- None, which is returned as-is;
- a - Materializationoperation, for which a payload is computed via a call to the- materializehook, and then attached to both the original relation (modifying it in-place) and the returned one;
- a - Transferoperation, for which a payload is computed via a call to the- transferhook, and then the attached to the returned relation only.
 - In addition, - Processornever calls either hook on- trivialmethods -- Engine.get_join_identity_payloadand- Engine.get_doomed_payloadare called instead. This can (for example) avoid executing asking a database to execute a SQL query when the relation tree knows in advance the result will have no real content. It also special-cases- Transferoperations that are followed immediately by a- Materialization, allowing both operations to be handled by a single call.- Methods Summary - materialize(target, name)- Hook for implementing materialization operations. - process(relation)- Main entry point for processing a relation tree. - transfer(source, destination, materialize_as)- Hook for implementing transfers between engines. - Methods Documentation - abstract materialize(target: Relation, name: str) Any¶
- Hook for implementing materialization operations. - This method should be called only by the - Processorbase class.- Parameters:
- targetRelation
- Relation to be materialized. Any upstream - Transferoperations in this tree are guaranteed to already have a- payloadalready attached (or some intervening relation does), so the relation’s own engine should be capable of processing it on its own.
- namestr
- The name of the - Materializationoperation, to be used as needed in the engine-specific payload.
 
- target
- Returns:
- payload
- Payload for this relation that should be cached. 
 
 
 - process(relation: Relation) Relation¶
- Main entry point for processing a relation tree. - Parameters:
- relationRelation
- Root of the relation tree to process. On return, relations that hold a - Materializationrelation will have a new- payloadattached, if they did not have one already.
 
- relation
- Returns:
 
 - abstract transfer(source: Relation, destination: Engine, materialize_as: str | None) Any¶
- Hook for implementing transfers between engines. - This method should be called only by the - Processorbase class.- Parameters:
- sourceRelation
- Relation to be transferred. Any upstream - Transferoperations in this tree are guaranteed to already have a- payloadalready attached (or some intervening relation does), so the relation’s own engine should be capable of processing it on its own.
- destinationEngine
- Engine the relation is being transferred to. 
- materialize_asstrorNone
- If not - None, the name of a- Materializationoperation that immediately follows the transfer being implemented, in which case the returned- payloadshould be appropriate for caching with the- Materialization.
 
- source
- Returns:
- payload
- Payload for this relation in the - destinationengine.