pyegeria 0.4.0__py3-none-any.whl → 0.5.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (71) hide show
  1. examples/widgets/catalog_user/README.md +15 -0
  2. examples/widgets/catalog_user/__init__.py +10 -0
  3. {pyegeria-0.4.0.data/scripts → examples/widgets/catalog_user}/list_assets.py +2 -2
  4. {pyegeria-0.4.0.data/scripts → examples/widgets/catalog_user}/view_asset_graph.py +45 -37
  5. {pyegeria-0.4.0.data/scripts → examples/widgets/catalog_user}/view_collection.py +1 -1
  6. {pyegeria-0.4.0.data/scripts → examples/widgets/catalog_user}/view_glossary.py +1 -1
  7. examples/widgets/developer/README.md +24 -0
  8. examples/widgets/developer/__init__.py +0 -0
  9. {pyegeria-0.4.0.data/scripts → examples/widgets/developer}/get_guid_info.py +1 -1
  10. {pyegeria-0.4.0.data/scripts → examples/widgets/developer}/get_tech_details.py +1 -1
  11. {pyegeria-0.4.0.data/scripts → examples/widgets/developer}/list_asset_types.py +1 -1
  12. {pyegeria-0.4.0.data/scripts → examples/widgets/developer}/list_registered_services.py +1 -1
  13. {pyegeria-0.4.0.data/scripts → examples/widgets/developer}/list_relationship_types.py +1 -1
  14. {pyegeria-0.4.0.data/scripts → examples/widgets/developer}/list_tech_templates.py +0 -0
  15. {pyegeria-0.4.0.data/scripts → examples/widgets/developer}/list_tech_types.py +1 -1
  16. {pyegeria-0.4.0.data/scripts → examples/widgets/developer}/list_valid_metadata_values.py +1 -1
  17. examples/widgets/operational/README.md +24 -0
  18. examples/widgets/operational/__init__.py +0 -0
  19. {pyegeria-0.4.0.data/scripts → examples/widgets/operational}/get_tech_type_elements.py +1 -1
  20. {pyegeria-0.4.0.data/scripts → examples/widgets/operational}/get_tech_type_template.py +1 -1
  21. examples/widgets/operational/view_asset_events.py +77 -0
  22. {pyegeria-0.4.0.data/scripts → examples/widgets/operational}/view_coco_status.py +11 -10
  23. {pyegeria-0.4.0.data/scripts → examples/widgets/operational}/view_eng_action_status.py +1 -1
  24. {pyegeria-0.4.0.data/scripts → examples/widgets/operational}/view_gov_eng_status.py +1 -1
  25. {pyegeria-0.4.0.data/scripts → examples/widgets/operational}/view_integ_daemon_status.py +46 -24
  26. {pyegeria-0.4.0.data/scripts → examples/widgets/operational}/view_platform_status.py +1 -1
  27. {pyegeria-0.4.0.data/scripts → examples/widgets/operational}/view_server_list.py +1 -1
  28. {pyegeria-0.4.0.data/scripts → examples/widgets/operational}/view_server_status.py +3 -5
  29. examples/widgets/personal_organizer/README.md +17 -0
  30. examples/widgets/personal_organizer/__init__.py +0 -0
  31. {pyegeria-0.4.0.data/scripts → examples/widgets/personal_organizer}/get_my_profile.py +1 -1
  32. {pyegeria-0.4.0.data/scripts → examples/widgets/personal_organizer}/list_projects.py +1 -1
  33. {pyegeria-0.4.0.data/scripts → examples/widgets/personal_organizer}/list_todos.py +1 -1
  34. {pyegeria-0.4.0.data/scripts → examples/widgets/personal_organizer}/view_my_todos.py +1 -1
  35. {pyegeria-0.4.0.data/scripts → examples/widgets/personal_organizer}/view_open_todos.py +1 -1
  36. {pyegeria-0.4.0.dist-info → pyegeria-0.5.0.dist-info}/METADATA +16 -16
  37. pyegeria-0.5.0.dist-info/RECORD +66 -0
  38. {pyegeria-0.4.0.dist-info → pyegeria-0.5.0.dist-info}/WHEEL +1 -2
  39. pyegeria-0.5.0.dist-info/entry_points.txt +5 -0
  40. {pyegeria → src/pyegeria}/automated_curation_omvs.py +6 -6
  41. src/pyegeria/config.toml +11 -0
  42. src/pyegeria/core_guids.py +121 -0
  43. {pyegeria → src/pyegeria}/core_omag_server_config.py +1 -1
  44. pyegeria/core_guids.py +0 -128
  45. pyegeria-0.4.0.data/scripts/Create_Collection_Sample.py +0 -292
  46. pyegeria-0.4.0.data/scripts/Create_Sustainability_Collection_Sample.py +0 -115
  47. pyegeria-0.4.0.dist-info/RECORD +0 -58
  48. pyegeria-0.4.0.dist-info/top_level.txt +0 -1
  49. {pyegeria-0.4.0.dist-info → pyegeria-0.5.0.dist-info}/LICENSE +0 -0
  50. {pyegeria → src/pyegeria}/Xfeedback_manager_omvs.py +0 -0
  51. {pyegeria → src/pyegeria}/Xloaded_resources_omvs.py +0 -0
  52. {pyegeria → src/pyegeria}/__init__.py +0 -0
  53. {pyegeria → src/pyegeria}/_client.py +0 -0
  54. {pyegeria → src/pyegeria}/_deprecated_gov_engine.py +0 -0
  55. {pyegeria → src/pyegeria}/_exceptions.py +0 -0
  56. {pyegeria → src/pyegeria}/_globals.py +0 -0
  57. {pyegeria → src/pyegeria}/_validators.py +0 -0
  58. {pyegeria → src/pyegeria}/action_author_omvs.py +0 -0
  59. {pyegeria → src/pyegeria}/asset_catalog_omvs.py +0 -0
  60. {pyegeria → src/pyegeria}/collection_manager_omvs.py +0 -0
  61. {pyegeria → src/pyegeria}/full_omag_server_config.py +0 -0
  62. {pyegeria → src/pyegeria}/glossary_browser_omvs.py +0 -0
  63. {pyegeria → src/pyegeria}/glossary_manager_omvs.py +0 -0
  64. {pyegeria → src/pyegeria}/my_profile_omvs.py +0 -0
  65. {pyegeria → src/pyegeria}/platform_services.py +0 -0
  66. {pyegeria → src/pyegeria}/project_manager_omvs.py +0 -0
  67. {pyegeria → src/pyegeria}/registered_info.py +0 -0
  68. {pyegeria → src/pyegeria}/runtime_manager_omvs.py +0 -0
  69. {pyegeria → src/pyegeria}/server_operations.py +0 -0
  70. {pyegeria → src/pyegeria}/utils.py +0 -0
  71. {pyegeria → src/pyegeria}/valid_metadata_omvs.py +0 -0
@@ -0,0 +1,15 @@
1
+ <!-- SPDX-License-Identifier: CC-BY-4.0 -->
2
+ <!-- Copyright Contributors to the Egeria project. -->
3
+
4
+ # Catalog User
5
+
6
+ These widgets display different kinds of information useful to a typical catalog user. Widgets
7
+ will continue to be added over time to cover more facets of catalog use.
8
+
9
+ * list_assets.py - lists assets containing the user provided search string in the display name or qualified name. Search string must be a minimum of three characters.
10
+ * view_asset_graph.py - shows a tree view of an asset with its nested elements and relationships.
11
+ * view_collection.py - provides a tree view of a collection with all nested collections and items within the collection.
12
+ * view_glossary.py - provides a simple glossary viewer showing terms and related information.
13
+ ----
14
+ License: [CC BY 4.0](https://creativecommons.org/licenses/by/4.0/),
15
+ Copyright Contributors to the Egeria project.
@@ -0,0 +1,10 @@
1
+ """
2
+ SPDX-License-Identifier: Apache-2.0
3
+ Copyright Contributors to the ODPi Egeria project.
4
+
5
+ catalog user widgets
6
+ """
7
+ import list_assets
8
+ import view_asset_graph
9
+ import view_glossary
10
+ import view_collection
@@ -1,4 +1,4 @@
1
- #!python
1
+ #!/usr/bin/env python3
2
2
  """
3
3
  SPDX-License-Identifier: Apache-2.0
4
4
  Copyright Contributors to the ODPi Egeria project.
@@ -79,7 +79,7 @@ def display_assets(search_string: str, guid: str=None, server: str = good_server
79
79
  table.add_column("Qualified Name")
80
80
 
81
81
 
82
- assets = g_client.find_assets_in_domain(search_string, starts_with=False,
82
+ assets = g_client.find_assets_in_domain(search_string, starts_with=True,
83
83
  ends_with=False, ignore_case=True, page_size=10)
84
84
  if type(assets) is str:
85
85
  return table
@@ -1,4 +1,4 @@
1
- #!python
1
+ #!/usr/bin/env python3
2
2
  """
3
3
  SPDX-License-Identifier: Apache-2.0
4
4
  Copyright Contributors to the ODPi Egeria project.
@@ -38,20 +38,21 @@ view_server = "view-server"
38
38
 
39
39
  guid_list = []
40
40
 
41
- def asset_viewer(asset_name: str, server_name:str, platform_url:str, user:str):
41
+ def asset_viewer(asset_guid: str, server_name:str, platform_url:str, user:str):
42
42
 
43
- def build_classifications(classification: dict) -> Markdown:
43
+ def build_classifications(classification: dict) -> str:
44
44
 
45
- class_md = "-"
45
+ class_md = ""
46
46
  for c in classification:
47
47
  c_type = c["classificationName"]
48
48
  if c_type == "Anchors":
49
49
  continue
50
50
  class_md += f"* Classification: {c_type}\n"
51
- class_props = c["classificationProperties"]
52
- for prop in class_props.keys():
53
- class_md += f"* {prop}: {class_props[prop]}\n"
54
- if class_md == "-":
51
+ class_props = c.get("classificationProperties","---")
52
+ if type(class_props) is dict:
53
+ for prop in class_props.keys():
54
+ class_md += f"\t* {prop}: {class_props[prop]}\n"
55
+ if class_md == "":
55
56
  output = None
56
57
  else:
57
58
  output = class_md
@@ -91,59 +92,66 @@ def asset_viewer(asset_name: str, server_name:str, platform_url:str, user:str):
91
92
  user_id=user)
92
93
 
93
94
  token = a_client.create_egeria_bearer_token(user, "secret")
94
- asset_info = a_client.find_assets_in_domain(asset_name)
95
- asset_guid = asset_info[0]['guid']
95
+ # asset_info = a_client.find_assets_in_domain(asset_name)
96
+ # if type(asset_info) is str:
97
+ # print("\n No Assets Found - Exiting\n")
98
+ # sys.exit(1)
99
+ #
100
+ # asset_guid = asset_info[0]['guid']
101
+
96
102
  guid_list.append(asset_guid)
97
103
 
98
104
  asset_graph = a_client.get_asset_graph(asset_guid)
99
105
  if type(asset_graph) is not dict:
100
- print(f"\n No Asset found for {asset_name}")
106
+ print(f"\n No Asset found for {asset_guid}")
101
107
  sys.exit(1)
102
108
 
103
109
  # print(f"\n{json.dumps(asset_graph, indent =2)}\n")
104
- tree = Tree(f"{asset_name} ({asset_guid})", style = "bold bright_white",guide_style="bold bright_blue")
105
- style = ""
110
+
106
111
 
107
112
  asset_name = asset_graph["displayName"]
108
113
  qualified_name = asset_graph["qualifiedName"]
109
114
  resource_name = asset_graph["resourceName"]
110
115
 
116
+ tree = Tree(f"{asset_name} ({asset_guid})", style="bold bright_white", guide_style="bold bright_blue")
117
+ style = ""
118
+
111
119
  asset_type = asset_graph["type"]["typeName"]
112
120
  asset_origin = asset_graph["origin"]["homeMetadataCollectionName"]
113
121
  asset_creation = asset_graph["versions"]["createTime"]
114
122
  asset_created_by = asset_graph["versions"]["createdBy"]
115
123
  asset_classifications = asset_graph["classifications"]
116
- asset_nested_elements = asset_graph["anchoredElements"]
124
+ asset_nested_elements = asset_graph.get("anchoredElements","----")
117
125
  asset_relationships = asset_graph["relationships"]
118
126
  asset_class_md = build_classifications(asset_classifications)
119
127
 
120
-
121
128
  asset_properties = asset_graph["extendedProperties"]
122
- prop_md = ""
129
+ prop_md = "\n* Extended Properties:\n"
123
130
  for prop in asset_properties:
124
- prop_md = f"{prop_md}* {prop}: {asset_properties[prop]}\n"
131
+ prop_md = f"{prop_md}\n\t* {prop}: {asset_properties[prop]}\n"
125
132
 
126
- core_md = (f"**Type: {asset_type} Created by: {asset_created_by} on {asset_creation}**\n"
133
+ core_md = (f"**Type: {asset_type} Created by: {asset_created_by} on {asset_creation}**\n"
127
134
  f"* Qualified Name: {qualified_name}\n "
128
135
  f"* Resource Name: {resource_name}\n"
129
136
  f"* Display Name: {asset_name}\n"
130
- f"* Asset Origin: {asset_origin}\n{prop_md}"
137
+ f"* Asset Origin: {asset_origin}\n{prop_md}\n"
131
138
  )
132
139
  core_md = Markdown(core_md)
133
140
  p1 = Panel.fit(core_md, style = "bold bright_white")
134
141
  l2 = tree.add(p1)
135
142
  if asset_class_md is not None:
136
- p2 = Panel.fit(Markdown(asset_class_md), style = "bold bright_white")
143
+ p2 = Panel.fit(Markdown(asset_class_md), style = "bold bright_white", title = "Classifications")
137
144
  l2 = tree.add(p2)
138
145
 
139
146
  #
140
147
  # Nested Assets
141
148
  #
142
- l2 = tree.add("Nested Elements", style = "bold white")
143
- for el in asset_nested_elements:
144
- asset_ne_md = build_nested_elements(el)
145
- p3 = Panel.fit(asset_ne_md, style = "bold bright_white", title="Nested Elements")
146
- l2.add(p3)
149
+ if type(asset_nested_elements) is list:
150
+ l2 = tree.add("Nested Elements", style = "bold white")
151
+ for el in asset_nested_elements:
152
+ asset_ne_md = build_nested_elements(el)
153
+ p3 = Panel.fit(asset_ne_md, style = "bold bright_white", title="Nested Elements")
154
+ l2.add(p3)
147
155
 
148
156
  #
149
157
  # Now work on the Relationships
@@ -168,7 +176,7 @@ def asset_viewer(asset_name: str, server_name:str, platform_url:str, user:str):
168
176
  relationship_type = relationship["type"]["typeName"]
169
177
  relationship_created_by = relationship["versions"]["createdBy"]
170
178
  relationship_creation_time = relationship["versions"]["createTime"]
171
- relationship_properties = relationship.get("properties"," ")
179
+ relationship_properties = relationship.get("properties","--- ")
172
180
  relationship_md = (f"Relationship Type {relationship_type}\n"
173
181
  f"* GUID: {relationship_guid}\n* Created by: {relationship_created_by} \n"
174
182
  f"* Creation Time: {relationship_creation_time}\n"
@@ -181,31 +189,31 @@ def asset_viewer(asset_name: str, server_name:str, platform_url:str, user:str):
181
189
  f"* Created by: {relationship_created_by} at time {relationship_creation_time}\n"
182
190
  )
183
191
  rel_end1_md = (
184
- f"* End1:\n"
185
- f"\t* Type: {rel_end1_type}\n"
192
+ f"\n**End1:**\n"
193
+ f"\n\t* Type: {rel_end1_type}\n"
186
194
  f"\t* GUID: {rel_end1_guid}\n"
187
195
  f"\t* Unique Name: {rel_end1_unique_name}\n"
188
196
  )
189
197
 
190
- if rel_end1_class_md is not None:
191
- rel_end1_md = rel_end1_md + rel_end1_class_md
198
+ # if rel_end1_class_md is not None:
199
+ # rel_end1_md = rel_end1_md + rel_end1_class_md
192
200
 
193
201
  rel_end2_md = (
194
- f"* End1:\n"
195
- f"\t* Type: {rel_end2_type}\n"
202
+ f"\n**End2:**\n"
203
+ f"\n\t* Type: {rel_end2_type}\n"
196
204
  f"\t* GUID: {rel_end2_guid}\n"
197
205
  f"\t* Unique Name: {rel_end2_unique_name}\n"
198
206
  )
199
207
 
200
- if rel_end2_class_md is not None:
201
- rel_end1_md = rel_end2_md + rel_end2_class_md
208
+ # if rel_end2_class_md is not None:
209
+ # rel_end1_md = rel_end1_md + rel_end2_class_md
202
210
  #
203
211
  # for prop in relationship_properties.keys():
204
212
  # relationship_md += f"* {prop}: {relationship_properties[prop]}\n"
205
213
 
206
214
  relationship_md += rel_end1_md + rel_end2_md
207
215
 
208
- relationship_panel = Panel.fit(Markdown(relationship_md), style="bold bright_white")
216
+ relationship_panel = Panel.fit(Markdown(relationship_md), style="bold bright_white", title = "Asset Relationships")
209
217
  tree.add(relationship_panel)
210
218
 
211
219
 
@@ -232,5 +240,5 @@ if __name__ == "__main__":
232
240
  url = args.url if args.url is not None else "https://localhost:9443"
233
241
  userid = args.userid if args.userid is not None else 'erinoverview'
234
242
 
235
- asset_name = Prompt.ask("Enter the Asset Name to view:", default="TransMorg-Clinical-Trials-Weeklies")
236
- asset_viewer(asset_name,server, url, userid)
243
+ asset_guid = Prompt.ask("Enter the Asset GUID to view:", default="8e35b39e-6ee7-4d60-aff5-4b09406c5e79")
244
+ asset_viewer(asset_guid,server, url, userid)
@@ -1,4 +1,4 @@
1
- #!python
1
+ #!/usr/bin/env python3
2
2
  """
3
3
  SPDX-License-Identifier: Apache-2.0
4
4
  Copyright Contributors to the ODPi Egeria project.
@@ -1,4 +1,4 @@
1
- #!python
1
+ #!/usr/bin/env python3
2
2
  """
3
3
  SPDX-License-Identifier: Apache-2.0
4
4
  Copyright Contributors to the ODPi Egeria project.
@@ -0,0 +1,24 @@
1
+ <!-- SPDX-License-Identifier: CC-BY-4.0 -->
2
+ <!-- Copyright Contributors to the Egeria project. -->
3
+
4
+ # Developer
5
+
6
+ These widgets display different kinds of information useful to developers. Widgets
7
+ will continue to be added over time to cover more facets. Useful developer information
8
+ can also be found on [Egeria Project](https://egeria-project.org) and in [Egeria Explorers](https://egeria-project.org/release-notes/june-2024/?h=brain#egeria-explorers).
9
+
10
+ * get_guid_info.py - lists information about the metadata element specified by the Egeria guid.
11
+ * get_tech_details.py - shows a tree view showing the Egeria support for a particular technology (e.g PostgreSQL Server).
12
+ * list_asset_types.py - provides a tree view of a collection with all nested collections and items within the collection.
13
+ * list_registered_services.py - lists the services available on an Egeria platform.
14
+ * list_relationship_types.py - list the relationships details for a specified Egeria type.
15
+ * list_tech_templates.py - list template details for technology types
16
+ * list_tech_types.py - list the technology types that Egeria currently supports
17
+ * list_valid_metadata_values.py - list valid metadata values for a particular property and category.
18
+
19
+
20
+
21
+
22
+ ----
23
+ License: [CC BY 4.0](https://creativecommons.org/licenses/by/4.0/),
24
+ Copyright Contributors to the Egeria project.
File without changes
@@ -1,4 +1,4 @@
1
- #!python
1
+ #!/usr/bin/env python3
2
2
  """
3
3
  SPDX-Lic
4
4
  ense-Identifier: Apache-2.0
@@ -1,4 +1,4 @@
1
- #!python
1
+ #!/usr/bin/env python3
2
2
  """
3
3
  SPDX-License-Identifier: Apache-2.0
4
4
  Copyright Contributors to the ODPi Egeria project.
@@ -1,4 +1,4 @@
1
- #!python
1
+ #!/usr/bin/env python3
2
2
  """
3
3
  SPDX-License-Identifier: Apache-2.0
4
4
  Copyright Contributors to the ODPi Egeria project.
@@ -1,4 +1,4 @@
1
- #!python
1
+ #!/usr/bin/env python3
2
2
  """
3
3
  SPDX-License-Identifier: Apache-2.0
4
4
  Copyright Contributors to the ODPi Egeria project.
@@ -1,4 +1,4 @@
1
- #!python
1
+ #!/usr/bin/env python3
2
2
  """
3
3
  SPDX-Lic
4
4
  ense-Identifier: Apache-2.0
@@ -1,4 +1,4 @@
1
- #!python
1
+ #!/usr/bin/env python3
2
2
  """
3
3
  SPDX-License-Identifier: Apache-2.0
4
4
  Copyright Contributors to the ODPi Egeria project.
@@ -1,4 +1,4 @@
1
- #!python
1
+ #!/usr/bin/env python3
2
2
  """
3
3
  SPDX-Lic
4
4
  ense-Identifier: Apache-2.0
@@ -0,0 +1,24 @@
1
+ <!-- SPDX-License-Identifier: CC-BY-4.0 -->
2
+ <!-- Copyright Contributors to the Egeria project. -->
3
+
4
+ # Operational
5
+
6
+ These widgets display different kinds of information useful to monitor the status of different elements of an Egeria deployment.
7
+ Widgets will continue to be added over time to cover more facets of catalog use.
8
+
9
+ * get_eng_action_status.py - lists assets containing the user provided search string in the display name or qualified name. Search string must be a minimum of three characters.
10
+ * get_tech_type_elements.py - shows a tree view for the details of a supported technology type.
11
+ * get_tech_type_template.py - shows a tree view of the template associated with a supported technology type.
12
+ * view_coco_status.py - provides a tree view of a collection with all nested collections and items within the collection.
13
+ * view_eng_action_status.py - provides a live view of the status of engine actions.
14
+ * view_gov_eng_status.py - provides a live view of a governance engine status.
15
+ * view_integ_daemeon_status.py - provides a live view of an integration daemon status.
16
+ * view_platform_status.py - provides a live status view of the known servers on known platforms.
17
+ * view_server_list.py - provides a more detailed live status view of the servers on a single platform.
18
+ * view_server_status.py - provides a minimal live status view of the servers on a single platform.
19
+ * view_asset_changes.py - experiment in progress
20
+ * view_asset_events.py - experiment in progress
21
+
22
+ ----
23
+ License: [CC BY 4.0](https://creativecommons.org/licenses/by/4.0/),
24
+ Copyright Contributors to the Egeria project.
File without changes
@@ -1,4 +1,4 @@
1
- #!python
1
+ #!/usr/bin/env python3
2
2
  """
3
3
  SPDX-License-Identifier: Apache-2.0
4
4
  Copyright Contributors to the ODPi Egeria project.
@@ -1,4 +1,4 @@
1
- #!python
1
+ #!/usr/bin/env python3
2
2
  """
3
3
  SPDX-License-Identifier: Apache-2.0
4
4
  Copyright Contributors to the ODPi Egeria project.
@@ -0,0 +1,77 @@
1
+ #!/usr/bin/env python3
2
+ """
3
+ SPDX-License-Identifier: Apache-2.0
4
+ Copyright Contributors to the ODPi Egeria project.
5
+
6
+ Display the status of cataloged platforms and servers.
7
+ """
8
+ import json
9
+ import sys
10
+ import time
11
+ import argparse
12
+ from confluent_kafka import Consumer, KafkaException
13
+ from datetime import datetime
14
+ from rich.prompt import Prompt
15
+ from rich.table import Table
16
+ from rich.live import Live
17
+ from rich.console import Console
18
+ from rich.markdown import Markdown
19
+
20
+ from pyegeria import RuntimeManager
21
+
22
+ disable_ssl_warnings = True
23
+ console = Console(width=200)
24
+ now = datetime.now()
25
+ current_time = now.strftime("%H:%M:%S")
26
+
27
+ from confluent_kafka import Consumer, KafkaException
28
+
29
+ earliest_latest = Prompt.ask("Msgs from earliest or latest:", default="earliest")
30
+
31
+ # Define the Kafka consumer configuration.
32
+ config = {
33
+ 'bootstrap.servers': 'localhost:9092', # replace with your Kafka broker(s)
34
+ 'group.id': f"view_asset_events:{current_time}", # replace with your consumer group
35
+ 'auto.offset.reset': earliest_latest # can be set to 'earliest' or 'latest'
36
+ }
37
+
38
+ # Initialize a Kafka consumer.
39
+ consumer = Consumer(config)
40
+
41
+ # Subscribe to a Kafka topic.
42
+ consumer.subscribe(['egeria.omag.server.active-metadata-store.omas.assetconsumer.outTopic']) # replace with your Kafka topic
43
+
44
+ try:
45
+ while True:
46
+ msg = consumer.poll(1.0) # timeout set to 1 second
47
+
48
+ if msg is None:
49
+ continue
50
+ elif msg.error():
51
+ raise KafkaException(msg.error())
52
+ else:
53
+ event = json.loads(msg.value())
54
+ event_time = event["eventTime"]
55
+ event_type = event["eventType"]
56
+ guid = event["elementHeader"]["guid"]
57
+
58
+ type_name = event["elementHeader"]["type"]["typeName"]
59
+ origin = event["elementHeader"]["origin"]["sourceServer"]
60
+
61
+ element_properties = event["elementProperties"]
62
+ element_properties_keys = element_properties.keys()
63
+ props = " "
64
+ for key in element_properties_keys:
65
+ value = element_properties[key]
66
+ props += f"* {key}: {value}\n"
67
+ console.rule(style= "[bold red]")
68
+ console.rule(f"\tMessage TimeStamp: {event_time}\t eventType: {event_type}\t typeName: {type_name}\t guid: {guid}")
69
+ msg = (
70
+
71
+ f"properties: \n{props}\n\n")
72
+ msg = Markdown(msg)
73
+
74
+ console.print(msg)
75
+ finally:
76
+ # Close down consumer to commit final offsets.
77
+ consumer.close()
@@ -1,4 +1,4 @@
1
- #!python
1
+ #!/usr/bin/python3
2
2
  """
3
3
  SPDX-License-Identifier: Apache-2.0
4
4
  Copyright Contributors to the ODPi Egeria project.
@@ -30,11 +30,9 @@ from pyegeria.server_operations import ServerOps
30
30
  disable_ssl_warnings = True
31
31
 
32
32
 
33
- def test_display_status(server: str, url: str, username: str):
33
+ def display_status(server: str, url: str, username: str):
34
34
  layout = Layout()
35
- print(layout)
36
35
 
37
- print(layout)
38
36
  p_client1 = ServerOps("Core Catalog", "https://localhost:9443", username)
39
37
  p_client2 = ServerOps('Datalake Catalog', "https://localhost:9444", username)
40
38
  p_client3 = ServerOps('DevCatalog', "https://localhost:9445", username)
@@ -42,19 +40,18 @@ def test_display_status(server: str, url: str, username: str):
42
40
  def generate_table(p_client) -> Table:
43
41
  """Make a new table."""
44
42
  table = Table(
45
- title=f"Server Status for Platform - {time.asctime()}",
43
+ title=f"Server Status for {p_client.server_name}- {time.asctime()}",
46
44
  # style = "black on grey66",
47
45
  header_style="white on dark_blue",
48
- caption=f"Server Status for Platform - '{url}'",
46
+ caption=f"Server Status for Platform - '{p_client.platform_url}'",
49
47
  # show_lines=True,
50
48
  )
51
49
 
52
50
  table.add_column("Known Server")
53
51
  table.add_column("Status")
54
-
55
52
  known_server_list = p_client.get_known_servers()
56
53
  active_server_list = p_client.get_active_server_list()
57
- if len(known_server_list) == 0:
54
+ if type(known_server_list) is str:
58
55
  return table
59
56
 
60
57
  for server in known_server_list:
@@ -83,6 +80,10 @@ def test_display_status(server: str, url: str, username: str):
83
80
  print_exception_response(e)
84
81
  assert e.related_http_code != "200", "Invalid parameters"
85
82
 
83
+ finally:
84
+ p_client1.close_session()
85
+ p_client2.close_session()
86
+ p_client3.close_session()
86
87
 
87
88
  if __name__ == "__main__":
88
89
  parser = argparse.ArgumentParser()
@@ -92,7 +93,7 @@ if __name__ == "__main__":
92
93
  args = parser.parse_args()
93
94
 
94
95
  server = args.server if args.server is not None else "active-metadata-store"
95
- url = args.url if args.url is not None else "https://cray.local:9443"
96
+ url = args.url if args.url is not None else "https://localhost:9443"
96
97
  userid = args.userid if args.userid is not None else 'garygeeke'
97
98
 
98
- test_display_status(server, url, userid)
99
+ display_status(server, url, userid)
@@ -1,4 +1,4 @@
1
- #!python
1
+ #!/usr/bin/env python3
2
2
  """
3
3
  SPDX-License-Identifier: Apache-2.0
4
4
  Copyright Contributors to the ODPi Egeria project.
@@ -1,4 +1,4 @@
1
- #!python
1
+ #!/usr/bin/env python3
2
2
  """
3
3
  SPDX-License-Identifier: Apache-2.0
4
4
  Copyright Contributors to the ODPi Egeria project.
@@ -1,4 +1,4 @@
1
- #!python
1
+ #!/usr/bin/env python3
2
2
  """
3
3
  SPDX-License-Identifier: Apache-2.0
4
4
  Copyright Contributors to the ODPi Egeria project.
@@ -19,6 +19,7 @@ from rich import box
19
19
  from rich.live import Live
20
20
  from rich.markdown import Markdown
21
21
  from rich.table import Table
22
+ from rich.text import Text
22
23
 
23
24
  from pyegeria import ServerOps, AutomatedCuration
24
25
  from pyegeria._exceptions import (
@@ -31,9 +32,10 @@ from pyegeria._exceptions import (
31
32
  disable_ssl_warnings = True
32
33
 
33
34
 
34
- def display_integration_daemon_status(server: str, url: str, user: str):
35
- s_client = ServerOps(server, url, user)
36
- a_client = AutomatedCuration("view-server", url, user, "secret")
35
+ def display_integration_daemon_status(integ_server: str, integ_url: str,
36
+ view_server:str, view_url: str, user: str):
37
+ s_client = ServerOps(integ_server, integ_url, user)
38
+ a_client = AutomatedCuration(view_server, view_url, user, "secret")
37
39
  token = a_client.create_egeria_bearer_token()
38
40
 
39
41
  def generate_table() -> Table:
@@ -44,14 +46,14 @@ def display_integration_daemon_status(server: str, url: str, user: str):
44
46
  header_style="white on dark_blue",
45
47
  show_lines=True,
46
48
  box=box.ROUNDED,
47
- caption=f"Integration Daemon Status for Server '{server}' @ Platform - {url}",
49
+ caption=f"Integration Daemon Status for Server '{integ_server}' @ Platform - {integ_url}",
48
50
  expand=True
49
51
  )
50
52
  table.add_column("Connector Name")
51
53
  table.add_column("Connector Status")
52
54
 
53
55
  table.add_column("Last Refresh Time")
54
- table.add_column("Minimum Refresh Interval (min)")
56
+ table.add_column("Min Refresh (min)")
55
57
  table.add_column("Target Element")
56
58
  table.add_column("Exception Message")
57
59
 
@@ -60,22 +62,35 @@ def display_integration_daemon_status(server: str, url: str, user: str):
60
62
  for connector in connector_reports:
61
63
  connector_name = connector.get("connectorName", "---")
62
64
  connector_status = connector.get("connectorStatus", "---")
63
- connector_guid = connector["connectorGUID"]
65
+ connector_guid = connector.get("connectorGUID","---")
64
66
  last_refresh_time = connector.get("lastRefreshTime", "---")
65
67
  refresh_interval = str(connector.get("minMinutesBetweenRefresh", "---"))
66
68
  exception_msg = " "
67
-
68
- targets = a_client.get_catalog_targets(connector_guid)
69
- if type(targets) == list:
70
- targets_m = "\n"
71
- for target in targets:
72
- t_name = target["catalogTargetName"]
73
- t_sync = target["permittedSynchronization"]
74
- t_unique_name = target["catalogTargetElement"]["uniqueName"]
75
- targets_m += f"* Target Name: __{t_name}__\n* Sync: {t_sync}\n* Unique Name: {t_unique_name}\n\n"
76
- targets_md = Markdown(targets_m)
69
+ if connector_guid != '---':
70
+ targets = a_client.get_catalog_targets(connector_guid)
71
+ tgt_tab = Table()
72
+ tgt_tab.add_column("Target")
73
+ tgt_tab.add_column("UniqueName")
74
+ tgt_tab.add_column("Relationship GUID", no_wrap=True)
75
+
76
+ if type(targets) == list:
77
+ targets_md = True
78
+ for target in targets:
79
+ t_name = target["catalogTargetName"]
80
+ # t_sync = target["permittedSynchronization"]
81
+ t_unique_name = target["catalogTargetElement"]["uniqueName"]
82
+ t_rel_guid = target["relationshipGUID"]
83
+ # targets_m += f"* Target Name: __{t_name}__\n* Sync: {t_sync}\n* Unique Name: {t_unique_name}\n\n"
84
+ tgt_tab.add_row(t_name,t_unique_name, t_rel_guid)
85
+ # targets_md = Markdown(targets_m)
86
+ else:
87
+ targets_md = False
88
+ else:
89
+ targets_md = False
90
+ if targets_md is False:
91
+ targets_out = ""
77
92
  else:
78
- targets_md = " "
93
+ targets_out = tgt_tab
79
94
 
80
95
  if connector_status in ("RUNNING", "REFRESHING", "WAITING"):
81
96
  connector_status = f"[green]{connector_status}"
@@ -86,7 +101,7 @@ def display_integration_daemon_status(server: str, url: str, user: str):
86
101
 
87
102
  table.add_row(
88
103
  connector_name, connector_status, last_refresh_time, refresh_interval,
89
- targets_md, exception_msg
104
+ targets_out, exception_msg
90
105
  )
91
106
  return table
92
107
 
@@ -103,16 +118,23 @@ def display_integration_daemon_status(server: str, url: str, user: str):
103
118
 
104
119
  finally:
105
120
  s_client.close_session()
121
+ a_client.close_session()
106
122
 
107
123
 
108
124
  if __name__ == "__main__":
109
125
  parser = argparse.ArgumentParser()
110
- parser.add_argument("--server", help="Name of the integration server to display status for")
111
- parser.add_argument("--url", help="URL Platform to connect to")
126
+ parser.add_argument("--integ_server", help="Name of the integration server to display status for")
127
+ parser.add_argument("--integ_url", help="URL Platform to connect to")
128
+ parser.add_argument("--view_server", help="Name of the integration server to display status for")
129
+ parser.add_argument("--view_url", help="URL Platform to connect to")
112
130
  parser.add_argument("--userid", help="User Id")
113
131
  args = parser.parse_args()
114
132
 
115
- server = args.server if args.server is not None else "integration-daemon"
116
- url = args.url if args.url is not None else "https://localhost:9443"
133
+ integ_server = args.integ_server if args.integ_server is not None else "integration-daemon"
134
+ integ_url = args.integ_url if args.integ_url is not None else "https://localhost:9443"
135
+ view_server = args.view_server if args.view_server is not None else "view-server"
136
+ view_url = args.view_url if args.view_url is not None else "https://localhost:9443"
117
137
  userid = args.userid if args.userid is not None else 'garygeeke'
118
- display_integration_daemon_status(server=server, url=url, user=userid)
138
+ display_integration_daemon_status(integ_server=integ_server, integ_url=integ_url,
139
+ view_server = view_server, view_url = view_url,
140
+ user=userid)