pyegeria 0.3.8__py3-none-any.whl → 0.4.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 (59) hide show
  1. pyegeria/Xfeedback_manager_omvs.py +238 -0
  2. pyegeria/Xloaded_resources_omvs.py +91 -0
  3. pyegeria/__init__.py +15 -12
  4. pyegeria/_client.py +4 -6
  5. pyegeria/{gov_engine.py → _deprecated_gov_engine.py} +2 -59
  6. pyegeria/_exceptions.py +5 -6
  7. pyegeria/_globals.py +3 -1
  8. pyegeria/asset_catalog_omvs.py +672 -0
  9. pyegeria/automated_curation_omvs.py +627 -359
  10. pyegeria/collection_manager_omvs.py +187 -248
  11. pyegeria/core_guids.py +128 -0
  12. pyegeria/core_omag_server_config.py +1 -5
  13. pyegeria/full_omag_server_config.py +53 -83
  14. pyegeria/glossary_browser_omvs.py +2208 -0
  15. pyegeria/glossary_manager_omvs.py +3002 -0
  16. pyegeria/my_profile_omvs.py +2 -7
  17. pyegeria/platform_services.py +0 -3
  18. pyegeria/project_manager_omvs.py +9 -15
  19. pyegeria/registered_info.py +12 -52
  20. pyegeria/runtime_manager_omvs.py +967 -0
  21. pyegeria/server_operations.py +1 -5
  22. pyegeria/valid_metadata_omvs.py +204 -43
  23. pyegeria-0.4.0.data/scripts/Create_Collection_Sample.py +292 -0
  24. pyegeria-0.4.0.data/scripts/Create_Sustainability_Collection_Sample.py +115 -0
  25. pyegeria-0.4.0.data/scripts/get_guid_info.py +86 -0
  26. pyegeria-0.3.8.data/scripts/view_my_profile.py → pyegeria-0.4.0.data/scripts/get_my_profile.py +8 -34
  27. {pyegeria-0.3.8.data → pyegeria-0.4.0.data}/scripts/get_tech_details.py +1 -37
  28. pyegeria-0.4.0.data/scripts/get_tech_type_elements.py +137 -0
  29. pyegeria-0.4.0.data/scripts/get_tech_type_template.py +137 -0
  30. {pyegeria-0.3.8.data → pyegeria-0.4.0.data}/scripts/list_asset_types.py +3 -25
  31. pyegeria-0.4.0.data/scripts/list_assets.py +138 -0
  32. pyegeria-0.3.8.data/scripts/project_list_viewer.py → pyegeria-0.4.0.data/scripts/list_projects.py +13 -27
  33. pyegeria-0.4.0.data/scripts/list_registered_services.py +135 -0
  34. pyegeria-0.3.8.data/scripts/get_relationship_types.py → pyegeria-0.4.0.data/scripts/list_relationship_types.py +25 -43
  35. pyegeria-0.4.0.data/scripts/list_tech_templates.py +134 -0
  36. pyegeria-0.3.8.data/scripts/find_todos.py → pyegeria-0.4.0.data/scripts/list_todos.py +11 -39
  37. pyegeria-0.4.0.data/scripts/list_valid_metadata_values.py +144 -0
  38. pyegeria-0.4.0.data/scripts/view_asset_graph.py +236 -0
  39. pyegeria-0.3.8.data/scripts/multi-server_status.py → pyegeria-0.4.0.data/scripts/view_coco_status.py +17 -39
  40. pyegeria-0.3.8.data/scripts/collection_viewer.py → pyegeria-0.4.0.data/scripts/view_collection.py +12 -31
  41. pyegeria-0.3.8.data/scripts/engine_action_status.py → pyegeria-0.4.0.data/scripts/view_eng_action_status.py +17 -31
  42. pyegeria-0.3.8.data/scripts/glossary_view.py → pyegeria-0.4.0.data/scripts/view_glossary.py +2 -2
  43. pyegeria-0.3.8.data/scripts/gov_engine_status.py → pyegeria-0.4.0.data/scripts/view_gov_eng_status.py +0 -1
  44. pyegeria-0.3.8.data/scripts/integration_daemon_status.py → pyegeria-0.4.0.data/scripts/view_integ_daemon_status.py +30 -42
  45. pyegeria-0.3.8.data/scripts/my_todos.py → pyegeria-0.4.0.data/scripts/view_my_todos.py +1 -1
  46. pyegeria-0.3.8.data/scripts/open_todos.py → pyegeria-0.4.0.data/scripts/view_open_todos.py +3 -24
  47. pyegeria-0.4.0.data/scripts/view_platform_status.py +123 -0
  48. pyegeria-0.3.8.data/scripts/server_status.py → pyegeria-0.4.0.data/scripts/view_server_status.py +1 -20
  49. {pyegeria-0.3.8.dist-info → pyegeria-0.4.0.dist-info}/METADATA +5 -4
  50. pyegeria-0.4.0.dist-info/RECORD +58 -0
  51. {pyegeria-0.3.8.dist-info → pyegeria-0.4.0.dist-info}/WHEEL +1 -1
  52. pyegeria/glossary_omvs.py +0 -789
  53. pyegeria/loaded_resources_omvs.py +0 -159
  54. pyegeria-0.3.8.dist-info/RECORD +0 -42
  55. /pyegeria/{governance_author.py → action_author_omvs.py} +0 -0
  56. /pyegeria-0.3.8.data/scripts/get_tech_types.py → /pyegeria-0.4.0.data/scripts/list_tech_types.py +0 -0
  57. /pyegeria-0.3.8.data/scripts/server_status_widget.py → /pyegeria-0.4.0.data/scripts/view_server_list.py +0 -0
  58. {pyegeria-0.3.8.dist-info → pyegeria-0.4.0.dist-info}/LICENSE +0 -0
  59. {pyegeria-0.3.8.dist-info → pyegeria-0.4.0.dist-info}/top_level.txt +0 -0
@@ -0,0 +1,236 @@
1
+ #!python
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 sys
9
+ import time
10
+ import argparse
11
+
12
+ from rich import json
13
+ from rich.panel import Panel
14
+
15
+ from pyegeria import (
16
+ InvalidParameterException,
17
+ PropertyServerException,
18
+ UserNotAuthorizedException,
19
+ print_exception_response,
20
+ AssetCatalog
21
+ )
22
+ from rich.table import Table
23
+ from rich.live import Live
24
+ from rich.console import Console
25
+ from rich.markdown import Markdown
26
+ from rich.tree import Tree
27
+ from rich.prompt import Prompt
28
+ from rich.panel import Panel
29
+ from rich.text import Text
30
+ from rich import print
31
+
32
+ disable_ssl_warnings = True
33
+ console = Console(width=200)
34
+
35
+ platform = "https://127.0.0.1:9443"
36
+ user = "erinoverview"
37
+ view_server = "view-server"
38
+
39
+ guid_list = []
40
+
41
+ def asset_viewer(asset_name: str, server_name:str, platform_url:str, user:str):
42
+
43
+ def build_classifications(classification: dict) -> Markdown:
44
+
45
+ class_md = "-"
46
+ for c in classification:
47
+ c_type = c["classificationName"]
48
+ if c_type == "Anchors":
49
+ continue
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 == "-":
55
+ output = None
56
+ else:
57
+ output = class_md
58
+ return output
59
+
60
+ def build_nested_elements(nested_element: dict) -> Markdown:
61
+ ne_md = " "
62
+
63
+ ne_created_by = nested_element["versions"]["createdBy"]
64
+ ne_created_at = nested_element["versions"]["createTime"]
65
+ ne_guid = nested_element["guid"]
66
+ guid_list.append(ne_guid)
67
+
68
+ ne_type = nested_element["type"]["typeName"]
69
+ ne_classifications = nested_element["classifications"]
70
+ ne_class_md = build_classifications(ne_classifications)
71
+ # ne_class_md = " " if ne_class_md is None else ne_class_md
72
+ ne_props = nested_element["properties"]
73
+
74
+ ne_prop_md = ""
75
+ for prop in ne_props.keys():
76
+ ne_prop_md += f"* {prop}: {ne_props[prop]}\n"
77
+ ne_md = (f"Nested Element of Type: {ne_type} with GUID: {ne_guid} \n "
78
+ f"* created by {ne_created_by} at time {ne_created_at}\n"
79
+ f"{ne_prop_md}\n")
80
+ if ne_class_md is not None:
81
+ ne_md += f"* {ne_class_md}"
82
+
83
+ output = Markdown(ne_md)
84
+ return output
85
+
86
+ try:
87
+
88
+ console = Console(width=200)
89
+
90
+ a_client = AssetCatalog(view_server, platform,
91
+ user_id=user)
92
+
93
+ 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']
96
+ guid_list.append(asset_guid)
97
+
98
+ asset_graph = a_client.get_asset_graph(asset_guid)
99
+ if type(asset_graph) is not dict:
100
+ print(f"\n No Asset found for {asset_name}")
101
+ sys.exit(1)
102
+
103
+ # 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 = ""
106
+
107
+ asset_name = asset_graph["displayName"]
108
+ qualified_name = asset_graph["qualifiedName"]
109
+ resource_name = asset_graph["resourceName"]
110
+
111
+ asset_type = asset_graph["type"]["typeName"]
112
+ asset_origin = asset_graph["origin"]["homeMetadataCollectionName"]
113
+ asset_creation = asset_graph["versions"]["createTime"]
114
+ asset_created_by = asset_graph["versions"]["createdBy"]
115
+ asset_classifications = asset_graph["classifications"]
116
+ asset_nested_elements = asset_graph["anchoredElements"]
117
+ asset_relationships = asset_graph["relationships"]
118
+ asset_class_md = build_classifications(asset_classifications)
119
+
120
+
121
+ asset_properties = asset_graph["extendedProperties"]
122
+ prop_md = ""
123
+ for prop in asset_properties:
124
+ prop_md = f"{prop_md}* {prop}: {asset_properties[prop]}\n"
125
+
126
+ core_md = (f"**Type: {asset_type} Created by: {asset_created_by} on {asset_creation}**\n"
127
+ f"* Qualified Name: {qualified_name}\n "
128
+ f"* Resource Name: {resource_name}\n"
129
+ f"* Display Name: {asset_name}\n"
130
+ f"* Asset Origin: {asset_origin}\n{prop_md}"
131
+ )
132
+ core_md = Markdown(core_md)
133
+ p1 = Panel.fit(core_md, style = "bold bright_white")
134
+ l2 = tree.add(p1)
135
+ if asset_class_md is not None:
136
+ p2 = Panel.fit(Markdown(asset_class_md), style = "bold bright_white")
137
+ l2 = tree.add(p2)
138
+
139
+ #
140
+ # Nested Assets
141
+ #
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)
147
+
148
+ #
149
+ # Now work on the Relationships
150
+ #
151
+ for relationship in asset_relationships:
152
+ # Find the end guids - if one isn't in our list then display
153
+ rel_end1 = relationship["end1"]
154
+ rel_end1_type = rel_end1["type"]["typeName"]
155
+ rel_end1_guid = rel_end1["guid"]
156
+ rel_end1_unique_name = rel_end1["uniqueName"]
157
+
158
+ rel_end2 = relationship["end2"]
159
+ rel_end2_type = rel_end2["type"]["typeName"]
160
+ rel_end2_guid = rel_end2["guid"]
161
+ rel_end2_unique_name = rel_end2["uniqueName"]
162
+
163
+ if (rel_end1_guid not in guid_list) or (rel_end2_guid not in guid_list):
164
+ rel_end1_class_md = build_classifications(rel_end1["classifications"])
165
+ rel_end2_class_md = build_classifications(rel_end2["classifications"])
166
+
167
+ relationship_guid = relationship["guid"]
168
+ relationship_type = relationship["type"]["typeName"]
169
+ relationship_created_by = relationship["versions"]["createdBy"]
170
+ relationship_creation_time = relationship["versions"]["createTime"]
171
+ relationship_properties = relationship.get("properties"," ")
172
+ relationship_md = (f"Relationship Type {relationship_type}\n"
173
+ f"* GUID: {relationship_guid}\n* Created by: {relationship_created_by} \n"
174
+ f"* Creation Time: {relationship_creation_time}\n"
175
+ f"* Properties: {relationship_properties}\n")
176
+
177
+
178
+ rel_md = (
179
+ f"* Relationship Type: {relationship_type}\n"
180
+ f"* Relationship GUID: {relationship_guid}\n"
181
+ f"* Created by: {relationship_created_by} at time {relationship_creation_time}\n"
182
+ )
183
+ rel_end1_md = (
184
+ f"* End1:\n"
185
+ f"\t* Type: {rel_end1_type}\n"
186
+ f"\t* GUID: {rel_end1_guid}\n"
187
+ f"\t* Unique Name: {rel_end1_unique_name}\n"
188
+ )
189
+
190
+ if rel_end1_class_md is not None:
191
+ rel_end1_md = rel_end1_md + rel_end1_class_md
192
+
193
+ rel_end2_md = (
194
+ f"* End1:\n"
195
+ f"\t* Type: {rel_end2_type}\n"
196
+ f"\t* GUID: {rel_end2_guid}\n"
197
+ f"\t* Unique Name: {rel_end2_unique_name}\n"
198
+ )
199
+
200
+ if rel_end2_class_md is not None:
201
+ rel_end1_md = rel_end2_md + rel_end2_class_md
202
+ #
203
+ # for prop in relationship_properties.keys():
204
+ # relationship_md += f"* {prop}: {relationship_properties[prop]}\n"
205
+
206
+ relationship_md += rel_end1_md + rel_end2_md
207
+
208
+ relationship_panel = Panel.fit(Markdown(relationship_md), style="bold bright_white")
209
+ tree.add(relationship_panel)
210
+
211
+
212
+ print("\n\n")
213
+ print(tree)
214
+
215
+ except (
216
+ InvalidParameterException,
217
+ PropertyServerException,
218
+ UserNotAuthorizedException
219
+ ) as e:
220
+ print_exception_response(e)
221
+
222
+
223
+ if __name__ == "__main__":
224
+ parser = argparse.ArgumentParser()
225
+
226
+ parser.add_argument("--server", help="Name of the server to display status for")
227
+ parser.add_argument("--url", help="URL Platform to connect to")
228
+ parser.add_argument("--userid", help="User Id")
229
+ args = parser.parse_args()
230
+
231
+ server = args.server if args.server is not None else "view-server"
232
+ url = args.url if args.url is not None else "https://localhost:9443"
233
+ userid = args.userid if args.userid is not None else 'erinoverview'
234
+
235
+ asset_name = Prompt.ask("Enter the Asset Name to view:", default="TransMorg-Clinical-Trials-Weeklies")
236
+ asset_viewer(asset_name,server, url, userid)
@@ -3,13 +3,21 @@
3
3
  SPDX-License-Identifier: Apache-2.0
4
4
  Copyright Contributors to the ODPi Egeria project.
5
5
 
6
- An example of displaying the status of two platforms concurrently.
6
+ Unit tests for the Utils helper functions using the Pytest framework.
7
+
8
+
9
+ A simple server status display for the Coco Pharmaceuticals Configuration
7
10
  """
8
11
 
9
- import time
10
12
  import argparse
13
+ import time
11
14
 
12
- from rich.box import Box
15
+ from rich import box
16
+ from rich import print
17
+ from rich.layout import Layout
18
+ from rich.live import Live
19
+ from rich.panel import Panel
20
+ from rich.table import Table
13
21
 
14
22
  from pyegeria._exceptions import (
15
23
  InvalidParameterException,
@@ -17,44 +25,19 @@ from pyegeria._exceptions import (
17
25
  UserNotAuthorizedException,
18
26
  print_exception_response,
19
27
  )
20
- from rich.table import Table
21
- from rich.live import Live
22
- from rich import print
23
- from rich.console import Group
24
- from rich.panel import Panel
25
- from rich import box, align
26
- from rich.layout import Layout
27
- import rich
28
28
  from pyegeria.server_operations import ServerOps
29
29
 
30
30
  disable_ssl_warnings = True
31
31
 
32
- good_platform1_url = "https://127.0.0.1:9443"
33
- good_platform2_url = "https://egeria.pdr-associates.com:9443"
34
- bad_platform1_url = "https://localhost:9443"
35
-
36
32
 
37
- good_user_1 = "garygeeke"
38
- good_user_2 = "erinoverview"
39
- bad_user_1 = "eviledna"
40
- bad_user_2 = ""
41
-
42
- good_server_1 = "active-metadata-store"
43
- good_server_2 = "simple-metadata-store"
44
- good_server_3 = "view-server"
45
- good_server_4 = "engine-host"
46
- bad_server_1 = "coco"
47
- bad_server_2 = ""
48
-
49
-
50
- def test_display_status(server: str = good_server_1, url: str = good_platform2_url, username: str = good_user_1):
33
+ def test_display_status(server: str, url: str, username: str):
51
34
  layout = Layout()
52
35
  print(layout)
53
36
 
54
37
  print(layout)
55
- p_client1 = ServerOps(server, "https://cray.local:9443", username)
56
- p_client2 = ServerOps('ecosystem-monitor', "https://cray.local:9446", username)
57
-
38
+ p_client1 = ServerOps("Core Catalog", "https://localhost:9443", username)
39
+ p_client2 = ServerOps('Datalake Catalog', "https://localhost:9444", username)
40
+ p_client3 = ServerOps('DevCatalog', "https://localhost:9445", username)
58
41
 
59
42
  def generate_table(p_client) -> Table:
60
43
  """Make a new table."""
@@ -83,24 +66,19 @@ def test_display_status(server: str = good_server_1, url: str = good_platform2_u
83
66
  table.add_row(server,
84
67
  "[red]Inactive" if status == "Inactive" else "[green]Active",
85
68
  )
86
- # p_client.close_session()
87
69
  return table
88
70
 
89
71
  try:
90
- # panel_group = Group(
91
- # rich.align.Align(Panel(, generate_table(p_client2)), box.ROUNDED))
92
- #
93
- # )
94
72
  layout.split_row(
95
73
  Layout(Panel(generate_table(p_client1), box.ROUNDED)),
96
- Layout(Panel(generate_table(p_client2), box.ROUNDED))
74
+ Layout(Panel(generate_table(p_client2), box.ROUNDED)),
75
+ Layout(Panel(generate_table(p_client3), box.ROUNDED))
97
76
  )
98
77
  with Live(layout, refresh_per_second=4, screen=True) as live:
99
78
  while True:
100
79
  time.sleep(2)
101
80
  live.update(layout)
102
81
 
103
-
104
82
  except (InvalidParameterException, PropertyServerException, UserNotAuthorizedException) as e:
105
83
  print_exception_response(e)
106
84
  assert e.related_http_code != "200", "Invalid parameters"
@@ -7,43 +7,25 @@ A simple viewer for collections - provide the root and we display the hierarchy
7
7
 
8
8
  """
9
9
 
10
- import time
11
10
  import argparse
12
11
 
13
- from rich.box import Box
14
- from rich.markdown import Markdown
12
+ from rich import print
13
+ from rich.panel import Panel
15
14
  from rich.prompt import Prompt
16
-
17
- from pyegeria._exceptions import (
18
- InvalidParameterException,
19
- PropertyServerException,
20
- UserNotAuthorizedException,
21
- print_exception_response,
22
- )
23
- from rich.table import Table
24
- from rich.live import Live
25
15
  from rich.text import Text
26
16
  from rich.tree import Tree
27
- from rich.markdown import Markdown
28
17
 
29
- from rich import print
30
- from rich.console import Group
31
- from rich.panel import Panel
32
- from rich import box, align
33
- from rich.layout import Layout
34
- import rich
35
18
  from pyegeria import CollectionManager, UserNotAuthorizedException, PropertyServerException, InvalidParameterException
19
+ from pyegeria._exceptions import (
20
+ print_exception_response,
21
+ )
36
22
 
37
23
  disable_ssl_warnings = True
38
24
 
39
- platform = "https://127.0.0.1:9443"
40
- user = "erinoverview"
41
- view_server = "view-server"
42
25
 
43
-
44
- def collection_viewer(root: str, server_name:str, platform_url:str, user:str):
45
-
46
- def walk_collection_hierarchy(collection_client: CollectionManager, root_collection_name: str, tree: Tree) -> Tree:
26
+ def collection_viewer(root: str, server_name: str, platform_url: str, user: str):
27
+ """ A simple collection viewer"""
28
+ def walk_collection_hierarchy(collection_client: CollectionManager, root_collection_name: str, tree: Tree) -> None:
47
29
  """Recursively build a Tree with collection contents."""
48
30
  members = collection_client.get_member_list(root_collection_name)
49
31
  if members:
@@ -56,7 +38,7 @@ def collection_viewer(root: str, server_name:str, platform_url:str, user:str):
56
38
  text_collection_type = Text(f"* Collection Type: {member['collectionType']}", "cyan")
57
39
  text_description = Text(f"* Description: {member['description']}", "cyan")
58
40
  p = Panel.fit(f"[white]{text_collection_name}[green]\n{text_qualified_name}\n{text_guid}\n"
59
- f"{text_collection_type}\n{text_description}")
41
+ f"{text_collection_type}\n{text_description}")
60
42
  tt = tree.add(p, style=style)
61
43
 
62
44
  children = collection_client.get_collection_members(member['guid'])
@@ -64,14 +46,13 @@ def collection_viewer(root: str, server_name:str, platform_url:str, user:str):
64
46
  branch = tt.add(f"[bold magenta]Members", style=style, guide_style=style)
65
47
  walk_collection_hierarchy(collection_client, member['qualifiedName'], branch),
66
48
 
67
-
68
49
  try:
69
50
  tree = Tree(f"[bold bright green]{root}", guide_style="bold bright_blue")
70
- c_client = CollectionManager(view_server, platform,
51
+ c_client = CollectionManager(server_name, platform_url,
71
52
  user_id=user)
72
53
 
73
54
  token = c_client.create_egeria_bearer_token(user, "secret")
74
- walk_collection_hierarchy(c_client,root,tree)
55
+ walk_collection_hierarchy(c_client, root, tree)
75
56
  print(tree)
76
57
 
77
58
  except (
@@ -95,4 +76,4 @@ if __name__ == "__main__":
95
76
  userid = args.userid if args.userid is not None else 'erinoverview'
96
77
 
97
78
  root_collection = Prompt.ask("Enter the Root Collection to start from:", default="Digital Products Root")
98
- collection_viewer(root_collection,server, url, userid)
79
+ collection_viewer(root_collection, server, url, userid)
@@ -11,52 +11,32 @@ A simple status display for Engine Actions
11
11
 
12
12
  import argparse
13
13
  import json
14
- import time
15
14
  import sys
15
+ import time
16
16
 
17
17
  from rich import box
18
- from rich.live import Live
19
- from rich.table import Table
20
18
  from rich.console import Console
19
+ from rich.table import Table
20
+ from rich.live import Live
21
21
 
22
+ from pyegeria import AutomatedCuration
22
23
  from pyegeria import (
23
24
  InvalidParameterException,
24
25
  PropertyServerException,
25
26
  UserNotAuthorizedException,
26
27
  print_exception_response,
27
28
  )
28
- from pyegeria import GovEng, AutomatedCuration
29
29
 
30
30
  disable_ssl_warnings = True
31
31
 
32
- good_platform1_url = "https://127.0.0.1:9443"
33
- good_platform2_url = "https://egeria.pdr-associates.com:7443"
34
- bad_platform1_url = "https://localhost:9443"
35
32
 
36
- # good_platform1_url = "https://127.0.0.1:30080"
37
- # good_platform2_url = "https://127.0.0.1:30081"
38
- # bad_platform1_url = "https://localhost:9443"
39
-
40
- good_user_1 = "garygeeke"
41
- good_user_2 = "erinoverview"
42
- bad_user_1 = "eviledna"
43
- bad_user_2 = ""
44
-
45
- good_server_1 = "active-metadata-store"
46
- good_server_2 = "simple-metadata-store"
47
- good_server_3 = "view-server"
48
- good_server_4 = "engine-host"
49
- bad_server_1 = "coco"
50
- bad_server_2 = ""
51
-
52
-
53
- def display_status_engine_actions(server: str = good_server_3, url: str = good_platform1_url, user: str = good_user_1):
33
+ def display_status_engine_actions(server: str, url: str, user: str):
54
34
  g_client = AutomatedCuration(server, url, user, user_pwd="secret")
55
35
 
56
36
  def generate_table() -> Table:
57
37
  """Make a new table."""
58
38
  table = Table(
59
- title=f"Engine Action Status for Platform {good_platform1_url} @ {time.asctime()}",
39
+ title=f"Engine Action Status for Platform {url} @ {time.asctime()}",
60
40
  # style = "black on grey66",
61
41
  header_style="white on dark_blue",
62
42
  show_lines=True,
@@ -103,7 +83,7 @@ def display_status_engine_actions(server: str = good_server_3, url: str = good_p
103
83
  else:
104
84
  action_status = f"[red]{action['actionStatus']}"
105
85
 
106
- target= action.get("actionTargetElements","Empty")
86
+ target= action.get("actionTargetElements", "Empty")
107
87
  if type(target) is list:
108
88
  target_element = json.dumps(target[0]["targetElement"]["elementProperties"]["propertiesAsStrings"])
109
89
  else:
@@ -119,17 +99,23 @@ def display_status_engine_actions(server: str = good_server_3, url: str = good_p
119
99
  else:
120
100
  print("Egeria integration daemon not running")
121
101
  sys.exit()
122
- # g_client.close_session()
102
+
123
103
  return table
124
104
 
125
105
  try:
126
- console = Console()
127
- with console.pager():
128
- console.print(generate_table())
106
+ # console = Console()
107
+ # with console.pager():
108
+ # console.print(generate_table())
109
+ with Live(generate_table(), refresh_per_second=1, screen=True, vertical_overflow="visible") as live:
110
+ while True:
111
+ time.sleep(2)
112
+ live.update(generate_table())
129
113
 
130
114
  except (InvalidParameterException, PropertyServerException, UserNotAuthorizedException) as e:
131
115
  print_exception_response(e)
132
116
  assert e.related_http_code != "200", "Invalid parameters"
117
+ finally:
118
+ g_client.close_session()
133
119
 
134
120
 
135
121
  if __name__ == "__main__":
@@ -28,8 +28,8 @@ from rich.console import Console
28
28
 
29
29
 
30
30
  from pyegeria.server_operations import ServerOps
31
- from pyegeria.gov_engine import GovEng
32
- from pyegeria.glossary_omvs import GlossaryBrowser
31
+ from pyegeria._deprecated_gov_engine import GovEng
32
+ from pyegeria.glossary_browser_omvs import GlossaryBrowser
33
33
  disable_ssl_warnings = True
34
34
 
35
35
  good_platform1_url = "https://127.0.0.1:9443"
@@ -25,7 +25,6 @@ from rich import box
25
25
  from rich import console
26
26
 
27
27
  from pyegeria.server_operations import ServerOps
28
- from pyegeria.gov_engine import GovEng
29
28
 
30
29
  disable_ssl_warnings = True
31
30
 
@@ -3,51 +3,38 @@
3
3
  SPDX-License-Identifier: Apache-2.0
4
4
  Copyright Contributors to the ODPi Egeria project.
5
5
 
6
- Unit tests for the Utils helper functions using the Pytest framework.
7
6
 
7
+ A simple status display for the Integration Daemon.
8
+
9
+ Note that there are a couple of assumptions currently being made that need to get resolved in future
10
+ versions. First, we assume that the view-server used by AutomatedCuration is called "view-server". Second, we
11
+ assume that the user password is always "secret".
8
12
 
9
- A simple status display for Engine Actions
10
13
  """
11
14
 
12
15
  import argparse
13
- import json
14
16
  import time
15
17
 
16
18
  from rich import box
17
19
  from rich.live import Live
20
+ from rich.markdown import Markdown
18
21
  from rich.table import Table
19
- from rich import console
20
22
 
23
+ from pyegeria import ServerOps, AutomatedCuration
21
24
  from pyegeria._exceptions import (
22
25
  InvalidParameterException,
23
26
  PropertyServerException,
24
27
  UserNotAuthorizedException,
25
28
  print_exception_response,
26
29
  )
27
- from pyegeria.server_operations import ServerOps
28
30
 
29
31
  disable_ssl_warnings = True
30
32
 
31
- good_platform1_url = "https://127.0.0.1:9443"
32
- good_platform2_url = "https://egeria.pdr-associates.com:7443"
33
- bad_platform1_url = "https://localhost:9443"
34
-
35
- good_user_1 = "garygeeke"
36
- good_user_2 = "erinoverview"
37
- bad_user_1 = "eviledna"
38
- bad_user_2 = ""
39
-
40
- good_server_1 = "active-metadata-store"
41
- good_server_2 = "simple-metadata-store"
42
- good_server_3 = "view-server"
43
- good_server_4 = "engine-host"
44
- bad_server_1 = "coco"
45
- bad_server_2 = ""
46
33
 
47
-
48
- def display_integration_daemon_status(server: str = good_server_4, url: str = good_platform1_url,
49
- user: str = good_user_1):
34
+ def display_integration_daemon_status(server: str, url: str, user: str):
50
35
  s_client = ServerOps(server, url, user)
36
+ a_client = AutomatedCuration("view-server", url, user, "secret")
37
+ token = a_client.create_egeria_bearer_token()
51
38
 
52
39
  def generate_table() -> Table:
53
40
  """Make a new table."""
@@ -71,34 +58,35 @@ def display_integration_daemon_status(server: str = good_server_4, url: str = go
71
58
  daemon_status = s_client.get_integration_daemon_status()
72
59
  connector_reports = daemon_status["integrationConnectorReports"]
73
60
  for connector in connector_reports:
74
- connector_name = connector["connectorName"]
75
- connector_status = connector["connectorStatus"]
76
- last_refresh_time = connector.get("lastRefreshTime","---")
77
- refresh_interval = str(connector.get("minMinutesBetweenRefresh","---"))
78
- target_element = " "
61
+ connector_name = connector.get("connectorName", "---")
62
+ connector_status = connector.get("connectorStatus", "---")
63
+ connector_guid = connector["connectorGUID"]
64
+ last_refresh_time = connector.get("lastRefreshTime", "---")
65
+ refresh_interval = str(connector.get("minMinutesBetweenRefresh", "---"))
79
66
  exception_msg = " "
80
67
 
81
- if connector_name is None:
82
- connector_name = "connector name"
83
- if connector_status is None:
84
- connector_status = "connector status"
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)
77
+ else:
78
+ targets_md = " "
85
79
 
86
80
  if connector_status in ("RUNNING", "REFRESHING", "WAITING"):
87
81
  connector_status = f"[green]{connector_status}"
88
- elif connector_status in ("INITIALIZE FAILED","CONFIG_FAILED","FAILED"):
82
+ elif connector_status in ("INITIALIZE FAILED", "CONFIG_FAILED", "FAILED"):
89
83
  connector_status = f"[red]{connector_status}"
90
84
  else:
91
85
  connector_status = f"[yellow]{connector_status}"
92
86
 
93
- # target= action.get("actionTargetElements","Empty")
94
- # if type(target) is list:
95
- # target_element = json.dumps(target[0]["targetElement"]["elementProperties"]["propertiesAsStrings"])
96
- # else:
97
- # target_element = " "
98
-
99
87
  table.add_row(
100
- connector_name,connector_status,last_refresh_time,refresh_interval,
101
- target_element, exception_msg
88
+ connector_name, connector_status, last_refresh_time, refresh_interval,
89
+ targets_md, exception_msg
102
90
  )
103
91
  return table
104
92
 
@@ -119,7 +107,7 @@ def display_integration_daemon_status(server: str = good_server_4, url: str = go
119
107
 
120
108
  if __name__ == "__main__":
121
109
  parser = argparse.ArgumentParser()
122
- parser.add_argument("--server", help="Name of the server to display status for")
110
+ parser.add_argument("--server", help="Name of the integration server to display status for")
123
111
  parser.add_argument("--url", help="URL Platform to connect to")
124
112
  parser.add_argument("--userid", help="User Id")
125
113
  args = parser.parse_args()
@@ -24,7 +24,7 @@ from pyegeria import (
24
24
  UserNotAuthorizedException,
25
25
  print_exception_response,
26
26
  )
27
- from pyegeria.gov_engine import GovEng
27
+ from pyegeria._deprecated_gov_engine import GovEng
28
28
  from pyegeria.my_profile_omvs import MyProfile
29
29
  disable_ssl_warnings = True
30
30