Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
S
SMART
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
3
Issues
3
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
UNI-KLU
SMART
Commits
3acc11bc
Commit
3acc11bc
authored
Sep 02, 2020
by
Manuel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
roleStage: use-cases now get fetched from the server
parent
b56119fa
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
39 additions
and
16 deletions
+39
-16
fetching.py
...iscovery-microservice/app/processing/fetching/fetching.py
+38
-15
run_node_fetching.py
...ole-stage-discovery-microservice/app/run_node_fetching.py
+1
-1
No files found.
src/data-hub/role-stage-discovery-microservice/app/processing/fetching/fetching.py
View file @
3acc11bc
...
...
@@ -55,7 +55,30 @@ def _fetch_nodes(use_case: str, layer: Layer) -> List[Dict]:
return
nodes
def
fetch_nodes_from_semantic_linking
(
use_case
:
str
):
def
_fetch_use_cases
()
->
List
[
str
]:
# fetch use-cases
jwt
=
TokenManager
.
getInstance
()
.
getToken
()
url
=
f
'https://{network_constants.BUSINESS_LOGIC_HOSTNAME}:{network_constants.BUSINESS_LOGIC_REST_PORT}/api/use-cases'
response
=
requests
.
get
(
url
,
verify
=
False
,
proxies
=
{
"http"
:
None
,
"https"
:
None
},
headers
=
{
"Authorization"
:
f
"Bearer {jwt}"
}
)
if
response
.
status_code
!=
200
:
raise
ConnectionError
(
f
"Could not fetch data from the server, statuscode: {response.status_code}!"
)
data
=
json
.
loads
(
response
.
text
)
return
[
row
[
"name"
]
for
row
in
data
]
def
fetch_nodes_from_semantic_linking
():
use_cases
=
_fetch_use_cases
()
for
use_case
in
use_cases
:
# prune DB
repository
=
Repository
()
repository
.
delete_all_layers
()
...
...
src/data-hub/role-stage-discovery-microservice/app/run_node_fetching.py
View file @
3acc11bc
...
...
@@ -10,4 +10,4 @@ import processing.fetching.fetching as f
if
__name__
==
"__main__"
:
# TODO read use_case from somewhere
f
.
fetch_nodes_from_semantic_linking
(
"smart-energy"
)
\ No newline at end of file
f
.
fetch_nodes_from_semantic_linking
()
\ No newline at end of file
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