Beispiel #1
0
    def reindex(self):
        if not self.es.indices.exists(self.index_info.index):
            self.reset = True  # if the index doesn't exist always reset the processing

        processor = BulkDocProcessor(
            self.doc_provider,
            self.doc_processor,
            reset=self.reset,
            chunk_size=self.chunk_size,
        )

        if not self.in_place and (self.reset or not processor.has_started()):
            _prepare_index_for_reindex(self.es, self.index_info)
            if self.pillow:
                _set_checkpoint(self.pillow)

        processor.run()

        try:
            _prepare_index_for_usage(self.es, self.index_info)
        except TransportError:
            raise Exception(
                'The Elasticsearch index was missing after reindex! If the index was manually deleted '
                'you can fix this by running ./manage.py ptop_reindexer_v2 [index-name] --reset or '
                './manage.py ptop_preindex --reset.'
            )
Beispiel #2
0
    def reindex(self):
        if not self.es.indices.exists(self.index_info.index):
            self.reset = True  # if the index doesn't exist always reset the processing

        processor = BulkDocProcessor(
            self.doc_provider,
            self.doc_processor,
            reset=self.reset,
            chunk_size=self.chunk_size,
        )

        if not self.in_place and (self.reset or not processor.has_started()):
            _prepare_index_for_reindex(self.es, self.index_info)
            if self.pillow:
                _set_checkpoint(self.pillow)

        processor.run()

        try:
            _prepare_index_for_usage(self.es, self.index_info)
        except TransportError:
            raise Exception(
                'The Elasticsearch index was missing after reindex! If the index was manually deleted '
                'you can fix this by running ./manage.py ptop_reindexer_v2 [index-name] --reset or '
                './manage.py ptop_preindex --reset.'
            )
Beispiel #3
0
 def run(self, iteration_key):
     """
     iterate sql records and update them as and when needed
     """
     record_provider = SqlDocumentProvider(iteration_key,
                                           self.case_accessor())
     processor = BulkDocProcessor(record_provider,
                                  self.doc_processor(self.domain))
     return processor.run()
Beispiel #4
0
    def reindex(self):
        processor = BulkDocProcessor(
            self.doc_provider,
            self.doc_processor,
            reset=self.reset,
            chunk_size=self.chunk_size,
        )

        if not self.in_place and (self.reset or not processor.has_started()):
            _prepare_index_for_reindex(self.es, self.index_info)
            if self.pillow:
                _set_checkpoint(self.pillow)

        processor.run()

        _prepare_index_for_usage(self.es, self.index_info)