Skip to content

Commit

Permalink
Add connected() in session.py to figure out session status (#2012)
Browse files Browse the repository at this point in the history
* GAE add connected() in session.py

GAE add connected() in session.py to indicate if the session is still valid and available for the graph computing work.
In some case analytical engine cannot be connected, with this new function, client side can check the session status and process this special case(try to restart runtime or close session etc).
  • Loading branch information
dzhiwei committed Sep 7, 2022
1 parent a2f56ce commit 1f98021
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions python/graphscope/client/session.py
Original file line number Diff line number Diff line change
Expand Up @@ -803,6 +803,14 @@ def _send_heartbeat(self):
self._disconnected = False
time.sleep(self._heartbeat_interval_seconds)

def connected(self) -> bool:
"""Check if the session is still connected and available.
Returns: True or False
"""
return not self._disconnected

def close(self):
"""Closes this session.
Expand Down

0 comments on commit 1f98021

Please sign in to comment.