Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
production
building-knowledge-centre
building-dao
Commits
a50c94cd
Commit
a50c94cd
authored
Nov 17, 2020
by
unknown
Browse files
fetch building after updating it or after updating a facade
parent
5a11ae71
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
6 deletions
+10
-6
building_dao/building_generic.py
building_dao/building_generic.py
+10
-6
No files found.
building_dao/building_generic.py
View file @
a50c94cd
...
@@ -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"
]):
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment