Skip to content

Commit

Permalink
update reload modules
Browse files Browse the repository at this point in the history
  • Loading branch information
Kunihiko Kido committed Jul 24, 2015
1 parent 7937830 commit 65f68f5
Show file tree
Hide file tree
Showing 2 changed files with 133 additions and 212 deletions.
335 changes: 124 additions & 211 deletions ElasticsearchClient.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,98 +15,11 @@ def reload_modeule(module):

module_load_order = [
"dateutil",
"dateutil.tz",
"requests",
"requests.adapters",
"requests.api",
"requests.auth",
"requests.certs",
"requests.compat",
"requests.cookies",
"requests.exceptions",
"requests.hooks",
"requests.models",
"requests.packages",
"requests.packages.chardet",
"requests.packages.urllib3",
"requests.packages.urllib3._collections",
"requests.packages.urllib3.connection",
"requests.packages.urllib3.connectionpool",
"requests.packages.urllib3.contrib",
"requests.packages.urllib3.exceptions",
"requests.packages.urllib3.fields",
"requests.packages.urllib3.filepost",
"requests.packages.urllib3.packages",
"requests.packages.urllib3.packages.six",
"requests.packages.urllib3.packages.ssl_match_hostname",
"requests.packages.urllib3.poolmanager",
"requests.packages.urllib3.request",
"requests.packages.urllib3.response",
"requests.packages.urllib3.util",
"requests.packages.urllib3.util.connection",
"requests.packages.urllib3.util.request",
"requests.packages.urllib3.util.response",
"requests.packages.urllib3.util.retry",
"requests.packages.urllib3.util.ssl_",
"requests.packages.urllib3.util.timeout",
"requests.packages.urllib3.util.url",
"requests.sessions",
"requests.status_codes",
"requests.structures",
"requests.utils",
"six",
"urllib3",
"urllib3._collections",
"urllib3.connection",
"urllib3.connectionpool",
"urllib3.exceptions",
"urllib3.fields",
"urllib3.filepost",
"urllib3.packages",
"urllib3.packages.six",
"urllib3.packages.ssl_match_hostname",
"urllib3.poolmanager",
"urllib3.request",
"urllib3.response",
"urllib3.util",
"urllib3.util.connection",
"urllib3.util.request",
"urllib3.util.response",
"urllib3.util.retry",
"urllib3.util.ssl_",
"urllib3.util.timeout",
"urllib3.util.url",

"analytics",
"analytics.client",
"analytics.consumer",
"analytics.request",
"analytics.utils",
"analytics.version",

"elasticsearch",
"elasticsearch.client",
"elasticsearch.client.cat",
"elasticsearch.client.cluster",
"elasticsearch.client.indices",
"elasticsearch.client.nodes",
"elasticsearch.client.snapshot",
"elasticsearch.client.utils",
"elasticsearch.compat",
"elasticsearch.connection",
"elasticsearch.connection.base",
"elasticsearch.connection.esthrift",
"elasticsearch.connection.http_requests",
"elasticsearch.connection.http_urllib3",
"elasticsearch.connection.memcached",
"elasticsearch.connection.pooling",
"elasticsearch.connection.thrift",
"elasticsearch.connection_pool",
"elasticsearch.exceptions",
"elasticsearch.helpers",
"elasticsearch.serializer",
"elasticsearch.transport",

"elasticsearch_connections",

"ElasticsearchClient.panel.warmer_list_panel",
Expand All @@ -123,131 +36,131 @@ def reload_modeule(module):
"ElasticsearchClient.panel.alias_list_panel",
"ElasticsearchClient.panel",

"ElasticsearchClient.commands.update_document",
"ElasticsearchClient.commands.termvector",
"ElasticsearchClient.commands.suggest",
"ElasticsearchClient.commands.snapshot_verify_repository",
"ElasticsearchClient.commands.snapshot_status",
"ElasticsearchClient.commands.snapshot_restore",
"ElasticsearchClient.commands.snapshot_get_repository",
"ElasticsearchClient.commands.snapshot_get",
"ElasticsearchClient.commands.snapshot_delete_repository",
"ElasticsearchClient.commands.snapshot_delete",
"ElasticsearchClient.commands.snapshot_create_repository",
"ElasticsearchClient.commands.snapshot_create",
"ElasticsearchClient.commands.show_response",
"ElasticsearchClient.commands.show_output_panel",
"ElasticsearchClient.commands.settings_switch_server",
"ElasticsearchClient.commands.settings_show_active_server",
"ElasticsearchClient.commands.settings_select_index",
"ElasticsearchClient.commands.settings_select_doc_type",
"ElasticsearchClient.commands.search_template",
"ElasticsearchClient.commands.search_simple_query",
"ElasticsearchClient.commands.search_shards",
"ElasticsearchClient.commands.search_request_body",
"ElasticsearchClient.commands.search_percolator_query",
"ElasticsearchClient.commands.search_exists",
"ElasticsearchClient.commands.scroll",
"ElasticsearchClient.commands.put_search_template",
"ElasticsearchClient.commands.put_script",
"ElasticsearchClient.commands.ping",
"ElasticsearchClient.commands.percolate",
"ElasticsearchClient.commands.nodes_shutdown",
"ElasticsearchClient.commands.nodes_info",
"ElasticsearchClient.commands.nodes_hot_threads",
"ElasticsearchClient.commands.multiple_termvectors",
"ElasticsearchClient.commands.multiple_search",
"ElasticsearchClient.commands.multiple_percolate",
"ElasticsearchClient.commands.info",
"ElasticsearchClient.commands.indices_validate_query",
"ElasticsearchClient.commands.indices_upgrade",
"ElasticsearchClient.commands.indices_update_aliases",
"ElasticsearchClient.commands.indices_status",
"ElasticsearchClient.commands.indices_stats",
"ElasticsearchClient.commands.indices_segments",
"ElasticsearchClient.commands.indices_refresh",
"ElasticsearchClient.commands.indices_recovery",
"ElasticsearchClient.commands.indices_put_warmer",
"ElasticsearchClient.commands.indices_put_template",
"ElasticsearchClient.commands.indices_put_settings",
"ElasticsearchClient.commands.indices_put_mapping",
"ElasticsearchClient.commands.indices_put_alias",
"ElasticsearchClient.commands.indices_optimize",
"ElasticsearchClient.commands.indices_open",
"ElasticsearchClient.commands.indices_get_warmer",
"ElasticsearchClient.commands.indices_get_upgrade",
"ElasticsearchClient.commands.indices_get_template",
"ElasticsearchClient.commands.indices_get_settings",
"ElasticsearchClient.commands.indices_get_mapping",
"ElasticsearchClient.commands.indices_get_field_mapping",
"ElasticsearchClient.commands.indices_get_alias",
"ElasticsearchClient.commands.indices_get",
"ElasticsearchClient.commands.indices_flush_synced",
"ElasticsearchClient.commands.indices_flush",
"ElasticsearchClient.commands.indices_exists_template",
"ElasticsearchClient.commands.indices_exists_doc_type",
"ElasticsearchClient.commands.indices_exists_alias",
"ElasticsearchClient.commands.indices_exists",
"ElasticsearchClient.commands.indices_delete_warmer",
"ElasticsearchClient.commands.indices_delete_template",
"ElasticsearchClient.commands.indices_delete_mapping",
"ElasticsearchClient.commands.indices_delete_alias",
"ElasticsearchClient.commands.indices_delete",
"ElasticsearchClient.commands.indices_create_doc_type",
"ElasticsearchClient.commands.indices_create",
"ElasticsearchClient.commands.indices_close",
"ElasticsearchClient.commands.indices_clear_cache",
"ElasticsearchClient.commands.indices_analyze",
"ElasticsearchClient.commands.index_percolator_query",
"ElasticsearchClient.commands.index_document",
"ElasticsearchClient.commands.helper_reindex",
"ElasticsearchClient.commands.helper_load_index_data",
"ElasticsearchClient.commands.helper_import_csv",
"ElasticsearchClient.commands.helper_dump_index_data",
"ElasticsearchClient.commands.helper_convert_csv_bulk_index",
"ElasticsearchClient.commands.helper_close_open_index",
"ElasticsearchClient.commands.helper_change_number_of_replicas",
"ElasticsearchClient.commands.helper_benchmark",
"ElasticsearchClient.commands.get_search_template",
"ElasticsearchClient.commands.get_script",
"ElasticsearchClient.commands.get_percolator_query",
"ElasticsearchClient.commands.get_multiple_documents",
"ElasticsearchClient.commands.get_document_source",
"ElasticsearchClient.commands.get_document",
"ElasticsearchClient.commands.field_stats",
"ElasticsearchClient.commands.explain_document",
"ElasticsearchClient.commands.exists_document",
"ElasticsearchClient.commands.delete_search_template",
"ElasticsearchClient.commands.delete_script",
"ElasticsearchClient.commands.delete_document",
"ElasticsearchClient.commands.delete_by_query",
"ElasticsearchClient.commands.create_document",
"ElasticsearchClient.commands.count_percolate",
"ElasticsearchClient.commands.count",
"ElasticsearchClient.commands.cluster_stats",
"ElasticsearchClient.commands.cluster_state",
"ElasticsearchClient.commands.cluster_reroute",
"ElasticsearchClient.commands.cluster_put_settings",
"ElasticsearchClient.commands.cluster_pending_tasks",
"ElasticsearchClient.commands.cluster_health",
"ElasticsearchClient.commands.cluster_get_settings",
"ElasticsearchClient.commands.clear_scroll",
"ElasticsearchClient.commands.cat_thread_pool",
"ElasticsearchClient.commands.cat_shards",
"ElasticsearchClient.commands.cat_segments",
"ElasticsearchClient.commands.cat_recovery",
"ElasticsearchClient.commands.cat_plugins",
"ElasticsearchClient.commands.cat_pending_tasks",
"ElasticsearchClient.commands.cat_nodes",
"ElasticsearchClient.commands.cat_master",
"ElasticsearchClient.commands.cat_indices",
"ElasticsearchClient.commands.cat_health",
"ElasticsearchClient.commands.cat_fielddata",
"ElasticsearchClient.commands.cat_count",
"ElasticsearchClient.commands.cat_allocation",
"ElasticsearchClient.commands.cat_aliases",
"ElasticsearchClient.commands.bulk",
"ElasticsearchClient.commands.base",
"ElasticsearchClient.commands.bulk",
"ElasticsearchClient.commands.cat_aliases",
"ElasticsearchClient.commands.cat_allocation",
"ElasticsearchClient.commands.cat_count",
"ElasticsearchClient.commands.cat_fielddata",
"ElasticsearchClient.commands.cat_health",
"ElasticsearchClient.commands.cat_indices",
"ElasticsearchClient.commands.cat_master",
"ElasticsearchClient.commands.cat_nodes",
"ElasticsearchClient.commands.cat_pending_tasks",
"ElasticsearchClient.commands.cat_plugins",
"ElasticsearchClient.commands.cat_recovery",
"ElasticsearchClient.commands.cat_segments",
"ElasticsearchClient.commands.cat_shards",
"ElasticsearchClient.commands.cat_thread_pool",
"ElasticsearchClient.commands.clear_scroll",
"ElasticsearchClient.commands.cluster_get_settings",
"ElasticsearchClient.commands.cluster_health",
"ElasticsearchClient.commands.cluster_pending_tasks",
"ElasticsearchClient.commands.cluster_put_settings",
"ElasticsearchClient.commands.cluster_reroute",
"ElasticsearchClient.commands.cluster_state",
"ElasticsearchClient.commands.cluster_stats",
"ElasticsearchClient.commands.count",
"ElasticsearchClient.commands.count_percolate",
"ElasticsearchClient.commands.create_document",
"ElasticsearchClient.commands.delete_by_query",
"ElasticsearchClient.commands.delete_document",
"ElasticsearchClient.commands.delete_script",
"ElasticsearchClient.commands.delete_search_template",
"ElasticsearchClient.commands.exists_document",
"ElasticsearchClient.commands.explain_document",
"ElasticsearchClient.commands.field_stats",
"ElasticsearchClient.commands.get_document",
"ElasticsearchClient.commands.get_document_source",
"ElasticsearchClient.commands.get_multiple_documents",
"ElasticsearchClient.commands.get_percolator_query",
"ElasticsearchClient.commands.get_script",
"ElasticsearchClient.commands.get_search_template",
"ElasticsearchClient.commands.helper_benchmark",
"ElasticsearchClient.commands.helper_change_number_of_replicas",
"ElasticsearchClient.commands.helper_close_open_index",
"ElasticsearchClient.commands.helper_convert_csv_bulk_index",
"ElasticsearchClient.commands.helper_dump_index_data",
"ElasticsearchClient.commands.helper_import_csv",
"ElasticsearchClient.commands.helper_load_index_data",
"ElasticsearchClient.commands.helper_reindex",
"ElasticsearchClient.commands.index_document",
"ElasticsearchClient.commands.index_percolator_query",
"ElasticsearchClient.commands.indices_analyze",
"ElasticsearchClient.commands.indices_clear_cache",
"ElasticsearchClient.commands.indices_close",
"ElasticsearchClient.commands.indices_create",
"ElasticsearchClient.commands.indices_create_doc_type",
"ElasticsearchClient.commands.indices_delete",
"ElasticsearchClient.commands.indices_delete_alias",
"ElasticsearchClient.commands.indices_delete_mapping",
"ElasticsearchClient.commands.indices_delete_template",
"ElasticsearchClient.commands.indices_delete_warmer",
"ElasticsearchClient.commands.indices_exists",
"ElasticsearchClient.commands.indices_exists_alias",
"ElasticsearchClient.commands.indices_exists_doc_type",
"ElasticsearchClient.commands.indices_exists_template",
"ElasticsearchClient.commands.indices_flush",
"ElasticsearchClient.commands.indices_flush_synced",
"ElasticsearchClient.commands.indices_get",
"ElasticsearchClient.commands.indices_get_alias",
"ElasticsearchClient.commands.indices_get_field_mapping",
"ElasticsearchClient.commands.indices_get_mapping",
"ElasticsearchClient.commands.indices_get_settings",
"ElasticsearchClient.commands.indices_get_template",
"ElasticsearchClient.commands.indices_get_upgrade",
"ElasticsearchClient.commands.indices_get_warmer",
"ElasticsearchClient.commands.indices_open",
"ElasticsearchClient.commands.indices_optimize",
"ElasticsearchClient.commands.indices_put_alias",
"ElasticsearchClient.commands.indices_put_mapping",
"ElasticsearchClient.commands.indices_put_settings",
"ElasticsearchClient.commands.indices_put_template",
"ElasticsearchClient.commands.indices_put_warmer",
"ElasticsearchClient.commands.indices_recovery",
"ElasticsearchClient.commands.indices_refresh",
"ElasticsearchClient.commands.indices_segments",
"ElasticsearchClient.commands.indices_stats",
"ElasticsearchClient.commands.indices_status",
"ElasticsearchClient.commands.indices_update_aliases",
"ElasticsearchClient.commands.indices_upgrade",
"ElasticsearchClient.commands.indices_validate_query",
"ElasticsearchClient.commands.info",
"ElasticsearchClient.commands.multiple_percolate",
"ElasticsearchClient.commands.multiple_search",
"ElasticsearchClient.commands.multiple_termvectors",
"ElasticsearchClient.commands.nodes_hot_threads",
"ElasticsearchClient.commands.nodes_info",
"ElasticsearchClient.commands.nodes_shutdown",
"ElasticsearchClient.commands.percolate",
"ElasticsearchClient.commands.ping",
"ElasticsearchClient.commands.put_script",
"ElasticsearchClient.commands.put_search_template",
"ElasticsearchClient.commands.scroll",
"ElasticsearchClient.commands.search_exists",
"ElasticsearchClient.commands.search_percolator_query",
"ElasticsearchClient.commands.search_request_body",
"ElasticsearchClient.commands.search_shards",
"ElasticsearchClient.commands.search_simple_query",
"ElasticsearchClient.commands.search_template",
"ElasticsearchClient.commands.settings_select_doc_type",
"ElasticsearchClient.commands.settings_select_index",
"ElasticsearchClient.commands.settings_show_active_server",
"ElasticsearchClient.commands.settings_switch_server",
"ElasticsearchClient.commands.show_output_panel",
"ElasticsearchClient.commands.show_response",
"ElasticsearchClient.commands.snapshot_create",
"ElasticsearchClient.commands.snapshot_create_repository",
"ElasticsearchClient.commands.snapshot_delete",
"ElasticsearchClient.commands.snapshot_delete_repository",
"ElasticsearchClient.commands.snapshot_get",
"ElasticsearchClient.commands.snapshot_get_repository",
"ElasticsearchClient.commands.snapshot_restore",
"ElasticsearchClient.commands.snapshot_status",
"ElasticsearchClient.commands.snapshot_verify_repository",
"ElasticsearchClient.commands.suggest",
"ElasticsearchClient.commands.termvector",
"ElasticsearchClient.commands.update_document",
"ElasticsearchClient.commands",
]

Expand Down
10 changes: 9 additions & 1 deletion commands/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,9 +74,17 @@ def headers(self):

@property
def servers(self):
def _normalize_servers(servers):
items = []
for name, server in servers.items():
server["name"] = name
items.append(server)
servers = sorted(items, key=lambda k: k["name"])
return servers

servers = self.settings.get("servers", [])
if isinstance(servers, dict):
servers = list(servers.values())
servers = _normalize_servers(servers)
return servers

@property
Expand Down

0 comments on commit 65f68f5

Please sign in to comment.