def METHOD_NAME(self, logger: Logger):
    # To avoid empty files uploaded for each rank.
    if self.rank_zero_only and dist.get_global_rank() != 0:
        return
    if self.writer is None:
        return
    # Skip if no writes occurred since last flush.
    if not self.writer.file_writer:
        return
    self.writer.flush()
    file_path = self.writer.file_writer.event_writer._file_name
    event_file_name = Path(file_path).stem
    logger.upload_file(remote_file_name=('tensorboard_logs/{run_name}/' +
                                         f'{event_file_name}-{dist.get_global_rank()}'),
                       file_path=file_path,
                       overwrite=True)
    # Close writer, which creates new log file.
    self.writer.close()