def run_solr_data_manager_on_collection()

in ambari-infra-solr-client/src/main/python/migrationHelper.py [0:0]


def run_solr_data_manager_on_collection(options, config, collections, src_collection, target_collection,
                                        collections_json_location, num_docs, skip_date_usage = True):
  if target_collection in collections and src_collection in collections:
    source_solr_urls = get_solr_urls(options, config, src_collection, collections_json_location)
    target_solr_urls = get_solr_urls(options, config, target_collection, collections_json_location)
    if is_collection_empty(num_docs, src_collection):
      print("Collection '{0}' is empty. Skipping transport data operation.".format(target_collection))
    else:
      src_solr_url, target_solr_url = get_input_output_solr_url(source_solr_urls, target_solr_urls)
      keytab, principal = get_keytab_and_principal(config)
      date_format = "%Y-%m-%dT%H:%M:%S.%fZ"
      d = datetime.now() + timedelta(days=365)
      end = d.strftime(date_format)
      print("Running solrDataManager.py (solr input collection: {0}, solr output collection: {1})"\
        .format(src_collection, target_collection))
      solr_data_manager.verbose = options.verbose
      solr_data_manager.set_log_level(True)
      solr_data_manager.save("archive", src_solr_url, src_collection, "evtTime", "id", end,
                             options.transport_read_block_size, options.transport_write_block_size,
                             False, None, None, keytab, principal, False, "none", None, None, None,
                             None, None, None, None, None, target_collection,
                             target_solr_url, "_version_", skip_date_usage)
  else:
    print("Collection '{0}' or {1} does not exist or filtered out. Skipping transport data operation.".format(target_collection, src_collection))