Example #1
0
    def _request(self, method, action, params, retry_count=0, **kwargs):
        if retry_count > 24:
            raise ae.ACOSUnknownError()

        try:
            return self.client.http.request(method, self.url(action), params,
                                            self.auth_header, **kwargs)
        except (ae.InvalidSessionID, ae.ConfigManagerNotReady) as e:
            if type(e) == ae.ConfigManagerNotReady:
                retry_limit = 24
                sleep_secs = 5
            else:
                retry_limit = 5
                sleep_secs = 1.0

            if retry_count < retry_limit:
                time.sleep(sleep_secs)
                try:
                    p = self.client.current_partition
                    self.client.session.close()
                    self.client.partition.active(p)
                except Exception:
                    pass
                return self._request(method, action, params, retry_count + 1,
                                     **kwargs)
            raise e
Example #2
0
    def _request(self, method, action, params, retry_count=0, **kwargs):
        if retry_count > 6:
            raise acos_errors.ACOSUnknownError()

        try:
            return self.client.http.request(method, self.url(action), params,
                                            **kwargs)
        except acos_errors.MemoryFault as e:
            if retry_count < 5:
                time.sleep(0.1)
                return self._request(method, action, params, retry_count + 1,
                                     **kwargs)
            raise e
        except acos_errors.InvalidSessionID as e:
            if retry_count < 5:
                time.sleep(0.1)
                try:
                    p = self.client.current_partition
                    self.client.session.close()
                    self.client.partition.active(p)
                except Exception:
                    pass
                return self._request(method, action, params, retry_count + 1,
                                     **kwargs)
            raise e