MCPcopy Create free account
hub / github.com/FlyingFeather/DEA-SQL / execute_model

Function execute_model

evaluation/src/evaluation_ves.py:59–76  ·  view source on GitHub ↗
(predicted_sql, ground_truth, db_place, idx, iterate_num, meta_time_out)

Source from the content-addressed store, hash-verified

57
58
59def execute_model(predicted_sql, ground_truth, db_place, idx, iterate_num, meta_time_out):
60 try:
61 # you can personalize the total timeout number
62 # larger timeout leads to more stable ves
63 # while it needs more your patience....
64 time_ratio = func_timeout(meta_time_out * iterate_num, iterated_execute_sql,
65 args=(predicted_sql, ground_truth, db_place, iterate_num))
66 # print([idx, math.sqrt(time_ratio)])
67 except KeyboardInterrupt:
68 sys.exit(0)
69 except FunctionTimedOut:
70 result = [(f'timeout',)]
71 time_ratio = 0
72 except Exception as e:
73 result = [(f'error {e}',)] # possibly len(query) > 512 or not executable
74 time_ratio = 0
75 result = {'sql_idx': idx, 'time_ratio': time_ratio}
76 return result
77
78
79def package_sqls(sql_path, db_root_path, mode='gpt', data_mode='dev'):

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected