Skip to content

Commit 03b9895

Browse files
authored
Merge pull request #32 from dwolfson/v.5.0
V.5.5.10 - minor updates
2 parents a763beb + 9bac970 commit 03b9895

27 files changed

+2697
-157
lines changed

examples/Coco_config/config_coco_datalake.py

Lines changed: 415 additions & 0 deletions
Large diffs are not rendered by default.

examples/Coco_config/start_all_coco.py

Lines changed: 0 additions & 9 deletions
This file was deleted.
File renamed without changes.
File renamed without changes.

examples/Coco_config/config_cocoMDS1.py renamed to examples/coco_config/config_cocoMDS1.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212
import json
1313

14-
from globals import (adminUserId, cocoMDS1Name, dataLakePlatformURL, cocoCohort)
14+
from globals import (adminUserId, cocoMDS1Name, dataLakePlatformURL, cocoCohort, adminUserId)
1515
from pyegeria import CoreServerConfig, Platform
1616
from pyegeria import (
1717
print_exception_response,
Lines changed: 239 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,239 @@
1+
#!/usr/bin/env python3
2+
"""
3+
SPDX-License-Identifier: Apache-2.0
4+
Copyright Contributors to the ODPi Egeria project.
5+
6+
7+
8+
Egeria Coco Pharmaceutical demonstration labs.
9+
10+
This script creates and configures the cocoMDS2 - Governance metadata server
11+
12+
13+
"""
14+
15+
16+
import json
17+
import argparse
18+
from datetime import datetime
19+
20+
from globals import (cocoMDS2Name, corePlatformURL, cocoCohort, devCohort, iotCohort, max_paging_size, adminUserId,
21+
cocoMDS5Name, cocoMDS6Name)
22+
from pyegeria import CoreServerConfig, Platform
23+
from pyegeria import (
24+
print_exception_response,
25+
)
26+
27+
28+
def config_coco_core(url: str, userid: str):
29+
disable_ssl_warnings = True
30+
print("Configuring and activating the Datalake")
31+
platform_url = url
32+
admin_user = userid
33+
34+
# event_bus_config = {
35+
# "producer": {
36+
# "bootstrap.servers": "{{kafkaEndpoint}}"
37+
# },
38+
# "consumer": {
39+
# "bootstrap.servers": "{{kafkaEndpoint}}"
40+
# }
41+
# }
42+
event_bus_config = {
43+
"producer": {
44+
"bootstrap.servers": "host.docker.internal:9192"
45+
},
46+
"consumer": {
47+
"bootstrap.servers": "host.docker.internal:9192"
48+
}
49+
}
50+
51+
security_connection_body = {
52+
"class": "Connection",
53+
"connectorType": {
54+
"class": "ConnectorType",
55+
"connectorProviderClassName":
56+
"org.odpi.openmetadata.metadatasecurity.samples.CocoPharmaServerSecurityProvider"
57+
}
58+
}
59+
60+
#
61+
# Configure MDS2
62+
#
63+
mdr_server = cocoMDS2Name
64+
mdr_server_user_id = "cocoMDS2npa"
65+
mdr_server_password = "cocoMDS2passw0rd"
66+
metadataCollectionId = f"{mdr_server}-e915f2fa-aa3g-4396-8bde-bcd65e642b1d"
67+
metadataCollectionName = "Governance Catalog"
68+
69+
70+
try:
71+
o_client = CoreServerConfig(mdr_server, platform_url, admin_user)
72+
73+
o_client.set_basic_server_properties("Governance Server",
74+
"Coco Pharmaceuticals",
75+
platform_url,
76+
mdr_server_user_id, mdr_server_password,
77+
max_paging_size)
78+
79+
o_client.set_event_bus(event_bus_config)
80+
o_client.set_server_security_connection(security_connection_body)
81+
o_client.add_default_log_destinations()
82+
83+
# o_client.set_in_mem_local_repository()
84+
o_client.set_xtdb_local_kv_repository()
85+
86+
o_client.set_local_metadata_collection_id(metadataCollectionId)
87+
o_client.set_local_metadata_collection_name(metadataCollectionName)
88+
89+
o_client.add_cohort_registration(cocoCohort)
90+
o_client.add_cohort_registration(devCohort)
91+
o_client.add_cohort_registration(iotCohort)
92+
93+
# o_client.configure_access_service("asset-catalog", {})
94+
o_client.configure_access_service("asset-consumer", {})
95+
96+
o_client.configure_access_service("asset-owner", {})
97+
o_client.configure_access_service("community-profile",
98+
{"KarmaPointPlateau": "500"})
99+
# o_client.configure_access_service("glossary-view", {})
100+
# o_client.configure_access_service("subject-area", {})
101+
o_client.configure_access_service("governance-engine", {})
102+
o_client.configure_access_service("governance-server", {})
103+
o_client.configure_access_service("governance-program", {})
104+
# o_client.configure_access_service("data-privacy", {})
105+
o_client.configure_access_service("digital-architecture", {})
106+
o_client.configure_access_service("security-manager", {})
107+
o_client.configure_access_service("asset-lineage", {})
108+
o_client.configure_access_service("it-infrastructure", {})
109+
o_client.configure_access_service("project-management", {})
110+
print(f"Activating {mdr_server}")
111+
p_client = Platform(mdr_server, platform_url, admin_user)
112+
p_client.activate_server_stored_config()
113+
print(f"{mdr_server} activated")
114+
except Exception as e:
115+
print_exception_response(e)
116+
#
117+
# Configure MDS5
118+
#
119+
disable_ssl_warnings = True
120+
121+
mdr_server = cocoMDS5Name
122+
mdr_server_user_id = "cocoMDS5npa"
123+
mdr_server_password = "cocoMDS5passw0rd"
124+
metadataCollectionId = f"{mdr_server}-e915f2fa-aa3g-4396-8bde-bcd65e642b1d"
125+
metadataCollectionName = "Business Systems Catalog"
126+
127+
print("Configuring " + mdr_server + "...")
128+
try:
129+
o_client = CoreServerConfig(mdr_server, platform_url, admin_user)
130+
131+
o_client.set_basic_server_properties("Business Systems",
132+
"Coco Pharmaceuticals",
133+
platform_url,
134+
mdr_server_user_id, mdr_server_password,
135+
max_paging_size)
136+
137+
o_client.set_event_bus(event_bus_config)
138+
o_client.set_server_security_connection(security_connection_body)
139+
o_client.add_default_log_destinations()
140+
141+
# o_client.set_in_mem_local_repository()
142+
o_client.set_xtdb_local_kv_repository()
143+
144+
o_client.set_local_metadata_collection_id(metadataCollectionId)
145+
o_client.set_local_metadata_collection_name(metadataCollectionName)
146+
147+
o_client.add_cohort_registration(cocoCohort)
148+
149+
proxy_details = ("org.odpi.openmetadata.adapters.repositoryservices.readonly.repositoryconnector." +
150+
"ReadOnlyOMRSRepositoryConnectorProvider")
151+
o_client.set_repository_proxy_details(proxy_details)
152+
print(f"Activating {mdr_server}")
153+
p_client = Platform(mdr_server, platform_url, admin_user)
154+
p_client.activate_server_stored_config()
155+
print(f"{mdr_server} activated")
156+
except Exception as e:
157+
print_exception_response(e)
158+
159+
#
160+
# Configure MDS6
161+
#
162+
disable_ssl_warnings = True
163+
164+
mdr_server = cocoMDS6Name
165+
platform_url = corePlatformURL
166+
admin_user = "garygeeke"
167+
mdr_server_user_id = "cocoMDS6npa"
168+
mdr_server_password = "cocoMDS6passw0rd"
169+
metadataCollectionId = f"{mdr_server}-e915f2fa-aa3g-4396-8bde-bcd65e642b1d"
170+
metadataCollectionName = "Manufacturing Catalog"
171+
172+
print("Configuring " + mdr_server + "...")
173+
174+
try:
175+
o_client = CoreServerConfig(mdr_server, platform_url, admin_user)
176+
177+
o_client.set_basic_server_properties("Manufacturing",
178+
"Coco Pharmaceuticals",
179+
platform_url,
180+
mdr_server_user_id, mdr_server_password,
181+
max_paging_size)
182+
183+
o_client.set_event_bus(event_bus_config)
184+
185+
o_client.set_server_security_connection(security_connection_body)
186+
o_client.add_default_log_destinations()
187+
188+
# o_client.set_in_mem_local_repository()
189+
o_client.set_xtdb_local_kv_repository()
190+
191+
o_client.set_local_metadata_collection_id(metadataCollectionId)
192+
o_client.set_local_metadata_collection_name(metadataCollectionName)
193+
194+
o_client.add_cohort_registration(cocoCohort)
195+
o_client.add_cohort_registration(iotCohort)
196+
197+
access_service_options = {
198+
"SupportedZones": ["manufacturing"],
199+
"DefaultZones": ["manufacturing"]
200+
}
201+
202+
# o_client.configure_access_service("asset-catalog", access_service_options)
203+
o_client.configure_access_service("asset-consumer", access_service_options)
204+
o_client.configure_access_service("asset-owner", access_service_options)
205+
o_client.configure_access_service("community-profile",
206+
{"KarmaPointPlateau": "500"})
207+
# o_client.configure_access_service("glossary-view", {})
208+
o_client.configure_access_service("data-science", access_service_options)
209+
# o_client.configure_access_service("subject-area", {})
210+
o_client.configure_access_service("asset-manager", access_service_options)
211+
o_client.configure_access_service("governance-engine", access_service_options)
212+
o_client.configure_access_service("governance-server", access_service_options)
213+
o_client.configure_access_service("asset-owner", access_service_options)
214+
# o_client.configure_access_service("data-engine", access_service_options)
215+
o_client.configure_access_service("data-manager", access_service_options)
216+
o_client.configure_access_service("it-infrastructure", access_service_options)
217+
o_client.configure_access_service("project-management", access_service_options)
218+
219+
print(f"Activating {mdr_server}")
220+
p_client = Platform(mdr_server, platform_url, admin_user)
221+
p_client.activate_server_stored_config()
222+
print(f"{mdr_server} activated")
223+
except Exception as e:
224+
print_exception_response(e)
225+
226+
def main():
227+
parser = argparse.ArgumentParser()
228+
229+
parser.add_argument("--url", help="URL Platform to connect to")
230+
parser.add_argument("--userid", help="User Id")
231+
args = parser.parse_args()
232+
233+
url = args.url if args.url is not None else corePlatformURL
234+
userid = args.userid if args.userid is not None else adminUserId
235+
236+
config_coco_core(url, userid)
237+
238+
if __name__ == "__main__":
239+
main()

examples/widgets/catalog_user/view_asset_graph.py

Lines changed: 27 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,9 @@ def build_classifications(classification: dict) -> Markdown:
4747
c_type = c["classificationName"]
4848
if c_type == "Anchors":
4949
continue
50-
class_md += f"* Classification: {c_type}\n"
50+
class_md += f"\n* Classification: {c_type}\n"
5151
class_props = c.get("classificationProperties","---")
52-
if type(class_props) is list:
52+
if type(class_props) is dict:
5353
for prop in class_props.keys():
5454
class_md += f"\t* {prop}: {class_props[prop]}\n"
5555
if class_md == "":
@@ -70,14 +70,15 @@ def build_nested_elements(nested_element: dict) -> Markdown:
7070
ne_classifications = nested_element["classifications"]
7171
ne_class_md = build_classifications(ne_classifications)
7272
# ne_class_md = " " if ne_class_md is None else ne_class_md
73-
ne_props = nested_element["properties"]
74-
75-
ne_prop_md = ""
76-
for prop in ne_props.keys():
77-
ne_prop_md += f"* {prop}: {ne_props[prop]}\n"
73+
ne_props = nested_element.get("properties","---")
74+
ne_prop_md = "\n"
75+
if type(ne_props) is dict:
76+
for prop in ne_props.keys():
77+
ne_prop_md += f"\t* {prop}: {ne_props[prop]}\n"
7878
ne_md = (f"Nested Element of Type: {ne_type} with GUID: {ne_guid} \n "
7979
f"* created by {ne_created_by} at time {ne_created_at}\n"
80-
f"{ne_prop_md}\n")
80+
f"\n* Properties:\n{ne_prop_md}\n")
81+
8182
if ne_class_md is not None:
8283
ne_md += f"* {ne_class_md}"
8384

@@ -117,6 +118,8 @@ def build_nested_elements(nested_element: dict) -> Markdown:
117118
style = ""
118119

119120
asset_type = asset_graph["type"]["typeName"]
121+
asset_deployed_imp_type = asset_graph.get("deployedImplementationType","---")
122+
120123
asset_origin = asset_graph["origin"]["homeMetadataCollectionName"]
121124
asset_creation = asset_graph["versions"]["createTime"]
122125
asset_created_by = asset_graph["versions"]["createdBy"]
@@ -126,12 +129,15 @@ def build_nested_elements(nested_element: dict) -> Markdown:
126129
asset_class_md = build_classifications(asset_classifications)
127130

128131

129-
asset_properties = asset_graph["extendedProperties"]
130-
prop_md = "\n* Extended Properties:\n"
131-
for prop in asset_properties:
132-
prop_md = f"{prop_md}\n\t* {prop}: {asset_properties[prop]}\n"
133-
132+
asset_properties = asset_graph.get("extendedProperties",None)
133+
if asset_properties is not None:
134+
prop_md = "\n* Extended Properties:\n"
135+
for prop in asset_properties:
136+
prop_md = f"{prop_md}\n\t* {prop}: {asset_properties[prop]}\n"
137+
else:
138+
prop_md = ""
134139
core_md = (f"**Type: {asset_type} Created by: {asset_created_by} on {asset_creation}**\n"
140+
f"* Deployed Implementation Type: {asset_deployed_imp_type}\n"
135141
f"* Qualified Name: {qualified_name}\n "
136142
f"* Resource Name: {resource_name}\n"
137143
f"* Display Name: {asset_name}\n"
@@ -162,16 +168,16 @@ def build_nested_elements(nested_element: dict) -> Markdown:
162168
rel_end1 = relationship["end1"]
163169
rel_end1_type = rel_end1["type"]["typeName"]
164170
rel_end1_guid = rel_end1["guid"]
165-
rel_end1_unique_name = rel_end1["uniqueName"]
171+
rel_end1_unique_name = rel_end1.get("uniqueName","---")
166172

167173
rel_end2 = relationship["end2"]
168174
rel_end2_type = rel_end2["type"]["typeName"]
169175
rel_end2_guid = rel_end2["guid"]
170-
rel_end2_unique_name = rel_end2["uniqueName"]
176+
rel_end2_unique_name = rel_end2.get("uniqueName", "---")
171177

172178
if (rel_end1_guid not in guid_list) or (rel_end2_guid not in guid_list):
173-
rel_end1_class_md = build_classifications(rel_end1["classifications"])
174-
rel_end2_class_md = build_classifications(rel_end2["classifications"])
179+
# rel_end1_class_md = build_classifications(rel_end1["classifications"])
180+
# rel_end2_class_md = build_classifications(rel_end2["classifications"])
175181

176182
relationship_guid = relationship["guid"]
177183
relationship_type = relationship["type"]["typeName"]
@@ -196,8 +202,8 @@ def build_nested_elements(nested_element: dict) -> Markdown:
196202
f"\t* Unique Name: {rel_end1_unique_name}\n"
197203
)
198204

199-
if rel_end1_class_md is not None:
200-
rel_end1_md = rel_end1_class_md + rel_end1_md
205+
# if rel_end1_class_md is not None:
206+
# rel_end1_md = rel_end1_class_md + rel_end1_md
201207

202208
rel_end2_md = (
203209
f"* End2:\n"
@@ -206,8 +212,8 @@ def build_nested_elements(nested_element: dict) -> Markdown:
206212
f"\t* Unique Name: {rel_end2_unique_name}\n"
207213
)
208214

209-
if rel_end2_class_md is not None:
210-
rel_end1_md = rel_end2_class_md + rel_end1_md
215+
# if rel_end2_class_md is not None:
216+
# rel_end1_md = rel_end2_class_md + rel_end1_md
211217
#
212218
# for prop in relationship_properties.keys():
213219
# relationship_md += f"* {prop}: {relationship_properties[prop]}\n"

0 commit comments

Comments
 (0)