Repository: spotify/luigi
File: luigi/rpc.py (Python)

Code before:
    def __init__(self, url='http://localhost:8082/', connect_timeout=None):
        assert not url.startswith('http+unix://') or HAS_UNIX_SOCKET, (
            'You need to install requests-unixsocket for Unix socket support.'
        )

        self._url = url.rstrip('/')
        config = configuration.get_config()

        if connect_timeout is None:
            connect_timeout = config.getfloat('core', 'rpc-connect-timeout', 10.0)
        self._connect_timeout = connect_timeout

        self._rpc_retry_attempts = config.getint('core', 'rpc-retry-attempts', 3)
        self._rpc_retry_wait = config.getint('core', 'rpc-retry-wait', 30)
        self._rpc_log_retries = config.getboolean('core', 'rpc-log-retries', True)

        if HAS_REQUESTS:
            self._fetcher = RequestsFetcher(requests.Session())
        else:
            self._fetcher = URLLibFetcher()

    def _get_retryer(self):
        def retry_logging(retry_state):
            if self._rpc_log_retries:
                logger.warning("Failed connecting to remote scheduler %r", self._url, exc_info=True)
                logger.info("Retrying attempt %r of %r (max)" % (retry_state.attempt_number+1, self._rpc_retry_attempts))
                logger.info("Wait for %d seconds" % self._rpc_retry_wait)

        return Retrying(wait=wait_fixed(self._rpc_retry_wait),
                        stop=stop_after_attempt(self._rpc_retry_attempts),
                        reraise=True,
                        before=retry_logging)

    def _fetch(self, url_suffix, body):
        full_url = _urljoin(self._url, url_suffix)
        scheduler_retry = self._get_retryer()

        try:
            response = scheduler_retry(self._fetcher.fetch, full_url, body, self._connect_timeout)
        except self._fetcher.raises as e:
            raise RPCError(
                "Errors (%d attempts) when connecting to remote scheduler %r" %
                (self._rpc_retry_attempts, self._url),
                e
            )
        return response

    def _request(self, url, data, attempts=3, allow_null=True):
        body = {'data': json.dumps(data)}

        for _ in range(attempts):

Review comment (suggestion):
```suggestion
                logger.info("Retrying attempt %r of %r (max)" % (retry_state.attempt_number + 1, self._rpc_retry_attempts))
```
nit

Code after:
    def __init__(self, url='http://localhost:8082/', connect_timeout=None):
        assert not url.startswith('http+unix://') or HAS_UNIX_SOCKET, (
            'You need to install requests-unixsocket for Unix socket support.'
        )

        self._url = url.rstrip('/')
        config = configuration.get_config()

        if connect_timeout is None:
            connect_timeout = config.getfloat('core', 'rpc-connect-timeout', 10.0)
        self._connect_timeout = connect_timeout

        self._rpc_retry_attempts = config.getint('core', 'rpc-retry-attempts', 3)
        self._rpc_retry_wait = config.getint('core', 'rpc-retry-wait', 30)
        self._rpc_log_retries = config.getboolean('core', 'rpc-log-retries', True)

        if HAS_REQUESTS:
            self._fetcher = RequestsFetcher(requests.Session())
        else:
            self._fetcher = URLLibFetcher()

    def _get_retryer(self):
        def retry_logging(retry_state):
            if self._rpc_log_retries:
                logger.warning("Failed connecting to remote scheduler %r", self._url, exc_info=True)
                logger.info("Retrying attempt %r of %r (max)" % (retry_state.attempt_number + 1, self._rpc_retry_attempts))
                logger.info("Wait for %d seconds" % self._rpc_retry_wait)

        return Retrying(wait=wait_fixed(self._rpc_retry_wait),
                        stop=stop_after_attempt(self._rpc_retry_attempts),
                        reraise=True,
                        after=retry_logging)

    def _fetch(self, url_suffix, body):
        full_url = _urljoin(self._url, url_suffix)
        scheduler_retry = self._get_retryer()

        try:
            response = scheduler_retry(self._fetcher.fetch, full_url, body, self._connect_timeout)
        except self._fetcher.raises as e:
            raise RPCError(
                "Errors (%d attempts) when connecting to remote scheduler %r" %
                (self._rpc_retry_attempts, self._url),
                e
            )
        return response

    def _request(self, url, data, attempts=3, allow_null=True):
        body = {'data': json.dumps(data)}

        for _ in range(attempts):