def validate_and_find_master_dns(session, parsed_globals, cluster_id):
 cluster_state = emrutils.get_cluster_state(session, parsed_globals, cluster_id)
 if (cluster_state in constants.TERMINATED_STATES):
  raise exceptions.ClusterTerminatedError
 emr = emrutils.get_client(session, parsed_globals)
 try:
  cluster_running_waiter = emr.get_waiter('cluster_running')
  if (cluster_state in constants.STARTING_STATES):
   print 'Waiting for the cluster to start.'
  cluster_running_waiter.wait(ClusterId=cluster_id)
 except WaiterError:
  raise exceptions.MasterDNSNotAvailableError
 return emrutils.find_master_dns(session=session, cluster_id=cluster_id, parsed_globals=parsed_globals)

def validate_and_find_master_dns ( session , parsed_globals , cluster_id ) : cluster_state = emrutils . get_cluster_state ( session , parsed_globals , cluster_id ) if ( cluster_state in constants . TERMINATED_STATES ) : raise exceptions . ClusterTerminatedError emr = emrutils . get_client ( session , parsed_globals ) try : cluster_running_waiter = emr . get_waiter ( 'cluster_running' ) if ( cluster_state in constants . STARTING_STATES ) : print 'Waiting for the cluster to start.' cluster_running_waiter . wait ( ClusterId = cluster_id ) except WaiterError : raise exceptions . MasterDNSNotAvailableError return emrutils . find_master_dns ( session = session , cluster_id = cluster_id , parsed_globals = parsed_globals )
utility method for ssh .