merge_machine/abstract_data_project.py
def _write_log_buffer(self, written):
        '''
        Appends log buffer to metadata, writes metadata and clears log_buffer.
        
        INPUT: 
            - written: whether or not the data was written
        '''
        if not self.log_buffer:
            # TODO: Put warning here
            pass
            #            raise Exception('No log buffer: no operations were executed since \
            #                            _write_log_buffer was last called')

        # Indicate if any data was written
        if written:
            for log in self.log_buffer[::-1]:
                assert log['module_type'] in ['infer', 'transform', 'link']
                if log['module_type'] in ['transform', 'link']:
                    log['written'] = True
                    self.metadata['last_written'] = {
                                                    'module_name': log['module_name'], 
                                                    'file_name': log['file_name']
                                                    }
                    break
                       
        # Add buffer to metadata
        for log in self.log_buffer:
            file_name = log['file_name']
            module_name = log['module_name']
            #            if file_name not in self.metadata['log']:
            #                raise ValueError('file name {0} was not initialized in log'.format(file_name))
            #            if module_name in self.metadata['log'][file_name]:
            #                raise ValueError('module name {0} was not initialized in log for file {1}'.format(module_name, file_name))
            if file_name is not None: # TODO: burn this heresy
                self.metadata['log'][file_name][module_name].update(log)
        # Write metadata and clear log buffer
        self._write_metadata()
        self.log_buffer = []

        Appends log buffer to metadata, writes metadata and clears log_buffer.
        
        INPUT: 
            - written: whether or not the data was written
        
Appends log buffer to metadata, writes metadata and clears log_buffer.
INPUT:
written: whether or not the data was written
Appends log buffer to metadata writes metadata and clears log_buffer . INPUT : written : whether or not the data was written
def _write_log_buffer(self, written):
        if not self.log_buffer:
            pass
        if written:
            for log in self.log_buffer[::-1]:
                assert log['module_type'] in ['infer', 'transform', 'link']
                if log['module_type'] in ['transform', 'link']:
                    log['written'] = True
                    self.metadata['last_written'] = {
                                                    'module_name': log['module_name'], 
                                                    'file_name': log['file_name']
                                                    }
                    break
        for log in self.log_buffer:
            file_name = log['file_name']
            module_name = log['module_name']
            if file_name is not None: 
                self.metadata['log'][file_name][module_name].update(log)
        self._write_metadata()
        self.log_buffer = []
def _write_log_buffer ( self , written ) : if not self . log_buffer : pass if written : for log in self . log_buffer [ : : - 1 ] : assert log [ 'module_type' ] in [ 'infer' , 'transform' , 'link' ] if log [ 'module_type' ] in [ 'transform' , 'link' ] : log [ 'written' ] = True self . metadata [ 'last_written' ] = { 'module_name' : log [ 'module_name' ] , 'file_name' : log [ 'file_name' ] } break for log in self . log_buffer : file_name = log [ 'file_name' ] module_name = log [ 'module_name' ] if file_name is not None : self . metadata [ 'log' ] [ file_name ] [ module_name ] . update ( log ) self . _write_metadata ( ) self . log_buffer = [ ]
Appends log buffer to metadata, writes metadata and clears log_buffer.
Appends log buffer to metadata writes metadata and clears log_buffer .
'''
        Appends log buffer to metadata, writes metadata and clears log_buffer.
        
        INPUT: 
            - written: whether or not the data was written
        ''' # TODO: Put warning here #            raise Exception('No log buffer: no operations were executed since \ #                            _write_log_buffer was last called') # Indicate if any data was written # Add buffer to metadata #            if file_name not in self.metadata['log']: #                raise ValueError('file name {0} was not initialized in log'.format(file_name)) #            if module_name in self.metadata['log'][file_name]: #                raise ValueError('module name {0} was not initialized in log for file {1}'.format(module_name, file_name)) # TODO: burn this heresy # Write metadata and clear log buffer
self
written