def __init__(self, *args, **kwargs):
        super(OpRefactoredBlockedArrayCache, self).__init__(*args, **kwargs)

        # Input ---------> opCacheFixer -> opUnblockedArrayCache -> opSplitRequestsBlockwise -> Output
        #                 /                                        /
        # fixAtCurrent --                                         /
        #                                                        /
        # BlockShape --------------------------------------------

        self._opCacheFixer = OpCacheFixer(parent=self)
        self._opCacheFixer.Input.connect(self.Input)
        self._opCacheFixer.fixAtCurrent.connect(self.fixAtCurrent)

        self._opUnblockedArrayCache = OpUnblockedArrayCache(parent=self)
        self._opUnblockedArrayCache.Input.connect(self._opCacheFixer.Output)

        self._opSplitRequestsBlockwise = OpSplitRequestsBlockwise(
            always_request_full_blocks=True, parent=self)
        self._opSplitRequestsBlockwise.BlockShape.connect(self.outerBlockShape)
        self._opSplitRequestsBlockwise.Input.connect(
            self._opUnblockedArrayCache.Output)

        self.Output.connect(self._opSplitRequestsBlockwise.Output)

        # This member is used by tests that check RAM usage.
        self.setup_ram_context = RamMeasurementContext()
        self.registerWithMemoryManager()
Пример #2
0
    def __init__(self, *args, **kwargs):
        super( OpBlockedArrayCache, self ).__init__(*args, **kwargs)
        
        # SCHEMATIC WHEN BypassModeEnabled == False:
        # 
        # Input ---------> opCacheFixer -> opUnblockedArrayCache -> opSplitRequestsBlockwise -> (indirectly via execute) -> Output
        #                 /                                        /
        # fixAtCurrent --                                         /
        #                                                        /
        # BlockShape --------------------------------------------
        
        # SCHEMATIC WHEN BypassModeEnabled == True:
        #
        # Input --> (indirectly via execute) -> Output
        
        self._opCacheFixer = OpCacheFixer( parent=self )
        self._opCacheFixer.Input.connect( self.Input )
        self._opCacheFixer.fixAtCurrent.connect( self.fixAtCurrent )

        self._opUnblockedArrayCache = OpUnblockedArrayCache( parent=self )
        self._opUnblockedArrayCache.CompressionEnabled.connect( self.CompressionEnabled )
        self._opUnblockedArrayCache.Input.connect( self._opCacheFixer.Output )

        self._opSplitRequestsBlockwise = OpSplitRequestsBlockwise( always_request_full_blocks=True, parent=self )
        self._opSplitRequestsBlockwise.BlockShape.connect( self.outerBlockShape )
        self._opSplitRequestsBlockwise.Input.connect( self._opUnblockedArrayCache.Output )

        # Instead of connecting our Output directly to our internal pipeline,
        # We manually forward the data via the execute() function,
        #  which allows us to implement a bypass for the internal pipeline if Enabled
        #self.Output.connect( self._opSplitRequestsBlockwise.Output )

        # Since we didn't directly connect the pipeline to our output, explicitly forward dirty notifications 
        self._opSplitRequestsBlockwise.Output.notifyDirty( lambda slot, roi: self.Output.setDirty(roi.start, roi.stop) )

        # This member is used by tests that check RAM usage.
        self.setup_ram_context = RamMeasurementContext()
        self.registerWithMemoryManager()