pyegeria 0.8.4.9__py3-none-any.whl → 0.8.4.10__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.
- examples/widgets/ops/README.md +24 -0
- examples/widgets/ops/__init__.py +19 -0
- examples/widgets/ops/engine_actions.py +83 -0
- examples/widgets/ops/integration_daemon_actions.py +139 -0
- examples/widgets/ops/list_catalog_targets.py +157 -0
- examples/widgets/ops/load_archive.py +62 -0
- examples/widgets/ops/monitor_asset_events.py +102 -0
- examples/widgets/ops/monitor_coco_status.py +103 -0
- examples/widgets/ops/monitor_engine_activity.py +236 -0
- examples/widgets/ops/monitor_engine_activity_c.py +253 -0
- examples/widgets/ops/monitor_gov_eng_status.py +188 -0
- examples/widgets/ops/monitor_integ_daemon_status.py +256 -0
- examples/widgets/ops/monitor_platform_status.py +176 -0
- examples/widgets/ops/monitor_server_list.py +140 -0
- examples/widgets/ops/monitor_server_status.py +109 -0
- examples/widgets/ops/refresh_integration_daemon.py +73 -0
- examples/widgets/ops/restart_integration_daemon.py +73 -0
- pyegeria/classification_manager_omvs.py +195 -9
- {pyegeria-0.8.4.9.dist-info → pyegeria-0.8.4.10.dist-info}/METADATA +1 -1
- {pyegeria-0.8.4.9.dist-info → pyegeria-0.8.4.10.dist-info}/RECORD +23 -6
- {pyegeria-0.8.4.9.dist-info → pyegeria-0.8.4.10.dist-info}/LICENSE +0 -0
- {pyegeria-0.8.4.9.dist-info → pyegeria-0.8.4.10.dist-info}/WHEEL +0 -0
- {pyegeria-0.8.4.9.dist-info → pyegeria-0.8.4.10.dist-info}/entry_points.txt +0 -0
@@ -0,0 +1,103 @@
|
|
1
|
+
#!/usr/bin/python3
|
2
|
+
"""
|
3
|
+
SPDX-License-Identifier: Apache-2.0
|
4
|
+
Copyright Contributors to the ODPi Egeria project.
|
5
|
+
|
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
|
10
|
+
"""
|
11
|
+
|
12
|
+
import argparse
|
13
|
+
import time
|
14
|
+
|
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
|
21
|
+
|
22
|
+
from pyegeria._exceptions import (
|
23
|
+
InvalidParameterException,
|
24
|
+
PropertyServerException,
|
25
|
+
UserNotAuthorizedException,
|
26
|
+
print_exception_response,
|
27
|
+
)
|
28
|
+
from pyegeria.server_operations import ServerOps
|
29
|
+
|
30
|
+
disable_ssl_warnings = True
|
31
|
+
|
32
|
+
|
33
|
+
def display_status(server: str, url: str, username: str):
|
34
|
+
layout = Layout()
|
35
|
+
|
36
|
+
p_client1 = ServerOps("Core Catalog", "https://localhost:9443", username)
|
37
|
+
p_client2 = ServerOps('Datalake Catalog', "https://localhost:9444", username)
|
38
|
+
p_client3 = ServerOps('DevCatalog', "https://localhost:9445", username)
|
39
|
+
|
40
|
+
def generate_table(p_client) -> Table:
|
41
|
+
"""Make a new table."""
|
42
|
+
table = Table(
|
43
|
+
title=f"Server Status for {p_client.server_name}- {time.asctime()}",
|
44
|
+
# style = "black on grey66",
|
45
|
+
header_style="white on dark_blue",
|
46
|
+
caption=f"Server Status for Platform - '{p_client.platform_url}'",
|
47
|
+
# show_lines=True,
|
48
|
+
)
|
49
|
+
|
50
|
+
table.add_column("Known Server")
|
51
|
+
table.add_column("Status")
|
52
|
+
known_server_list = p_client.get_known_servers()
|
53
|
+
active_server_list = p_client.get_active_server_list()
|
54
|
+
if type(known_server_list) is str:
|
55
|
+
return table
|
56
|
+
|
57
|
+
for server in known_server_list:
|
58
|
+
if server in active_server_list:
|
59
|
+
status = "Active"
|
60
|
+
else:
|
61
|
+
status = "Inactive"
|
62
|
+
|
63
|
+
table.add_row(server,
|
64
|
+
"[red]Inactive" if status == "Inactive" else "[green]Active",
|
65
|
+
)
|
66
|
+
return table
|
67
|
+
|
68
|
+
try:
|
69
|
+
layout.split_row(
|
70
|
+
Layout(Panel(generate_table(p_client1), box.ROUNDED)),
|
71
|
+
Layout(Panel(generate_table(p_client2), box.ROUNDED)),
|
72
|
+
Layout(Panel(generate_table(p_client3), box.ROUNDED))
|
73
|
+
)
|
74
|
+
with Live(layout, refresh_per_second=4, screen=True) as live:
|
75
|
+
while True:
|
76
|
+
time.sleep(2)
|
77
|
+
live.update(layout)
|
78
|
+
|
79
|
+
except (InvalidParameterException, PropertyServerException, UserNotAuthorizedException) as e:
|
80
|
+
print_exception_response(e)
|
81
|
+
except KeyboardInterrupt:
|
82
|
+
pass
|
83
|
+
|
84
|
+
finally:
|
85
|
+
p_client1.close_session()
|
86
|
+
p_client2.close_session()
|
87
|
+
p_client3.close_session()
|
88
|
+
|
89
|
+
def main():
|
90
|
+
parser = argparse.ArgumentParser()
|
91
|
+
parser.add_argument("--server", help="Name of the server to display status for")
|
92
|
+
parser.add_argument("--url", help="URL Platform to connect to")
|
93
|
+
parser.add_argument("--userid", help="User Id")
|
94
|
+
args = parser.parse_args()
|
95
|
+
|
96
|
+
server = args.server if args.server is not None else "active-metadata-store"
|
97
|
+
url = args.url if args.url is not None else "https://localhost:9443"
|
98
|
+
userid = args.userid if args.userid is not None else 'garygeeke'
|
99
|
+
|
100
|
+
display_status(server, url, userid)
|
101
|
+
|
102
|
+
if __name__ == "__main__":
|
103
|
+
main()
|
@@ -0,0 +1,236 @@
|
|
1
|
+
#!/usr/bin/env python3
|
2
|
+
"""
|
3
|
+
SPDX-License-Identifier: Apache-2.0
|
4
|
+
Copyright Contributors to the ODPi Egeria project.
|
5
|
+
|
6
|
+
Unit tests for the Utils helper functions using the Pytest framework.
|
7
|
+
|
8
|
+
|
9
|
+
A simple status display for Engine Actions
|
10
|
+
"""
|
11
|
+
|
12
|
+
import argparse
|
13
|
+
import json
|
14
|
+
import os
|
15
|
+
import sys
|
16
|
+
import time
|
17
|
+
|
18
|
+
from rich import box
|
19
|
+
from rich.console import Console
|
20
|
+
from rich.live import Live
|
21
|
+
from rich.table import Table
|
22
|
+
|
23
|
+
from pyegeria import AutomatedCuration
|
24
|
+
from pyegeria import (
|
25
|
+
InvalidParameterException,
|
26
|
+
PropertyServerException,
|
27
|
+
UserNotAuthorizedException,
|
28
|
+
print_exception_response,
|
29
|
+
)
|
30
|
+
|
31
|
+
EGERIA_METADATA_STORE = os.environ.get("EGERIA_METADATA_STORE", "active-metadata-store")
|
32
|
+
EGERIA_KAFKA_ENDPOINT = os.environ.get("KAFKA_ENDPOINT", "localhost:9092")
|
33
|
+
EGERIA_PLATFORM_URL = os.environ.get("EGERIA_PLATFORM_URL", "https://localhost:9443")
|
34
|
+
EGERIA_VIEW_SERVER = os.environ.get("VIEW_SERVER", "view-server")
|
35
|
+
EGERIA_VIEW_SERVER_URL = os.environ.get(
|
36
|
+
"EGERIA_VIEW_SERVER_URL", "https://localhost:9443"
|
37
|
+
)
|
38
|
+
EGERIA_ENGINE_HOST = os.environ.get("INTEGRATION_ENGINE_HOST", "engine-host")
|
39
|
+
EGERIA_ENGINE_HOST_URL = os.environ.get(
|
40
|
+
"INTEGRATION_ENGINE_HOST_URL", "https://localhost:9443"
|
41
|
+
)
|
42
|
+
EGERIA_INTEGRATION_DAEMON = os.environ.get("INTEGRATION_DAEMON", "integration-daemon")
|
43
|
+
EGERIA_ADMIN_USER = os.environ.get("ADMIN_USER", "garygeeke")
|
44
|
+
EGERIA_ADMIN_PASSWORD = os.environ.get("ADMIN_PASSWORD", "secret")
|
45
|
+
EGERIA_USER = os.environ.get("EGERIA_USER", "erinoverview")
|
46
|
+
EGERIA_USER_PASSWORD = os.environ.get("EGERIA_USER_PASSWORD", "secret")
|
47
|
+
EGERIA_JUPYTER = bool(os.environ.get("EGERIA_JUPYTER", "False"))
|
48
|
+
EGERIA_WIDTH = int(os.environ.get("EGERIA_WIDTH", "200"))
|
49
|
+
|
50
|
+
disable_ssl_warnings = True
|
51
|
+
|
52
|
+
|
53
|
+
def display_engine_activity(
|
54
|
+
server: str,
|
55
|
+
url: str,
|
56
|
+
user: str,
|
57
|
+
user_pass: str,
|
58
|
+
paging: bool,
|
59
|
+
jupyter: bool = EGERIA_JUPYTER,
|
60
|
+
width=EGERIA_WIDTH,
|
61
|
+
):
|
62
|
+
g_client = AutomatedCuration(server, url, user, user_pwd=user_pass)
|
63
|
+
|
64
|
+
def generate_table() -> Table:
|
65
|
+
"""Make a new table."""
|
66
|
+
table = Table(
|
67
|
+
title=f"Engine Action Status for Platform {url} @ {time.asctime()}",
|
68
|
+
style="bold white on black",
|
69
|
+
row_styles=["bold white on black"],
|
70
|
+
header_style="white on dark_blue",
|
71
|
+
title_style="bold white on black",
|
72
|
+
caption_style="white on black",
|
73
|
+
show_lines=True,
|
74
|
+
box=box.ROUNDED,
|
75
|
+
caption=f"Engine Status for Server '{server}' @ Platform - {url}",
|
76
|
+
expand=True,
|
77
|
+
)
|
78
|
+
table.add_column("Requested Time")
|
79
|
+
table.add_column("Start Time")
|
80
|
+
table.add_column("Action GUID", no_wrap=True)
|
81
|
+
table.add_column("Engine Name")
|
82
|
+
table.add_column("Request Type")
|
83
|
+
table.add_column("Action Status")
|
84
|
+
table.add_column("Target Element")
|
85
|
+
table.add_column("Completion Time")
|
86
|
+
table.add_column("Process Name")
|
87
|
+
table.add_column("Completion Message")
|
88
|
+
|
89
|
+
token = g_client.create_egeria_bearer_token()
|
90
|
+
action_status = g_client.get_engine_actions()
|
91
|
+
|
92
|
+
if type(action_status) is str:
|
93
|
+
requested_time = " "
|
94
|
+
start_time = " "
|
95
|
+
completion_time = " "
|
96
|
+
engine_name = " "
|
97
|
+
request_type = " "
|
98
|
+
action_status = " "
|
99
|
+
target_element = " "
|
100
|
+
process_name = " "
|
101
|
+
completion_message = " "
|
102
|
+
elif type(action_status) is list:
|
103
|
+
sorted_action_status = sorted(
|
104
|
+
action_status,
|
105
|
+
key=lambda i: i.get("requestedTime", time.asctime()),
|
106
|
+
reverse=True,
|
107
|
+
)
|
108
|
+
for action in sorted_action_status:
|
109
|
+
requested_time = action.get("requestedTime", " ")
|
110
|
+
start_time = action.get("startTime", " ")
|
111
|
+
completion_time = action.get("completionTime", " ")
|
112
|
+
|
113
|
+
engine_name = action["governanceEngineName"]
|
114
|
+
request_type = action["requestType"]
|
115
|
+
action_guid = action["elementHeader"]["guid"]
|
116
|
+
if action["actionStatus"] in (
|
117
|
+
"REQUESTED",
|
118
|
+
"APPROVED",
|
119
|
+
"WAITING",
|
120
|
+
"ACTIVATING",
|
121
|
+
):
|
122
|
+
action_status = f"[yellow]{action['actionStatus']}"
|
123
|
+
elif action["actionStatus"] in ("IN_PROGRESS", "ACTIONED"):
|
124
|
+
action_status = f"[green]{action['actionStatus']}"
|
125
|
+
else:
|
126
|
+
action_status = f"[red]{action['actionStatus']}"
|
127
|
+
|
128
|
+
targets = action.get("actionTargetElements", "Empty")
|
129
|
+
if type(targets) is list:
|
130
|
+
tgt_tab = Table()
|
131
|
+
tgt_tab.add_column("name")
|
132
|
+
tgt_tab.add_column("guid", no_wrap=True)
|
133
|
+
tgt_tab.add_column("type_name")
|
134
|
+
targets_md = ""
|
135
|
+
for target in targets:
|
136
|
+
t_name = target["actionTargetName"]
|
137
|
+
t_guid = target["actionTargetGUID"]
|
138
|
+
t_type = target["targetElement"]["type"]["typeName"]
|
139
|
+
tgt_tab.add_row(t_name, t_guid, t_type)
|
140
|
+
# target_element = json.dumps(target[0]["targetElement"]["elementProperties"]["propertiesAsStrings"])
|
141
|
+
target_element = tgt_tab
|
142
|
+
else:
|
143
|
+
target_element = " "
|
144
|
+
|
145
|
+
process_name = action.get("processName", " ")
|
146
|
+
completion_message = action.get("completionMessage", " ")
|
147
|
+
|
148
|
+
table.add_row(
|
149
|
+
requested_time,
|
150
|
+
start_time,
|
151
|
+
action_guid,
|
152
|
+
engine_name,
|
153
|
+
request_type,
|
154
|
+
action_status,
|
155
|
+
target_element,
|
156
|
+
completion_time,
|
157
|
+
process_name,
|
158
|
+
completion_message,
|
159
|
+
)
|
160
|
+
else:
|
161
|
+
print("Egeria integration daemon not running")
|
162
|
+
sys.exit()
|
163
|
+
|
164
|
+
return table
|
165
|
+
|
166
|
+
try:
|
167
|
+
if paging is True:
|
168
|
+
console = Console(width=width, force_terminal=not jupyter)
|
169
|
+
with console.pager():
|
170
|
+
console.print(generate_table())
|
171
|
+
else:
|
172
|
+
with Live(
|
173
|
+
generate_table(),
|
174
|
+
refresh_per_second=1,
|
175
|
+
screen=True,
|
176
|
+
vertical_overflow="visible",
|
177
|
+
) as live:
|
178
|
+
while True:
|
179
|
+
time.sleep(2)
|
180
|
+
live.update(generate_table())
|
181
|
+
|
182
|
+
except (
|
183
|
+
InvalidParameterException,
|
184
|
+
PropertyServerException,
|
185
|
+
UserNotAuthorizedException,
|
186
|
+
) as e:
|
187
|
+
print_exception_response(e)
|
188
|
+
except KeyboardInterrupt:
|
189
|
+
pass
|
190
|
+
finally:
|
191
|
+
g_client.close_session()
|
192
|
+
|
193
|
+
|
194
|
+
def main_live():
|
195
|
+
parser = argparse.ArgumentParser()
|
196
|
+
parser.add_argument("--server", help="Name of the server to display status for")
|
197
|
+
parser.add_argument("--url", help="URL Platform to connect to")
|
198
|
+
parser.add_argument("--userid", help="User Id")
|
199
|
+
parser.add_argument("--password", help="User Password")
|
200
|
+
|
201
|
+
args = parser.parse_args()
|
202
|
+
|
203
|
+
server = args.server if args.server is not None else EGERIA_VIEW_SERVER
|
204
|
+
url = args.url if args.url is not None else EGERIA_VIEW_SERVER_URL
|
205
|
+
userid = args.userid if args.userid is not None else EGERIA_USER
|
206
|
+
user_pass = args.password if args.password is not None else EGERIA_USER_PASSWORD
|
207
|
+
|
208
|
+
display_engine_activity(
|
209
|
+
server=server, url=url, user=userid, user_pass=user_pass, paging=False
|
210
|
+
)
|
211
|
+
|
212
|
+
|
213
|
+
def main_paging():
|
214
|
+
parser = argparse.ArgumentParser()
|
215
|
+
parser.add_argument("--server", help="Name of the server to display status for")
|
216
|
+
parser.add_argument("--url", help="URL Platform to connect to")
|
217
|
+
parser.add_argument("--userid", help="User Id")
|
218
|
+
parser.add_argument("--password", help="User Password")
|
219
|
+
|
220
|
+
args = parser.parse_args()
|
221
|
+
|
222
|
+
server = args.server if args.server is not None else EGERIA_VIEW_SERVER
|
223
|
+
url = args.url if args.url is not None else EGERIA_VIEW_SERVER_URL
|
224
|
+
userid = args.userid if args.userid is not None else EGERIA_USER
|
225
|
+
user_pass = args.password if args.password is not None else EGERIA_USER_PASSWORD
|
226
|
+
|
227
|
+
display_engine_activity(
|
228
|
+
server=server, url=url, user=userid, user_pass=user_pass, paging=True
|
229
|
+
)
|
230
|
+
|
231
|
+
|
232
|
+
if __name__ == "__main__":
|
233
|
+
main_live()
|
234
|
+
|
235
|
+
if __name__ == "__main_paging__":
|
236
|
+
main_paging()
|
@@ -0,0 +1,253 @@
|
|
1
|
+
#!/usr/bin/env python3
|
2
|
+
"""
|
3
|
+
SPDX-License-Identifier: Apache-2.0
|
4
|
+
Copyright Contributors to the ODPi Egeria project.
|
5
|
+
|
6
|
+
Unit tests for the Utils helper functions using the Pytest framework.
|
7
|
+
|
8
|
+
|
9
|
+
A simple status display for Engine Actions
|
10
|
+
"""
|
11
|
+
|
12
|
+
import argparse
|
13
|
+
import json
|
14
|
+
import os
|
15
|
+
import sys
|
16
|
+
import time
|
17
|
+
|
18
|
+
from rich import box
|
19
|
+
from rich.console import Console
|
20
|
+
from rich.live import Live
|
21
|
+
from rich.markdown import Markdown
|
22
|
+
from rich.table import Table
|
23
|
+
|
24
|
+
from pyegeria import AutomatedCuration
|
25
|
+
from pyegeria import (
|
26
|
+
InvalidParameterException,
|
27
|
+
PropertyServerException,
|
28
|
+
UserNotAuthorizedException,
|
29
|
+
print_exception_response,
|
30
|
+
)
|
31
|
+
|
32
|
+
EGERIA_METADATA_STORE = os.environ.get("EGERIA_METADATA_STORE", "active-metadata-store")
|
33
|
+
EGERIA_KAFKA_ENDPOINT = os.environ.get("EGERIA_KAFKA_ENDPOINT", "localhost:9092")
|
34
|
+
EGERIA_PLATFORM_URL = os.environ.get("EGERIA_PLATFORM_URL", "https://localhost:9443")
|
35
|
+
EGERIA_VIEW_SERVER = os.environ.get("EGERIA_VIEW_SERVER", "view-server")
|
36
|
+
EGERIA_VIEW_SERVER_URL = os.environ.get(
|
37
|
+
"EGERIA_VIEW_SERVER_URL", "https://localhost:9443"
|
38
|
+
)
|
39
|
+
EGERIA_ENGINE_HOST = os.environ.get("EGERIA_ENGINE_HOST", "engine-host")
|
40
|
+
EGERIA_ENGINE_HOST_URL = os.environ.get(
|
41
|
+
"EGERIA_ENGINE_HOST_URL", "https://localhost:9443"
|
42
|
+
)
|
43
|
+
EGERIA_INTEGRATION_DAEMON = os.environ.get(
|
44
|
+
"EGERIA_INTEGRATION_DAEMON", "integration-daemon"
|
45
|
+
)
|
46
|
+
EGERIA_ADMIN_USER = os.environ.get("EGERIA_ADMIN_USER", "garygeeke")
|
47
|
+
EGERIA_ADMIN_PASSWORD = os.environ.get("EGERIA_ADMIN_PASSWORD", "secret")
|
48
|
+
EGERIA_USER = os.environ.get("EGERIA_USER", "erinoverview")
|
49
|
+
EGERIA_USER_PASSWORD = os.environ.get("EGERIA_USER_PASSWORD", "secret")
|
50
|
+
EGERIA_JUPYTER = bool(os.environ.get("EGERIA_JUPYTER", "False"))
|
51
|
+
EGERIA_WIDTH = int(os.environ.get("EGERIA_WIDTH", "200"))
|
52
|
+
|
53
|
+
disable_ssl_warnings = True
|
54
|
+
|
55
|
+
|
56
|
+
def display_engine_activity_c(
|
57
|
+
server: str,
|
58
|
+
url: str,
|
59
|
+
user: str,
|
60
|
+
user_pass: str,
|
61
|
+
paging: bool,
|
62
|
+
jupyter: bool = EGERIA_JUPYTER,
|
63
|
+
width=EGERIA_WIDTH,
|
64
|
+
):
|
65
|
+
g_client = AutomatedCuration(server, url, user, user_pwd=user_pass)
|
66
|
+
|
67
|
+
def generate_table() -> Table:
|
68
|
+
"""Make a new table."""
|
69
|
+
table = Table(
|
70
|
+
title=f"Engine Action Status for Platform {url} @ {time.asctime()}",
|
71
|
+
style="bold white on black",
|
72
|
+
row_styles=["bold white on black"],
|
73
|
+
header_style="white on dark_blue",
|
74
|
+
title_style="bold white on black",
|
75
|
+
caption_style="white on black",
|
76
|
+
show_lines=True,
|
77
|
+
box=box.ROUNDED,
|
78
|
+
caption=f"Engine Status for Server '{server}' @ Platform - {url}",
|
79
|
+
expand=True,
|
80
|
+
)
|
81
|
+
table.add_column("Requested Time")
|
82
|
+
table.add_column("Core Info")
|
83
|
+
table.add_column("Target Elements")
|
84
|
+
|
85
|
+
table.add_column("Action Status")
|
86
|
+
table.add_column("Completion Time")
|
87
|
+
table.add_column("Core Results")
|
88
|
+
# table.add_column("Completion Message")
|
89
|
+
|
90
|
+
token = g_client.create_egeria_bearer_token()
|
91
|
+
action_status = g_client.get_engine_actions()
|
92
|
+
|
93
|
+
if type(action_status) is str:
|
94
|
+
requested_time = " "
|
95
|
+
start_time = " "
|
96
|
+
completion_time = " "
|
97
|
+
engine_name = " "
|
98
|
+
request_type = " "
|
99
|
+
action_status = " "
|
100
|
+
target_element = " "
|
101
|
+
process_name = " "
|
102
|
+
completion_message = " "
|
103
|
+
elif type(action_status) is list:
|
104
|
+
sorted_action_status = sorted(
|
105
|
+
action_status,
|
106
|
+
key=lambda i: i.get("requestedTime", time.asctime()),
|
107
|
+
reverse=True,
|
108
|
+
)
|
109
|
+
for action in sorted_action_status:
|
110
|
+
requested_time = action.get("requestedTime", " ")[:-10]
|
111
|
+
start_time = action.get("startTime", " ")[:-10]
|
112
|
+
completion_time = action.get("completionTime", " ")[:-10]
|
113
|
+
completion_guards = action.get("completionGuards", " ")
|
114
|
+
|
115
|
+
engine_name = action["governanceEngineName"]
|
116
|
+
request_type = action["requestType"]
|
117
|
+
action_guid = action["elementHeader"]["guid"]
|
118
|
+
if action["actionStatus"] in (
|
119
|
+
"REQUESTED",
|
120
|
+
"APPROVED",
|
121
|
+
"WAITING",
|
122
|
+
"ACTIVATING",
|
123
|
+
):
|
124
|
+
action_status = f"[yellow]{action['actionStatus']}"
|
125
|
+
elif action["actionStatus"] in ("IN_PROGRESS", "ACTIONED"):
|
126
|
+
action_status = f"[green]{action['actionStatus']}"
|
127
|
+
else:
|
128
|
+
action_status = f"[red]{action['actionStatus']}"
|
129
|
+
|
130
|
+
request_parameters_md = " "
|
131
|
+
request_parameters = action.get("requestParameters", "Empty")
|
132
|
+
if type(request_parameters) is dict:
|
133
|
+
for key, value in request_parameters.items():
|
134
|
+
request_parameters_md += f"\t* {key}: {value}\n"
|
135
|
+
|
136
|
+
targets = action.get("actionTargetElements", "Empty")
|
137
|
+
if type(targets) is list:
|
138
|
+
targets_md = ""
|
139
|
+
for target in targets:
|
140
|
+
t_name = target["actionTargetName"]
|
141
|
+
t_guid = target["actionTargetGUID"]
|
142
|
+
t_type = target["targetElement"]["type"]["typeName"]
|
143
|
+
targets_md += (
|
144
|
+
f"* Target Name: {t_name}\n"
|
145
|
+
f" * Target GUID: {t_guid}\n"
|
146
|
+
f" * Target Type: {t_type}\n"
|
147
|
+
)
|
148
|
+
|
149
|
+
# target_element = json.dumps(target[0]["targetElement"]["elementProperties"]["propertiesAsStrings"])
|
150
|
+
target_element = Markdown(f"{targets_md} ---\n")
|
151
|
+
else:
|
152
|
+
target_element = " "
|
153
|
+
|
154
|
+
process_name = action.get("processName", "Null")
|
155
|
+
completion_message = action.get("completionMessage", " ")
|
156
|
+
core_results_md = (
|
157
|
+
f"* Completion Guards: {completion_guards}\n"
|
158
|
+
f"* Completion Message: {completion_message}"
|
159
|
+
)
|
160
|
+
core_results_out = Markdown(core_results_md)
|
161
|
+
core_info_md = (
|
162
|
+
f"* Start Time: {start_time}\n* Engine Name: {engine_name}\n* GUID: {action_guid}\n"
|
163
|
+
f"* Request Type: {request_type}\n"
|
164
|
+
f"* Process Name: {process_name}\n"
|
165
|
+
f"---\n"
|
166
|
+
f"* Request Parameters: \n{request_parameters_md}\n"
|
167
|
+
)
|
168
|
+
core_info_out = Markdown(core_info_md)
|
169
|
+
table.add_row(
|
170
|
+
requested_time,
|
171
|
+
core_info_out,
|
172
|
+
target_element,
|
173
|
+
action_status,
|
174
|
+
completion_time,
|
175
|
+
core_results_out,
|
176
|
+
)
|
177
|
+
else:
|
178
|
+
print("Egeria integration daemon not running")
|
179
|
+
sys.exit()
|
180
|
+
|
181
|
+
return table
|
182
|
+
|
183
|
+
try:
|
184
|
+
if paging is True:
|
185
|
+
console = Console(width=width, force_terminal=not jupyter)
|
186
|
+
with console.pager():
|
187
|
+
console.print(generate_table())
|
188
|
+
else:
|
189
|
+
with Live(
|
190
|
+
generate_table(),
|
191
|
+
refresh_per_second=1,
|
192
|
+
screen=True,
|
193
|
+
vertical_overflow="visible",
|
194
|
+
) as live:
|
195
|
+
while True:
|
196
|
+
time.sleep(2)
|
197
|
+
live.update(generate_table())
|
198
|
+
|
199
|
+
except (
|
200
|
+
InvalidParameterException,
|
201
|
+
PropertyServerException,
|
202
|
+
UserNotAuthorizedException,
|
203
|
+
) as e:
|
204
|
+
print_exception_response(e)
|
205
|
+
except KeyboardInterrupt:
|
206
|
+
pass
|
207
|
+
finally:
|
208
|
+
g_client.close_session()
|
209
|
+
|
210
|
+
|
211
|
+
def main_live():
|
212
|
+
parser = argparse.ArgumentParser()
|
213
|
+
parser.add_argument("--server", help="Name of the server to display status for")
|
214
|
+
parser.add_argument("--url", help="URL Platform to connect to")
|
215
|
+
parser.add_argument("--userid", help="User Id")
|
216
|
+
parser.add_argument("--password", help="User Password")
|
217
|
+
|
218
|
+
args = parser.parse_args()
|
219
|
+
|
220
|
+
server = args.server if args.server is not None else EGERIA_VIEW_SERVER
|
221
|
+
url = args.url if args.url is not None else EGERIA_VIEW_SERVER_URL
|
222
|
+
userid = args.userid if args.userid is not None else EGERIA_USER
|
223
|
+
user_pass = args.password if args.password is not None else EGERIA_USER_PASSWORD
|
224
|
+
|
225
|
+
display_engine_activity_c(
|
226
|
+
server=server, url=url, user=userid, user_pass=user_pass, paging=False
|
227
|
+
)
|
228
|
+
|
229
|
+
|
230
|
+
def main_paging():
|
231
|
+
parser = argparse.ArgumentParser()
|
232
|
+
parser.add_argument("--server", help="Name of the server to display status for")
|
233
|
+
parser.add_argument("--url", help="URL Platform to connect to")
|
234
|
+
parser.add_argument("--userid", help="User Id")
|
235
|
+
parser.add_argument("--password", help="User Password")
|
236
|
+
|
237
|
+
args = parser.parse_args()
|
238
|
+
|
239
|
+
server = args.server if args.server is not None else EGERIA_VIEW_SERVER
|
240
|
+
url = args.url if args.url is not None else EGERIA_VIEW_SERVER_URL
|
241
|
+
userid = args.userid if args.userid is not None else EGERIA_USER
|
242
|
+
user_pass = args.password if args.password is not None else EGERIA_USER_PASSWORD
|
243
|
+
|
244
|
+
display_engine_activity_c(
|
245
|
+
server=server, url=url, user=userid, user_pass=user_pass, paging=True
|
246
|
+
)
|
247
|
+
|
248
|
+
|
249
|
+
if __name__ == "__main__":
|
250
|
+
main_live()
|
251
|
+
|
252
|
+
if __name__ == "__main_paging__":
|
253
|
+
main_paging()
|