Exemplo n.º 1
0
    def handle(self, *args, **options):
        if options['recreate']:
            reinit_index()
        elif es_conn.indices.exists(INDEX_NAME):
            # get the index name from the all indicies listing
            self.stderr.write("Index already exists; can't perform import")
            return

        fields = [
            'id',
            'action',
            'job_guid',
            'test',
            'subtest',
            'status',
            'expected',
            'message',
            'best_classification_id',
            'best_is_verified',
        ]

        failure_lines = FailureLine.objects.filter(action='test_result')
        for rows in chunked_qs(failure_lines,
                               options['chunk_size'],
                               fields=fields):
            inserted = bulk(rows)
            msg = 'Inserted {} documents from {} FailureLines'
            self.stdout.write(msg.format(inserted, len(rows)))

            time.sleep(options['sleep'])

        count = count_index()
        self.stdout.write('Index contains {} documents'.format(count))
Exemplo n.º 2
0
def elasticsearch(request):
    from treeherder.services.elasticsearch import reinit_index, refresh_index

    if not settings.ELASTICSEARCH_URL:
        return

    reinit_index()
    refresh_index()
Exemplo n.º 3
0
def elasticsearch(request):
    from treeherder.services.elasticsearch import reinit_index, refresh_index

    if not settings.ELASTICSEARCH_URL:
        return

    reinit_index()
    refresh_index()