0f7bacc26eec44c9f00f5d7666c1f87f0e051ce2,search/management/commands/post_dirty_sounds_to_solr.py,Command,handle,#Command#,37

Before Change


                    % num_sounds)

        num_correctly_indexed_sounds = 0
        slice_size = 1000
        for i in range(0, num_sounds, slice_size):
            console_logger.info("Adding %i sounds to solr, slice %i", slice_size, i)
            try:
                // Get all sounds moderated and processed ok that has is_index_dirty
                where = "sound.moderation_state = "OK" AND sound.processing_state = "OK" AND is_index_dirty = true " \
                        "AND sound.id > %s"
                order_by = "sound.id ASC"
                sounds_qs = Sound.objects.bulk_query_solr(where, order_by, slice_size, (i, ))
                add_sounds_to_solr(sounds_qs)
                num_correctly_indexed_sounds += slice_size
            except SolrException as e:
                console_logger.error("failed to add sound batch to solr index, reason: %s", str(e))
                raise

        logger.info("Finished posting dirty sounds to solr. %i sounds have been added/updated"
                    % num_correctly_indexed_sounds)

        // Remove all those which are not processed or moderated ok and that are still in solr (should not happen)

After Change



        // Index all those which are processed and moderated ok that has is_index_dirty
        sounds_to_index = Sound.objects.filter(processing_state="OK", moderation_state="OK", is_index_dirty=True)
        num_sounds = sounds_to_index.count()
        logger.info("Starting posting dirty sounds to solr. %i sounds to be added/updated to the solr index"
                    % num_sounds)

        num_correctly_indexed_sounds = add_all_sounds_to_solr(sounds_to_index)

        if num_correctly_indexed_sounds == num_sounds:
            sounds_to_index.update(is_index_dirty=False)

        logger.info("Finished posting dirty sounds to solr. %i sounds have been added/updated"
                    % num_correctly_indexed_sounds)

        // Remove all those which are not processed or moderated ok and that are still in solr (should not happen)
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 5

Instances


Project Name: MTG/freesound
Commit Name: 0f7bacc26eec44c9f00f5d7666c1f87f0e051ce2
Time: 2017-11-10
Author: andres.ferraro@upf.edu
File Name: search/management/commands/post_dirty_sounds_to_solr.py
Class Name: Command
Method Name: handle


Project Name: tensorflow/datasets
Commit Name: 4e0f1b51db0a78331509be2f3c95a4ed29f6b0c5
Time: 2018-12-13
Author: rsepassi@google.com
File Name: tensorflow_datasets/core/registered.py
Class Name:
Method Name: _dataset_name_and_kwargs_from_name_str


Project Name: ray-project/ray
Commit Name: 63594c537064d5cc47179169df6e6e6defa613d6
Time: 2021-03-25
Author: ed.nmi.oakes@gmail.com
File Name: python/ray/serve/backend_state.py
Class Name: BackendState
Method Name: _scale_backend_replicas