Esempio n. 1
0
    def _download_jobtype(cls, name, version):
        """
        Downloads the job type specified in ``assignment``.  This
        method will pass the response it receives to :meth:`_cache_jobtype`
        however failures will be retried.
        """
        logger.debug("Downloading job type %r version %s", name, version)
        url = str(cls.JOBTYPE_VERSION_URL % {"master_api": config["master_api"], "name": name, "version": version})

        result = Deferred()
        download = lambda *_: get(
            url, callback=result.callback, errback=lambda *_: reactor.callLater(http_retry_delay(), download)
        )
        download()
        return result
 def test_unknown_hostname(self):
     return get(self.HTTP_SCHEME + "://%s/" % os.urandom(8).encode("hex"),
                callback=lambda _: self.fail("Unexpected success"),
                errback=lambda failure:
                self.assertIs(failure.type, DNSLookupError))
 def get(self, url, **kwargs):
     return get(self.get_url(url), **kwargs)