(predicted_sql, ground_truth, db_place, idx, iterate_num, meta_time_out)
| 57 | |
| 58 | |
| 59 | def 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 | |
| 79 | def package_sqls(sql_path, db_root_path, mode='gpt', data_mode='dev'): |
nothing calls this directly
no outgoing calls
no test coverage detected