def create_tar_archive(self):
<EOL>EXCLUDE_FILES = glob.glob(os.path.join(self.savefolder, '<STR_LIT>'))<EOL>EXCLUDE_FILES += glob.glob(os.path.join(self.savefolder,<EOL>'<STR_LIT>', '<STR_LIT>'))<EOL>EXCLUDE_FILES += glob.glob(os.path.join(self.savefolder,<EOL>'<STR_LIT>'))<EOL>def filter_function(tarinfo):<EOL><INDENT>print(tarinfo.name)<EOL>if len([f for f in EXCLUDE_FILES if os.path.split(tarinfo.name)[-<NUM_LIT:1>]<EOL>in os.path.split(f)[-<NUM_LIT:1>]]) > <NUM_LIT:0> orlen([f for f in EXCLUDE_FILES if os.path.split(tarinfo.path)[-<NUM_LIT:1>]<EOL>in os.path.split(f)[-<NUM_LIT:1>]]) > <NUM_LIT:0>:<EOL><INDENT>print('<STR_LIT>' % tarinfo.name)<EOL>return None<EOL><DEDENT>else:<EOL><INDENT>return tarinfo<EOL><DEDENT><DEDENT>if RANK == <NUM_LIT:0>:<EOL><INDENT>print('<STR_LIT>' % (self.savefolder + '<STR_LIT>'))<EOL>f = tarfile.open(self.savefolder + '<STR_LIT>', '<STR_LIT:w>')<EOL>arcname = os.path.split(self.savefolder)[-<NUM_LIT:1>]<EOL>f.add(name=self.savefolder,<EOL>arcname=arcname,<EOL>filter=filter_function)<EOL>f.close()<EOL><DEDENT>COMM.Barrier()<EOL>
Create a tar archive of the main simulation outputs.