handle AuthenticationException in SSH output read
from tensorhive.core.utils.decorators import memoize, timeit
from tensorhive.config import SSH
from pssh.clients.native import ParallelSSHClient
+from pssh.exceptions import AuthenticationException
from typing import Optional, Dict, Tuple, Generator, List
from paramiko.rsakey import RSAKey
from pathlib import PosixPath
@@ -110,6 +111,9 @@ def get_stdout(host: Hostname, output: pssh.output.HostOutput) -> Optional[str]:
except (TypeError, ):
log.warning('Could not extract stdout for {}: {}'.format(host, output))
return None
+ except AuthenticationException:
+ log.warning('Could not authenticate SSH connection for {}: {}'.format(host, output))
+ return None
except Exception as e:
log.critical(e)
# Base for all pssh exceptions: https://github.com/ParallelSSH/parallel-ssh/blob/master/pssh/exceptions.py
