Commit a50c94cd authored by unknown's avatar unknown
Browse files

fetch building after updating it or after updating a facade

parent 5a11ae71
...@@ -124,6 +124,7 @@ class BuildingGeneric: ...@@ -124,6 +124,7 @@ class BuildingGeneric:
Note: the retries for conflict error are managed within BKC API Note: the retries for conflict error are managed within BKC API
""" """
self._req_with_retries("put", "/".join([self.settings.base_url, self._uid]), json=payload) self._req_with_retries("put", "/".join([self.settings.base_url, self._uid]), json=payload)
self.fetch()
def update_status_history(self, status: str, **kwargs) -> None: def update_status_history(self, status: str, **kwargs) -> None:
""" """
...@@ -136,9 +137,9 @@ class BuildingGeneric: ...@@ -136,9 +137,9 @@ class BuildingGeneric:
url = "/".join([self.settings.base_url, self._uid, "history"]) url = "/".join([self.settings.base_url, self._uid, "history"])
if self._building["operation_history"] is None: if self._building["operation_history"] is None:
return self._req_with_retries(method="put", url=url, json=payload, **kwargs) self._req_with_retries(method="put", url=url, json=payload, **kwargs)
elif status not in self._building["operation_history"]: elif status not in self._building["operation_history"]:
return self._req_with_retries(method="put", url=url, json=payload, **kwargs) self._req_with_retries(method="put", url=url, json=payload, **kwargs)
def register_error_for_building(self, error_code: str): def register_error_for_building(self, error_code: str):
""" """
...@@ -148,7 +149,8 @@ class BuildingGeneric: ...@@ -148,7 +149,8 @@ class BuildingGeneric:
url = "/".join([self.settings.base_url, self._uid, "errors"]) url = "/".join([self.settings.base_url, self._uid, "errors"])
payload = {"error_code": error_code} payload = {"error_code": error_code}
return self._req_with_retries(method="put", url=url, json=payload) self._req_with_retries(method="put", url=url, json=payload)
self.fetch()
def upload_metadata_for_building(self, name: str, payload: dict): def upload_metadata_for_building(self, name: str, payload: dict):
"""Upload the facade metadata to Hbase""" """Upload the facade metadata to Hbase"""
...@@ -250,11 +252,13 @@ class BuildingGeneric: ...@@ -250,11 +252,13 @@ class BuildingGeneric:
url = "/".join([self.settings.base_url, self._uid, "facade", facade_id, "errors"]) url = "/".join([self.settings.base_url, self._uid, "facade", facade_id, "errors"])
payload = {"error_code": error_code} payload = {"error_code": error_code}
return self._req_with_retries("put", url=url, json=payload) self._req_with_retries("put", url=url, json=payload)
self.fetch()
def update_facade(self, visible_facade_id, **kwargs) -> None: def update_facade(self, visible_facade_id, **kwargs) -> None:
url = "/".join([self.settings.base_url, self._uid, "facade", visible_facade_id]) url = "/".join([self.settings.base_url, self._uid, "facade", visible_facade_id])
self._req_with_retries("put", url=url, json=kwargs) self._req_with_retries("put", url=url, json=kwargs)
self.fetch()
@retry(stop_max_attempt_number=MAX_RETRIES, wait_fixed=WAIT_BETWEEN_RETRIES_IN_MS) @retry(stop_max_attempt_number=MAX_RETRIES, wait_fixed=WAIT_BETWEEN_RETRIES_IN_MS)
def update_facade_with_filtering(self, visible_facade_id, **kwargs) -> None: def update_facade_with_filtering(self, visible_facade_id, **kwargs) -> None:
...@@ -263,9 +267,9 @@ class BuildingGeneric: ...@@ -263,9 +267,9 @@ class BuildingGeneric:
The facade object is cleaned from null and None values The facade object is cleaned from null and None values
NOTE: NOTE: DEPRECATED
This method is deprecated since the visible facades now get updated from within the BKC API, not from the nodes This method is deprecated since the visible facades now get updated from within the BKC API, not from the nodes
Now replaced by update_facade method Now replaced by update_facade
""" """
self.fetch() self.fetch()
for f_index, facade in enumerate(self._building["facade"]): for f_index, facade in enumerate(self._building["facade"]):
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment