src/dirbs/listgen/generator.py
def generate_lists(self):
        """Function that generates the CSV list outputs in the output directory."""
        has_lock = False
        try:
            # Ensure we are the only dirbs-listgen process running
            has_lock = self._try_acquire_listgen_lock()
            if not has_lock:
                raise ListGenerationLockException('Could not acquire lock for list generation. '
                                                  'Are there any other dirbs-listgen instances running at the moment?')

            # We change our role to dirbs_core_listgen so that any created tables and sequences have the right
            # owners
            with db_role_setter(self._conn, role_name='dirbs_core_listgen'), self._conn.cursor() as cursor:
                # Generate intermediate tables containing new full lists
                self._create_intermediate_new_tables()

                # # Generate intermediate tables containing list from most recent version
                self._create_intermediate_old_tables()

                # # Now we generate intermediate tables containing the new and the current lists
                self._create_intermediate_delta_tables()

                # # Now store deltas
                self._store_list_deltas()

            # Generate CSV files, both the full lists and the deltas between the new lists and the specified base
            self._write_csv_lists()

        finally:
            if has_lock:
                self._release_listgen_lock()

            if not self._no_cleanup:
                with self._conn as conn, conn.cursor() as cursor:
                    for tblname in self._intermediate_table_names:
                        self._logger.debug('Cleanup: dropping intermediate table {0}...'.format(tblname))
                        cursor.execute(sql.SQL('DROP TABLE {0} CASCADE').format(sql.Identifier(tblname)))
                        self._logger.debug('Cleanup: dropped intermediate table {0}'.format(tblname))
            else:
                self._logger.warning('Skipping intermediate table cleanup due to command-line option')
Function that generates the CSV list outputs in the output directory.
Function that generates the CSV list outputs in the output directory.
Function that generates the CSV list outputs in the output directory .
def generate_lists(self):
        has_lock = False
        try:
            has_lock = self._try_acquire_listgen_lock()
            if not has_lock:
                raise ListGenerationLockException('Could not acquire lock for list generation. '
                                                  'Are there any other dirbs-listgen instances running at the moment?')
            with db_role_setter(self._conn, role_name='dirbs_core_listgen'), self._conn.cursor() as cursor:
                self._create_intermediate_new_tables()
                self._create_intermediate_old_tables()
                self._create_intermediate_delta_tables()
                self._store_list_deltas()
            self._write_csv_lists()
        finally:
            if has_lock:
                self._release_listgen_lock()
            if not self._no_cleanup:
                with self._conn as conn, conn.cursor() as cursor:
                    for tblname in self._intermediate_table_names:
                        self._logger.debug('Cleanup: dropping intermediate table {0}...'.format(tblname))
                        cursor.execute(sql.SQL('DROP TABLE {0} CASCADE').format(sql.Identifier(tblname)))
                        self._logger.debug('Cleanup: dropped intermediate table {0}'.format(tblname))
            else:
                self._logger.warning('Skipping intermediate table cleanup due to command-line option')
def generate_lists ( self ) : has_lock = False try : has_lock = self . _try_acquire_listgen_lock ( ) if not has_lock : raise ListGenerationLockException ( 'Could not acquire lock for list generation. ' 'Are there any other dirbs-listgen instances running at the moment?' ) with db_role_setter ( self . _conn , role_name = 'dirbs_core_listgen' ) , self . _conn . cursor ( ) as cursor : self . _create_intermediate_new_tables ( ) self . _create_intermediate_old_tables ( ) self . _create_intermediate_delta_tables ( ) self . _store_list_deltas ( ) self . _write_csv_lists ( ) finally : if has_lock : self . _release_listgen_lock ( ) if not self . _no_cleanup : with self . _conn as conn , conn . cursor ( ) as cursor : for tblname in self . _intermediate_table_names : self . _logger . debug ( 'Cleanup: dropping intermediate table {0}...' . format ( tblname ) ) cursor . execute ( sql . SQL ( 'DROP TABLE {0} CASCADE' ) . format ( sql . Identifier ( tblname ) ) ) self . _logger . debug ( 'Cleanup: dropped intermediate table {0}' . format ( tblname ) ) else : self . _logger . warning ( 'Skipping intermediate table cleanup due to command-line option' )
Function that generates the CSV list outputs in the output directory.
Function that generates the CSV list outputs in the output directory .
"""Function that generates the CSV list outputs in the output directory.""" # Ensure we are the only dirbs-listgen process running # We change our role to dirbs_core_listgen so that any created tables and sequences have the right # owners # Generate intermediate tables containing new full lists # # Generate intermediate tables containing list from most recent version # # Now we generate intermediate tables containing the new and the current lists # # Now store deltas # Generate CSV files, both the full lists and the deltas between the new lists and the specified base
self