<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:

def pillar_refresh(self, force_refresh=False, notify=False):
        '''
        Refresh the pillar
        '''
        if self.connected:
            log.debug('Refreshing pillar. Notify: %s', notify)
            async_pillar = salt.pillar.get_async_pillar(
                self.opts,
                self.opts['grains'],
                self.opts['id'],
                self.opts['saltenv'],
                pillarenv=self.opts.get('pillarenv'),
            )
            try:
                self.opts['pillar'] = yield async_pillar.compile_pillar()
                if notify:
                    evt = salt.utils.event.get_event('minion', opts=self.opts, listen=False)
                    evt.fire_event({'complete': True}, tag=salt.defaults.events.MINION_PILLAR_COMPLETE)
            except SaltClientError:
                # Do not exit if a pillar refresh fails.
                log.error('Pillar data could not be refreshed. '
                          'One or more masters may be down!')
            finally:
                async_pillar.destroy()
        self.module_refresh(force_refresh, notify)
        self.matchers_refresh()
        self.beacons_refresh()