def jt_ha(funct):
 def decorate(api, *args, **kwargs):
  try:
   return funct(api, *args, **kwargs)
  except Exception as ex:
   if ('Could not connect to' in str(ex)):
    LOG.info(('JobTracker not available, trying JT plugin HA: %s.' % ex))
    jt_ha = get_next_ha_mrcluster()
    if (jt_ha is not None):
     if (jt_ha[1].host == api.jt.host):
      raise ex
     (config, api.jt) = jt_ha
     return funct(api, *args, **kwargs)
   raise ex
 return wraps(funct)(decorate)

def jt_ha ( funct ) : def decorate ( api , * args , ** kwargs ) : try : return funct ( api , * args , ** kwargs ) except Exception as ex : if ( 'Could not connect to' in str ( ex ) ) : LOG . info ( ( 'JobTracker not available, trying JT plugin HA: %s.' % ex ) ) jt_ha = get_next_ha_mrcluster ( ) if ( jt_ha is not None ) : if ( jt_ha [ 1 ] . host == api . jt . host ) : raise ex ( config , api . jt ) = jt_ha return funct ( api , * args , ** kwargs ) raise ex return wraps ( funct ) ( decorate )
support jt plugin ha by trying other mr cluster .