#NEWLINE# def get_history_server_api( username ) : #NEWLINE# #INDENT# global API_CACHE #NEWLINE# if ( API_CACHE is None ) : #NEWLINE# #INDENT# API_CACHE_LOCK . acquire ( ) #NEWLINE# try : #NEWLINE# #INDENT# if ( API_CACHE is None ) : #NEWLINE# #INDENT# yarn_cluster = cluster . get_cluster_conf_for_job_submission ( ) #NEWLINE# if ( API_CACHE is None ) : #NEWLINE# #INDENT# raise PopupException ( _ ( 'YARN cluster is not available.' ) ) #NEWLINE# #UNINDENT# API_CACHE = HistoryServerApi ( yarn_cluster . HISTORY_SERVER_API_URL . get ( ) , yarn_cluster . SECURITY_ENABLED . get ( ) , yarn_cluster . SSL_CERT_CA_VERIFY . get ( ) ) #NEWLINE# #UNINDENT# #UNINDENT# finally : #NEWLINE# #INDENT# API_CACHE_LOCK . release ( ) #NEWLINE# #UNINDENT# #UNINDENT# API_CACHE . setuser ( username ) #NEWLINE# return API_CACHE