Changeset View
Changeset View
Standalone View
Standalone View
python_modules/dagster/dagster/grpc/server_watcher.py
Show First 20 Lines • Show All 90 Lines • ▼ Show 20 Lines | def reconnect_loop(): | ||||
if current_server_id() == new_server_id: | if current_server_id() == new_server_id: | ||||
# Intermittent failure, was able to reconnect to the same server | # Intermittent failure, was able to reconnect to the same server | ||||
on_reconnected() | on_reconnected() | ||||
return True | return True | ||||
else: | else: | ||||
on_updated() | on_updated() | ||||
set_server_id(new_server_id) | set_server_id(new_server_id) | ||||
return False | return False | ||||
except grpc.RpcError: # pylint: disable=protected-access | except grpc._channel._InactiveRpcError: # pylint: disable=protected-access | ||||
attempts += 1 | attempts += 1 | ||||
on_error() | on_error() | ||||
return False | return False | ||||
while True: | while True: | ||||
try: | try: | ||||
watch_for_changes() | watch_for_changes() | ||||
return | return | ||||
except grpc.RpcError: # pylint: disable=protected-access | except grpc._channel._InactiveRpcError: # pylint: disable=protected-access | ||||
on_disconnect() | on_disconnect() | ||||
reconnected_to_same_server = reconnect_loop() | reconnected_to_same_server = reconnect_loop() | ||||
if not reconnected_to_same_server: | if not reconnected_to_same_server: | ||||
return | return | ||||
def create_grpc_watch_thread( | def create_grpc_watch_thread( | ||||
client, | client, | ||||
Show All 31 Lines |