#NEWLINE# def _CheckSshReady( self , instance_name ) : #NEWLINE# #INDENT# 'Checks if the instance is ready to connect via SSH.\n\n    Hadoop-on-Compute uses SSH to copy script files and execute remote commands.\n    Connects with SSH and exits immediately to see if SSH connection works.\n\n    Args:\n      instance_name: Name of the instance.\n    Returns:\n      Boolean to indicate whether the instance is ready to SSH.\n    ' #NEWLINE# command = ( 'gcutil ssh --project=%s --zone=%s --ssh_arg "-o ConnectTimeout=10" --ssh_arg "-o StrictHostKeyChecking=no" %s exit' % ( self . flags . project , self . zone , instance_name ) ) #NEWLINE# logging . debug ( 'SSH availability check command: %s' , command ) #NEWLINE# if subprocess . call ( command , shell = True ) : #NEWLINE# #INDENT# logging . info ( 'SSH is not yet ready on %s' , instance_name ) #NEWLINE# return False #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# return True