start_execution(trans_id, port_num) This method is responsible for creating an asynchronous connection for execution thread. Also store the session id into session return with attach port query for the direct debugging. Parameters: trans_id - Transaction ID
(trans_id, port_num)
| 1364 | ) |
| 1365 | @pga_login_required |
| 1366 | def start_execution(trans_id, port_num): |
| 1367 | """ |
| 1368 | start_execution(trans_id, port_num) |
| 1369 | |
| 1370 | This method is responsible for creating an asynchronous connection for |
| 1371 | execution thread. Also store the session id into session return with |
| 1372 | attach port query for the direct debugging. |
| 1373 | |
| 1374 | Parameters: |
| 1375 | trans_id |
| 1376 | - Transaction ID |
| 1377 | port_num |
| 1378 | - Port number to attach |
| 1379 | """ |
| 1380 | |
| 1381 | de_inst = DebuggerInstance(trans_id) |
| 1382 | if de_inst.debugger_data is None: |
| 1383 | return make_json_response( |
| 1384 | data={ |
| 1385 | 'status': 'NotConnected', |
| 1386 | 'result': SERVER_CONNECTION_CLOSED |
| 1387 | } |
| 1388 | ) |
| 1389 | |
| 1390 | # Create asynchronous connection using random connection id. |
| 1391 | exe_conn_id = str(secrets.choice(range(1, 9999999))) |
| 1392 | try: |
| 1393 | manager = get_driver(PG_DEFAULT_DRIVER).connection_manager( |
| 1394 | de_inst.debugger_data['server_id']) |
| 1395 | conn = manager.connection( |
| 1396 | did=de_inst.debugger_data['database_id'], |
| 1397 | conn_id=exe_conn_id) |
| 1398 | except Exception as e: |
| 1399 | return internal_server_error(errormsg=str(e)) |
| 1400 | |
| 1401 | # Connect the Server |
| 1402 | status, msg = conn.connect() |
| 1403 | if not status: |
| 1404 | return internal_server_error(errormsg=str(msg)) |
| 1405 | |
| 1406 | # find the debugger version and execute the query accordingly |
| 1407 | dbg_version = de_inst.debugger_data['debugger_version'] |
| 1408 | if dbg_version <= 2: |
| 1409 | template_path = DEBUGGER_SQL_V1_PATH |
| 1410 | else: |
| 1411 | template_path = DEBUGGER_SQL_V3_PATH |
| 1412 | |
| 1413 | # connect to port and store the session ID in the session variables |
| 1414 | sql = render_template( |
| 1415 | "/".join([template_path, 'attach_to_port.sql']), port=port_num) |
| 1416 | status_port, res_port = execute_dict_search_path( |
| 1417 | conn, sql, de_inst.debugger_data['search_path']) |
| 1418 | if not status_port: |
| 1419 | return internal_server_error(errormsg=res_port) |
| 1420 | |
| 1421 | if res_port == BUSY: |
| 1422 | return make_json_response( |
| 1423 | data={'status': 'Busy', 'result': []} |
nothing calls this directly
no test coverage detected