<commit_before>define_upgrade do
  if Partybus.config.bootstrap_server

    es = Partybus.config.running_server["private_chef"]["elasticsearch"]
    # Run these migrations only if elasticsearch has been enabled in the config
    # We do not want to run this if solr is enabled

    if es["enable"]

      must_be_data_master

      # Make sure API is down
      stop_services(["nginx", "opscode-erchef"])
      # Try to call chef-server-ctl reindex
      start_services(["elasticsearch",
                      "nginx",
                      "oc_bifrost",
                      "opscode-erchef",
                      "postgresql",
                      "redis_lb"])

      sleep 30

      log "All orgs are in the 503 mode..."
      log "Migrating indexed search data..."
      run_command("chef-server-ctl reindex -a -d -t -w")

      stop_services(["elasticsearch",
                     "nginx",
                     "oc_bifrost",
                     "opscode-erchef",
                     "postgresql",
                     "redis_lb"])
    end
  end
end
<commit_msg>Update migration to exclude managing postgres services, since chef-server-ctl cannot manage external postgres<commit_after>define_upgrade do
  if Partybus.config.bootstrap_server

    es = Partybus.config.running_server["private_chef"]["elasticsearch"]
    # Run these migrations only if elasticsearch has been enabled in the config
    # We do not want to run this if solr is enabled

    if es["enable"]

      must_be_data_master

      # Make sure API is down
      stop_services(["nginx", "opscode-erchef"])
      # Not including postgres in services here
      # since external postgres cannot be managed
      # via chef-server-ctl
      start_services(["elasticsearch",
                      "nginx",
                      "oc_bifrost",
                      "opscode-erchef",
                      "redis_lb"])

      sleep 30

      log "All orgs are in the 503 mode..."
      log "Migrating indexed search data..."
      run_command("chef-server-ctl reindex -a -d -t")

      stop_services(["elasticsearch",
                     "nginx",
                     "oc_bifrost",
                     "opscode-erchef",
                     "redis_lb"])
    end
  end
end

{'fraction_non_alphanumeric': 0.0881567230632235, 'fraction_numerical': 0.004452359750667854, 'mean_word_length': 1.7570552147239265, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6892214', 'n_tokens_mistral': 646, 'n_tokens_neox': 611, 'n_words': 180}