MCPcopy Create free account
hub / github.com/apache/impala / load_runtime_info

Function load_runtime_info

tests/stress/runtime_info.py:67–90  ·  view source on GitHub ↗

Reads the query runtime information at 'path' and returns a dict >. Returns an empty dict if the hosts in the 'impala' instance do not match the data in 'path'.

(path, impala=None)

Source from the content-addressed store, hash-verified

65
66
67def load_runtime_info(path, impala=None):
68 """Reads the query runtime information at 'path' and returns a
69 dict<db_name, dict<sql, Query>>. Returns an empty dict if the hosts in the 'impala'
70 instance do not match the data in 'path'.
71 """
72 queries_by_db_and_sql = defaultdict(lambda: defaultdict(dict))
73 if not os.path.exists(path):
74 return queries_by_db_and_sql
75 with open(path) as file:
76 store = json.load(file)
77 _check_store_version(store)
78 if (
79 impala and
80 store.get("host_names") != sorted([i.host_name for i in impala.impalads])
81 ):
82 return queries_by_db_and_sql
83 for db_name, queries_by_sql in store["db_names"].items():
84 for sql, queries_by_options in queries_by_sql.items():
85 for options, json_query in queries_by_options.items():
86 query = Query()
87 query.__dict__.update(json_query)
88 query.sql = sql
89 queries_by_db_and_sql[db_name][sql][options] = query
90 return queries_by_db_and_sql
91
92
93def _check_store_version(store):

Callers 1

mainFunction · 0.90

Calls 6

QueryClass · 0.90
_check_store_versionFunction · 0.85
getMethod · 0.65
existsMethod · 0.45
loadMethod · 0.45
updateMethod · 0.45

Tested by

no test coverage detected