#NEWLINE# @ cpo . event_wrapper ( True , step = ( _ ( 'Decommission %s' ) % 'Slaves' ) ) #NEWLINE# def decommission_sl( master , inst_to_be_deleted , survived_inst ) : #NEWLINE# #INDENT# if ( survived_inst is not None ) : #NEWLINE# #INDENT# slavenames = [ ] #NEWLINE# for slave in survived_inst : #NEWLINE# #INDENT# slavenames . append ( slave . hostname ( ) ) #NEWLINE# #UNINDENT# slaves_content = c_helper . generate_spark_slaves_configs ( slavenames ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# slaves_content = '\n' #NEWLINE# #UNINDENT# cluster = master . cluster #NEWLINE# sp_home = utils . get_config_value_or_default ( 'Spark' , 'Spark home' , cluster ) #NEWLINE# r_master = remote . get_remote ( master ) #NEWLINE# run . stop_spark ( r_master , sp_home ) #NEWLINE# files = { #NEWLINE# #INDENT# os . path . join ( sp_home , 'conf/slaves' ) : slaves_content , #NEWLINE# #UNINDENT# } #NEWLINE# r_master . write_files_to ( files ) #NEWLINE# for i in survived_inst : #NEWLINE# #INDENT# with remote . get_remote ( i ) as r : #NEWLINE# #INDENT# r . write_files_to ( files ) #NEWLINE# #UNINDENT# #UNINDENT# run . start_spark_master ( r_master , sp_home )