'Reload the agent configuration and checksd configurations.
Can also reload only an explicit set of checks.'

def reload_configs(self, checks_to_reload=set()):

    log.info('Attempting    a    configuration    reload...')
    hostname = get_hostname(self._agentConfig)
    jmx_sd_configs = None
    if (not checks_to_reload):
        log.debug('No    check    list    was    passed,    reloading    every    check')
        for check in self._checksd.get('initialized_checks', []):
            check.stop()
        self._checksd = load_check_directory(self._agentConfig, hostname)
        if self._jmx_service_discovery_enabled:
            jmx_sd_configs = generate_jmx_configs(self._agentConfig, hostname)
    else:
        new_checksd = copy(self._checksd)
        all_jmx_checks = get_jmx_checks(auto_conf=True)
        jmx_checks = [check for check in checks_to_reload if (check in all_jmx_checks)]
        py_checks = (set(checks_to_reload) - set(jmx_checks))
        self.refresh_specific_checks(hostname, new_checksd, py_checks)
        if self._jmx_service_discovery_enabled:
            jmx_sd_configs = generate_jmx_configs(self._agentConfig, hostname, jmx_checks)
        self._checksd = new_checksd
    if jmx_sd_configs:
        self._submit_jmx_service_discovery(jmx_sd_configs)
    num_checks = len(self._checksd['initialized_checks'])
    if (num_checks > 0):
        opt_msg = (('    (refreshed    %s    checks)' % len(checks_to_reload)) if checks_to_reload else '')
        msg = 'Check    reload    was    successful.    Running    {num_checks}    checks{opt_msg}.'.format(num_checks=num_checks, opt_msg=opt_msg)
        log.info(msg)
    else:
        log.info('No    checksd    configs    found')
