MCPcopy Create free account
hub / github.com/pgadmin-org/pgadmin4 / poll_result

Function poll_result

web/pgadmin/tools/debugger/__init__.py:2210–2255  ·  view source on GitHub ↗

poll_result(trans_id) This method polls the result of the asynchronous query and returns the result. Parameters: trans_id - unique transaction id.

(trans_id)

Source from the content-addressed store, hash-verified

2208)
2209@pga_login_required
2210def poll_result(trans_id):
2211 """
2212 poll_result(trans_id)
2213
2214 This method polls the result of the asynchronous query and returns the
2215 result.
2216
2217 Parameters:
2218 trans_id
2219 - unique transaction id.
2220 """
2221
2222 de_inst = DebuggerInstance(trans_id)
2223 if de_inst.debugger_data is None:
2224 return make_json_response(
2225 data={
2226 'status': 'NotConnected',
2227 'result': SERVER_CONNECTION_CLOSED
2228 }
2229 )
2230
2231 manager = get_driver(PG_DEFAULT_DRIVER).connection_manager(
2232 de_inst.debugger_data['server_id'])
2233 conn = manager.connection(
2234 did=de_inst.debugger_data['database_id'],
2235 conn_id=de_inst.debugger_data['exe_conn_id'])
2236
2237 if conn.connected():
2238 status, result = conn.poll()
2239 if not status:
2240 status = 'ERROR'
2241 elif status == ASYNC_OK and result is not None:
2242 status = 'Success'
2243 _, result = convert_data_to_dict(conn, result)
2244 else:
2245 status = 'Busy'
2246 else:
2247 status = 'NotConnected'
2248 result = SERVER_CONNECTION_CLOSED
2249
2250 return make_json_response(
2251 data={
2252 'status': status,
2253 'result': result
2254 }
2255 )
2256
2257
2258def release_connection(manager, dbg_obj):

Callers

nothing calls this directly

Calls 8

DebuggerInstanceClass · 0.90
make_json_responseFunction · 0.90
get_driverFunction · 0.90
convert_data_to_dictFunction · 0.85
connection_managerMethod · 0.80
connectionMethod · 0.80
connectedMethod · 0.45
pollMethod · 0.45

Tested by

no test coverage detected