<s> """<STR_LIT>""" <EOL> import os . path <EOL> import tarfile <EOL> from pyproct . postprocess . actions . representatives import save_cluster_elements <EOL> class SaveAllClustersPostAction ( object ) : <EOL> KEYWORD = "<STR_LIT>" <EOL> def __init__ ( self ) : <EOL> pass <EOL> def run ( self , clustering , postprocessing_parameters , data_handler , workspaceHandler , matrixHandler , generatedFiles ) : <EOL> results_place = workspaceHandler [ "<STR_LIT>" ] <EOL> clusters_place = workspaceHandler [ "<STR_LIT>" ] <EOL> cluster_files = [ ] <EOL> for cluster in clustering . clusters : <EOL> output_path = os . path . join ( clusters_place , <EOL> "<STR_LIT>" % ( cluster . id ) ) <EOL> save_cluster_elements ( cluster . all_elements , <EOL> [ cluster . id ] * len ( cluster . all_elements ) , <EOL> output_path , <EOL> data_handler , <EOL> postprocessing_parameters ) <EOL> cluster_files . append ( output_path ) <EOL> tar_path = os . path . join ( results_place , <EOL> "<STR_LIT>" ) <EOL> tar = tarfile . open ( tar_path , "<STR_LIT>" ) <EOL> for comp_file in cluster_files : <EOL> tar . add ( comp_file , os . path . basename ( comp_file ) ) <EOL> tar . close ( ) <EOL> generatedFiles . append ( { <EOL> "<STR_LIT:description>" : "<STR_LIT>" , <EOL> "<STR_LIT:path>" : os . path . abspath ( tar_path ) , <EOL> "<STR_LIT:type>" : "<STR_LIT>" <EOL> } ) </s>
