Example #1
0
 def heartbeat(self):
     success = False
     for eureka_url in self.eureka_urls:
         try:
             r = requests.put(urljoin(eureka_url, "apps/%s/%s" % (self.app_name, self.get_instance_id())))
             r.raise_for_status()
             success = True
             break
         except (EurekaHTTPException, URLError) as e:
             pass
     if not success:
         raise EurekaHeartbeatFailedException("Did not receive correct reply from any instances")
Example #2
0
 def heartbeat(self):
     instance_id = self.host_name
     if self.data_center == "Amazon":
         instance_id = ec2metadata.get('instance-id')
     success = False
     for eureka_url in self.eureka_urls:
         try:
             r = requests.put(urljoin(eureka_url, "apps/%s/%s" % (self.app_name, instance_id)))
             r.raise_for_status()
             success = True
             break
         except (EurekaHTTPException, URLError) as e:
             pass
     if not success:
         raise EurekaHeartbeatFailedException("Did not receive correct reply from any instances")
Example #3
0
 def heartbeat(self):
     instance_id = self.host_name
     if self.data_center == "Amazon":
         instance_id = ec2metadata.get('instance-id')
     success = False
     for eureka_url in self.eureka_urls:
         try:
             r = requests.put(urljoin(eureka_url, "apps/%s/%s" % (self.app_name, instance_id)))
             r.raise_for_status()
             success = True
             break
         except (EurekaHTTPException, URLError) as e:
             pass
     if not success:
         raise EurekaHeartbeatFailedException("Did not receive correct reply from any instances")
Example #4
0
 def update_status(self, new_status):
     success = False
     for eureka_url in self.eureka_urls:
         try:
             r = requests.put(urljoin(eureka_url, "apps/%s/%s/status?value=%s" % (
                 self.app_name,
                 self.host_name,
                 new_status
             )))
             r.raise_for_status()
             success = True
             break
         except (EurekaHTTPException, URLError) as e:
             pass
     if not success:
         raise EurekaUpdateFailedException("Did not receive correct reply from any instances")
Example #5
0
 def update_status(self, new_status):
     success = False
     for eureka_url in self.eureka_urls:
         try:
             r = requests.put(
                 urljoin(
                     eureka_url, "apps/%s/%s/status?value=%s" %
                     (self.app_name, self.host_name, new_status)))
             r.raise_for_status()
             success = True
             break
         except (EurekaHTTPException, URLError) as e:
             pass
     if not success:
         raise EurekaUpdateFailedException(
             "Did not receive correct reply from any instances")
Example #6
0
 def update_status(self, new_status):
     instance_id = self.host_name
     if self.data_center == "Amazon":
         instance_id = ec2metadata.get('instance-id')
     success = False
     last_e = None
     for eureka_url in self.eureka_urls:
         try:
             r = requests.put(urljoin(eureka_url, "apps/%s/%s/status?value=%s" % (
                 self.app_name,
                 instance_id,
                 new_status
             )))
             r.raise_for_status()
             success = True
             break
         except (EurekaHTTPException, URLError) as e:
             last_e = e
     if not success:
         raise EurekaUpdateFailedException("Did not receive correct reply from any instances, last error: " + str(e))
 def update_status(self, new_status):
     instance_id = self.host_name
     if self.data_center == "Amazon":
         instance_id = ec2metadata.get('instance-id')
     success = False
     last_e = None
     for eureka_url in self.eureka_urls:
         try:
             r = requests.put(urljoin(eureka_url, "apps/%s/%s/status?value=%s" % (
                 self.app_name,
                 instance_id,
                 new_status
             )))
             r.raise_for_status()
             success = True
             break
         except (EurekaHTTPException, URLError) as e:
             last_e = e
     if not success:
         raise EurekaUpdateFailedException("Did not receive correct reply from any instances, last error: " + str(e))