pyegeria 0.7.29__py3-none-any.whl → 0.7.30__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.
@@ -45,6 +45,7 @@ from examples.widgets.ops.integration_daemon_actions import (
45
45
  from examples.widgets.ops.list_catalog_targets import display_catalog_targets
46
46
  from examples.widgets.ops.load_archive import load_archive
47
47
  from examples.widgets.ops.monitor_engine_activity import display_engine_activity
48
+ from examples.widgets.ops.monitor_engine_activity_c import display_engine_activity_c
48
49
  from examples.widgets.ops.monitor_gov_eng_status import display_gov_eng_status
49
50
  from examples.widgets.ops.monitor_integ_daemon_status import (
50
51
  display_integration_daemon_status,
@@ -988,19 +989,36 @@ def gov_eng_status(ctx, list):
988
989
  @click.option(
989
990
  "--list", is_flag=True, default=False, help="If True, a paged list will be shown"
990
991
  )
992
+ @click.option(
993
+ "--compressed",
994
+ type=bool,
995
+ default=True,
996
+ help="Compressed combines some attributes into a single column",
997
+ )
991
998
  @click.pass_context
992
- def eng_activity_status(ctx, list):
999
+ def eng_activity_status(ctx, list, compressed):
993
1000
  """Show Governance Activity in engine-host"""
994
1001
  c = ctx.obj
995
- display_engine_activity(
996
- c.view_server,
997
- c.view_server_url,
998
- c.admin_user,
999
- c.admin_user_password,
1000
- list,
1001
- c.jupyter,
1002
- c.width,
1003
- )
1002
+ if compressed:
1003
+ display_engine_activity_c(
1004
+ c.view_server,
1005
+ c.view_server_url,
1006
+ c.admin_user,
1007
+ c.admin_user_password,
1008
+ list,
1009
+ c.jupyter,
1010
+ c.width,
1011
+ )
1012
+ else:
1013
+ display_engine_activity(
1014
+ c.view_server,
1015
+ c.view_server_url,
1016
+ c.admin_user,
1017
+ c.admin_user_password,
1018
+ list,
1019
+ c.jupyter,
1020
+ c.width,
1021
+ )
1004
1022
 
1005
1023
 
1006
1024
  @show.group("integrations")
@@ -14,18 +14,32 @@ from trogon import tui
14
14
 
15
15
  # from pyegeria import ServerOps
16
16
  from examples.widgets.cli.ops_config import Config
17
- from examples.widgets.ops.engine_actions import start_daemon as start_engine_host, \
18
- stop_daemon as stop_engine_host
19
- from examples.widgets.ops.integration_daemon_actions import (add_catalog_target, remove_catalog_target,
20
- update_catalog_target, stop_server, start_server)
17
+ from examples.widgets.ops.engine_actions import (
18
+ start_daemon as start_engine_host,
19
+ stop_daemon as stop_engine_host,
20
+ )
21
+ from examples.widgets.ops.integration_daemon_actions import (
22
+ add_catalog_target,
23
+ remove_catalog_target,
24
+ update_catalog_target,
25
+ stop_server,
26
+ start_server,
27
+ )
21
28
  from examples.widgets.ops.list_catalog_targets import display_catalog_targets
22
29
  from examples.widgets.ops.load_archive import load_archive
23
30
  from examples.widgets.ops.monitor_engine_activity import display_engine_activity
31
+ from examples.widgets.ops.monitor_engine_activity_c import display_engine_activity_c
24
32
  from examples.widgets.ops.monitor_gov_eng_status import display_gov_eng_status
25
- from examples.widgets.ops.monitor_integ_daemon_status import display_integration_daemon_status
26
- from examples.widgets.ops.monitor_platform_status import display_status as p_display_status
33
+ from examples.widgets.ops.monitor_integ_daemon_status import (
34
+ display_integration_daemon_status,
35
+ )
36
+ from examples.widgets.ops.monitor_platform_status import (
37
+ display_status as p_display_status,
38
+ )
27
39
  from examples.widgets.ops.monitor_server_list import display_status as display_list
28
- from examples.widgets.ops.monitor_server_status import display_status as s_display_status
40
+ from examples.widgets.ops.monitor_server_status import (
41
+ display_status as s_display_status,
42
+ )
29
43
  from examples.widgets.ops.refresh_integration_daemon import refresh_connector
30
44
  from examples.widgets.ops.restart_integration_daemon import restart_connector
31
45
 
@@ -43,47 +57,142 @@ from examples.widgets.ops.restart_integration_daemon import restart_connector
43
57
  #
44
58
  # pass_config = click.make_pass_decorator(Config)
45
59
 
60
+
46
61
  @tui()
47
62
  # @tui('menu', 'menu', 'A textual command line interface')
48
63
  @click.version_option("0.0.1", prog_name="egeria_ops")
49
64
  @click.group()
50
- @click.option('--server', default='active-metadata-store', envvar='EGERIA_METADATA_STORE',
51
- help='Egeria metadata store to work with')
52
- @click.option('--url', default='https://localhost:9443', envvar='EGERIA_PLATFORM_URL',
53
- help='URL of Egeria metadata store platform to connect to')
54
- @click.option('--integration-daemon', default='integration-daemon', envvar='EGERIA_INTEGRATION_DAEMON',
55
- help='Egeria integration daemon to work with')
56
- @click.option('--integration_daemon_url', default='https://localhost:9443', envvar='EGERIA_INTEGRATION_DAEMON_URL',
57
- help='URL of Egeria integration daemon platform to connect to')
58
- @click.option('--view_server', default='view-server', envvar='EGERIA_VIEW_SERVER',
59
- help='Egeria view server to work with')
60
- @click.option('--view_server_url', default='https://localhost:9443', envvar='EGERIA_VIEW_SERVER_URL',
61
- help='URL of Egeria view server platform to connect to')
62
- @click.option('--engine_host', default='engine-host', envvar='EGERIA_ENGINE_HOST',
63
- help='Egeria engine host to work with')
64
- @click.option('--engine_host_url', default='https://localhost:9443', envvar='EGERIA_ENGINE_HOST_URL',
65
- help='URL of Egeria engine host platform to connect to')
66
- @click.option('--admin_user', default='garygeeke', envvar='EGERIA_ADMIN_USER', help='Egeria admin user')
67
- @click.option('--admin_user_password', default='secret', envvar='EGERIA_ADMIN_PASSWORD',
68
- help='Egeria admin password')
69
- @click.option('--userid', default='erinoverview', envvar='EGERIA_USER', help='Egeria user')
70
- @click.option('--password', default='secret', envvar='EGERIA_PASSWORD',
71
- help='Egeria user password')
72
- @click.option('--timeout', default=60, help='Number of seconds to wait')
73
- @click.option('--verbose', is_flag=True, default=False, help='Enable verbose mode')
74
- @click.option('--paging', is_flag=True, default=False, help='Enable paging snapshots vs live updates')
75
- @click.option('--jupyter', is_flag=True, default=False, envvar='EGERIA_JUPYTER',
76
- help='Enable for rendering in a Jupyter terminal')
77
- @click.option('--width', default=200, envvar='EGERIA_WIDTH', help='Screen width, in characters, to use')
65
+ @click.option(
66
+ "--server",
67
+ default="active-metadata-store",
68
+ envvar="EGERIA_METADATA_STORE",
69
+ help="Egeria metadata store to work with",
70
+ )
71
+ @click.option(
72
+ "--url",
73
+ default="https://localhost:9443",
74
+ envvar="EGERIA_PLATFORM_URL",
75
+ help="URL of Egeria metadata store platform to connect to",
76
+ )
77
+ @click.option(
78
+ "--integration-daemon",
79
+ default="integration-daemon",
80
+ envvar="EGERIA_INTEGRATION_DAEMON",
81
+ help="Egeria integration daemon to work with",
82
+ )
83
+ @click.option(
84
+ "--integration_daemon_url",
85
+ default="https://localhost:9443",
86
+ envvar="EGERIA_INTEGRATION_DAEMON_URL",
87
+ help="URL of Egeria integration daemon platform to connect to",
88
+ )
89
+ @click.option(
90
+ "--view_server",
91
+ default="view-server",
92
+ envvar="EGERIA_VIEW_SERVER",
93
+ help="Egeria view server to work with",
94
+ )
95
+ @click.option(
96
+ "--view_server_url",
97
+ default="https://localhost:9443",
98
+ envvar="EGERIA_VIEW_SERVER_URL",
99
+ help="URL of Egeria view server platform to connect to",
100
+ )
101
+ @click.option(
102
+ "--engine_host",
103
+ default="engine-host",
104
+ envvar="EGERIA_ENGINE_HOST",
105
+ help="Egeria engine host to work with",
106
+ )
107
+ @click.option(
108
+ "--engine_host_url",
109
+ default="https://localhost:9443",
110
+ envvar="EGERIA_ENGINE_HOST_URL",
111
+ help="URL of Egeria engine host platform to connect to",
112
+ )
113
+ @click.option(
114
+ "--admin_user",
115
+ default="garygeeke",
116
+ envvar="EGERIA_ADMIN_USER",
117
+ help="Egeria admin user",
118
+ )
119
+ @click.option(
120
+ "--admin_user_password",
121
+ default="secret",
122
+ envvar="EGERIA_ADMIN_PASSWORD",
123
+ help="Egeria admin password",
124
+ )
125
+ @click.option(
126
+ "--userid", default="erinoverview", envvar="EGERIA_USER", help="Egeria user"
127
+ )
128
+ @click.option(
129
+ "--password",
130
+ default="secret",
131
+ envvar="EGERIA_PASSWORD",
132
+ help="Egeria user password",
133
+ )
134
+ @click.option("--timeout", default=60, help="Number of seconds to wait")
135
+ @click.option("--verbose", is_flag=True, default=False, help="Enable verbose mode")
136
+ @click.option(
137
+ "--paging",
138
+ is_flag=True,
139
+ default=False,
140
+ help="Enable paging snapshots vs live updates",
141
+ )
142
+ @click.option(
143
+ "--jupyter",
144
+ is_flag=True,
145
+ default=False,
146
+ envvar="EGERIA_JUPYTER",
147
+ help="Enable for rendering in a Jupyter terminal",
148
+ )
149
+ @click.option(
150
+ "--width",
151
+ default=200,
152
+ envvar="EGERIA_WIDTH",
153
+ help="Screen width, in characters, to use",
154
+ )
78
155
  @click.pass_context
79
- def cli(ctx, server, url, view_server, view_server_url, integration_daemon, integration_daemon_url,
80
- engine_host, engine_host_url, admin_user, admin_user_password, userid, password, timeout, paging,
81
- verbose, jupyter, width):
82
- """An Egeria Command Line interface for Operations """
83
- ctx.obj = Config(server, url, view_server, view_server_url, integration_daemon,
84
- integration_daemon_url, engine_host, engine_host_url,
85
- admin_user, admin_user_password, userid, password,
86
- timeout, paging, verbose, jupyter, width)
156
+ def cli(
157
+ ctx,
158
+ server,
159
+ url,
160
+ view_server,
161
+ view_server_url,
162
+ integration_daemon,
163
+ integration_daemon_url,
164
+ engine_host,
165
+ engine_host_url,
166
+ admin_user,
167
+ admin_user_password,
168
+ userid,
169
+ password,
170
+ timeout,
171
+ paging,
172
+ verbose,
173
+ jupyter,
174
+ width,
175
+ ):
176
+ """An Egeria Command Line interface for Operations"""
177
+ ctx.obj = Config(
178
+ server,
179
+ url,
180
+ view_server,
181
+ view_server_url,
182
+ integration_daemon,
183
+ integration_daemon_url,
184
+ engine_host,
185
+ engine_host_url,
186
+ admin_user,
187
+ admin_user_password,
188
+ userid,
189
+ password,
190
+ timeout,
191
+ paging,
192
+ verbose,
193
+ jupyter,
194
+ width,
195
+ )
87
196
  ctx.max_content_width = 200
88
197
  ctx.ensure_object(Config)
89
198
  if verbose:
@@ -97,20 +206,21 @@ def show(ctx):
97
206
  pass
98
207
 
99
208
 
100
- @show.group('platforms')
209
+ @show.group("platforms")
101
210
  @click.pass_context
102
211
  def show_platform(ctx):
103
212
  """Group of commands to show information about Egeria platforms"""
104
213
  pass
105
214
 
106
215
 
107
- @show_platform.command('status')
216
+ @show_platform.command("status")
108
217
  @click.pass_context
109
218
  def show_platform_status(ctx):
110
219
  """Display a live status view of known platforms"""
111
220
  c = ctx.obj
112
- p_display_status(c.view_server, c.view_server_url,
113
- c.admin_user, c.admin_user_password)
221
+ p_display_status(
222
+ c.view_server, c.view_server_url, c.admin_user, c.admin_user_password
223
+ )
114
224
 
115
225
 
116
226
  @show.group("servers")
@@ -120,17 +230,35 @@ def show_server(ctx):
120
230
  pass
121
231
 
122
232
 
123
- @show_server.command('status')
124
- @click.option('--full', is_flag=True, default=False, help='If True, full server descriptions will be shown')
233
+ @show_server.command("status")
234
+ @click.option(
235
+ "--full",
236
+ is_flag=True,
237
+ default=False,
238
+ help="If True, full server descriptions will be shown",
239
+ )
125
240
  @click.pass_context
126
241
  def show_server_status(ctx, full):
127
242
  """Display a live status view of Egeria servers for the specified Egeria platform"""
128
243
  c = ctx.obj
129
244
  if full:
130
- display_list(c.metadata_store, c.metadata_store_url, c.admin_user, c.admin_user_password, c.jupyter, c.width)
245
+ display_list(
246
+ c.metadata_store,
247
+ c.metadata_store_url,
248
+ c.admin_user,
249
+ c.admin_user_password,
250
+ c.jupyter,
251
+ c.width,
252
+ )
131
253
  else:
132
- s_display_status(c.metadata_store, c.metadata_store_url, c.admin_user, c.admin_user_password, c.jupyter,
133
- c.width)
254
+ s_display_status(
255
+ c.metadata_store,
256
+ c.metadata_store_url,
257
+ c.admin_user,
258
+ c.admin_user_password,
259
+ c.jupyter,
260
+ c.width,
261
+ )
134
262
 
135
263
 
136
264
  @show.group("engines")
@@ -141,28 +269,55 @@ def engine_host(ctx):
141
269
 
142
270
 
143
271
  @engine_host.command("status")
144
- @click.option('--list', is_flag=True, default=False, help='If True, a paged list will be shown')
272
+ @click.option(
273
+ "--list", is_flag=True, default=False, help="If True, a paged list will be shown"
274
+ )
145
275
  @click.pass_context
146
276
  def gov_eng_status(ctx, list):
147
277
  """Display engine-host status information"""
148
278
  c = ctx.obj
149
- display_gov_eng_status(c.engine_host, c.engine_host_url,
150
- c.userid, c.password,
151
- list, c.jupyter, c.width)
152
-
153
-
154
- @engine_host.command('activity')
155
- @click.option('--list', is_flag=True, default=False, help='If True, a paged list will be shown')
279
+ display_gov_eng_status(
280
+ c.engine_host, c.engine_host_url, c.userid, c.password, list, c.jupyter, c.width
281
+ )
282
+
283
+
284
+ @engine_host.command("activity")
285
+ @click.option(
286
+ "--compressed",
287
+ type=bool,
288
+ default=True,
289
+ help="Compressed combines some attributes into a single column",
290
+ )
291
+ @click.option(
292
+ "--list", is_flag=True, default=False, help="If True, a paged list will be shown"
293
+ )
156
294
  @click.pass_context
157
- def eng_activity_status(ctx, list):
295
+ def eng_activity_status(ctx, list, compressed):
158
296
  """Show Governance Activity in engine-host"""
159
297
  c = ctx.obj
160
- display_engine_activity(c.view_server, c.view_server_url,
161
- c.admin_user, c.admin_user_password,
162
- list, c.jupyter, c.width)
163
-
164
-
165
- @show.group('integrations')
298
+ if compressed:
299
+ display_engine_activity_c(
300
+ c.view_server,
301
+ c.view_server_url,
302
+ c.admin_user,
303
+ c.admin_user_password,
304
+ list,
305
+ c.jupyter,
306
+ c.width,
307
+ )
308
+ else:
309
+ display_engine_activity(
310
+ c.view_server,
311
+ c.view_server_url,
312
+ c.admin_user,
313
+ c.admin_user_password,
314
+ list,
315
+ c.jupyter,
316
+ c.width,
317
+ )
318
+
319
+
320
+ @show.group("integrations")
166
321
  @click.pass_context
167
322
  def integrations(ctx):
168
323
  """Group of commands to show information about Egeria integrations"""
@@ -170,62 +325,90 @@ def integrations(ctx):
170
325
 
171
326
 
172
327
  @integrations.command("status")
173
- @click.option('--list', is_flag=True, default=False, help='If True, a paged list will be shown')
328
+ @click.option(
329
+ "--list", is_flag=True, default=False, help="If True, a paged list will be shown"
330
+ )
174
331
  @click.pass_context
175
332
  def integrations_status(ctx, list):
176
333
  """Display integration-daemon status information"""
177
334
  c = ctx.obj
178
- display_integration_daemon_status(c.integration_daemon, c.integration_daemon_url,
179
- c.view_server, c.view_server_url,
180
- c.userid, c.password, list, c.jupyter, c.width)
335
+ display_integration_daemon_status(
336
+ c.integration_daemon,
337
+ c.integration_daemon_url,
338
+ c.view_server,
339
+ c.view_server_url,
340
+ c.userid,
341
+ c.password,
342
+ list,
343
+ c.jupyter,
344
+ c.width,
345
+ )
181
346
 
182
347
 
183
348
  @integrations.command("targets")
184
349
  @click.pass_context
185
- @click.argument('connector', nargs=1)
350
+ @click.argument("connector", nargs=1)
186
351
  def integrations_status(ctx, connector):
187
352
  """Display Catalog Targets for a connector"""
188
353
  c = ctx.obj
189
- display_catalog_targets(connector, c.view_server, c.view_server_url,
190
- c.userid, c.password, c.jupyter, c.width)
354
+ display_catalog_targets(
355
+ connector,
356
+ c.view_server,
357
+ c.view_server_url,
358
+ c.userid,
359
+ c.password,
360
+ c.jupyter,
361
+ c.width,
362
+ )
191
363
 
192
364
 
193
365
  #
194
366
  # Tell
195
367
  #
196
368
 
197
- @cli.group('tell')
369
+
370
+ @cli.group("tell")
198
371
  @click.pass_context
199
372
  def tell(ctx):
200
373
  """Perform actions an Egeria Objects"""
201
374
  pass
202
375
 
203
376
 
204
- @tell.group('integration-daemon')
377
+ @tell.group("integration-daemon")
205
378
  @click.pass_context
206
379
  def integration_daemon(ctx):
207
380
  """Group of commands to an integration-daemon"""
208
381
  pass
209
382
 
210
383
 
211
- @integration_daemon.command('refresh')
384
+ @integration_daemon.command("refresh")
212
385
  @click.pass_context
213
- @click.option('--connector', default='all', help="Name of connector to refresh or 'all' to refresh all")
386
+ @click.option(
387
+ "--connector",
388
+ default="all",
389
+ help="Name of connector to refresh or 'all' to refresh all",
390
+ )
214
391
  def refresh_connectors(ctx, connector):
215
392
  """Refresh the specified integration connector or ALL connectors if not specified"""
216
393
  c = ctx.obj
217
- refresh_connector(connector, c.integration_daemon, c.integration_daemon_url,
218
- c.userid, c.password)
394
+ refresh_connector(
395
+ connector, c.integration_daemon, c.integration_daemon_url, c.userid, c.password
396
+ )
219
397
 
220
398
 
221
- @integration_daemon.command('restart')
399
+ @integration_daemon.command("restart")
222
400
  @click.pass_context
223
- @click.option('--connector', default='all', help="Name of connector to restart or 'all' to restart all")
401
+ @click.option(
402
+ "--connector",
403
+ default="all",
404
+ help="Name of connector to restart or 'all' to restart all",
405
+ )
224
406
  def restart_connectors(ctx, connector):
225
407
  """Restart the specified integration connector or ALL connectors if not specified"""
226
408
  c = ctx.obj
227
- restart_connector(connector, c.integration_daemon, c.integration_daemon_url,
228
- c.userid, c.password)
409
+ restart_connector(
410
+ connector, c.integration_daemon, c.integration_daemon_url, c.userid, c.password
411
+ )
229
412
 
230
413
 
231
414
  integration_daemon.add_command(add_catalog_target)
@@ -235,7 +418,7 @@ integration_daemon.add_command(stop_server)
235
418
  integration_daemon.add_command(start_server)
236
419
 
237
420
 
238
- @tell.group('engine-host')
421
+ @tell.group("engine-host")
239
422
  @click.pass_context
240
423
  def engine_host(ctx):
241
424
  """Group of commands to an engine-host"""
@@ -245,14 +428,16 @@ def engine_host(ctx):
245
428
  engine_host.add_command(start_engine_host)
246
429
  engine_host.add_command(stop_engine_host)
247
430
 
248
- @tell.group('repository')
431
+
432
+ @tell.group("repository")
249
433
  @click.pass_context
250
434
  def repository(ctx):
251
435
  """Group of commands to a repository"""
252
436
  pass
253
437
 
438
+
254
439
  repository.add_command(load_archive)
255
440
 
256
441
 
257
- if __name__ == '__main__':
442
+ if __name__ == "__main__":
258
443
  cli()
@@ -89,7 +89,9 @@ def display_engine_activity(
89
89
  token = g_client.create_egeria_bearer_token()
90
90
  action_status = g_client.get_engine_actions()
91
91
  sorted_action_status = sorted(
92
- action_status, key=lambda i: i["requestedTime"], reverse=True
92
+ action_status,
93
+ key=lambda i: i("requestedTime", time.asctime()),
94
+ reverse=True,
93
95
  )
94
96
  if type(action_status) is str:
95
97
  requested_time = " "
@@ -0,0 +1,237 @@
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("KAFKA_ENDPOINT", "localhost:9092")
34
+ EGERIA_PLATFORM_URL = os.environ.get("EGERIA_PLATFORM_URL", "https://localhost:9443")
35
+ EGERIA_VIEW_SERVER = os.environ.get("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("INTEGRATION_ENGINE_HOST", "engine-host")
40
+ EGERIA_ENGINE_HOST_URL = os.environ.get(
41
+ "INTEGRATION_ENGINE_HOST_URL", "https://localhost:9443"
42
+ )
43
+ EGERIA_INTEGRATION_DAEMON = os.environ.get("INTEGRATION_DAEMON", "integration-daemon")
44
+ EGERIA_ADMIN_USER = os.environ.get("ADMIN_USER", "garygeeke")
45
+ EGERIA_ADMIN_PASSWORD = os.environ.get("ADMIN_PASSWORD", "secret")
46
+ EGERIA_USER = os.environ.get("EGERIA_USER", "erinoverview")
47
+ EGERIA_USER_PASSWORD = os.environ.get("EGERIA_USER_PASSWORD", "secret")
48
+ EGERIA_JUPYTER = bool(os.environ.get("EGERIA_JUPYTER", "False"))
49
+ EGERIA_WIDTH = int(os.environ.get("EGERIA_WIDTH", "200"))
50
+
51
+ disable_ssl_warnings = True
52
+
53
+
54
+ def display_engine_activity_c(
55
+ server: str,
56
+ url: str,
57
+ user: str,
58
+ user_pass: str,
59
+ paging: bool,
60
+ jupyter: bool = EGERIA_JUPYTER,
61
+ width=EGERIA_WIDTH,
62
+ ):
63
+ g_client = AutomatedCuration(server, url, user, user_pwd=user_pass)
64
+
65
+ def generate_table() -> Table:
66
+ """Make a new table."""
67
+ table = Table(
68
+ title=f"Engine Action Status for Platform {url} @ {time.asctime()}",
69
+ style="bold white on black",
70
+ row_styles=["bold white on black"],
71
+ header_style="white on dark_blue",
72
+ title_style="bold white on black",
73
+ caption_style="white on black",
74
+ show_lines=True,
75
+ box=box.ROUNDED,
76
+ caption=f"Engine Status for Server '{server}' @ Platform - {url}",
77
+ expand=True,
78
+ )
79
+ table.add_column("Requested Time")
80
+ table.add_column("Core Info")
81
+
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
+ sorted_action_status = sorted(
92
+ action_status,
93
+ key=lambda i: i.get("requestedTime", time.asctime()),
94
+ reverse=True,
95
+ )
96
+ if type(action_status) is str:
97
+ requested_time = " "
98
+ start_time = " "
99
+ completion_time = " "
100
+ engine_name = " "
101
+ request_type = " "
102
+ action_status = " "
103
+ target_element = " "
104
+ process_name = " "
105
+ completion_message = " "
106
+ elif type(action_status) is list:
107
+ for action in sorted_action_status:
108
+ requested_time = action.get("requestedTime", " ")
109
+ start_time = action.get("startTime", " ")
110
+ completion_time = action.get("completionTime", " ")
111
+
112
+ engine_name = action["governanceEngineName"]
113
+ request_type = action["requestType"]
114
+ action_guid = action["elementHeader"]["guid"]
115
+ if action["actionStatus"] in (
116
+ "REQUESTED",
117
+ "APPROVED",
118
+ "WAITING",
119
+ "ACTIVATING",
120
+ ):
121
+ action_status = f"[yellow]{action['actionStatus']}"
122
+ elif action["actionStatus"] in ("IN_PROGRESS", "ACTIONED"):
123
+ action_status = f"[green]{action['actionStatus']}"
124
+ else:
125
+ action_status = f"[red]{action['actionStatus']}"
126
+
127
+ targets = action.get("actionTargetElements", "Empty")
128
+ if type(targets) is list:
129
+ tgt_tab = Table()
130
+ tgt_tab.add_column("name")
131
+ tgt_tab.add_column("guid", no_wrap=True)
132
+ tgt_tab.add_column("type_name")
133
+ targets_md = ""
134
+ for target in targets:
135
+ t_name = target["actionTargetName"]
136
+ t_guid = target["actionTargetGUID"]
137
+ t_type = target["targetElement"]["type"]["typeName"]
138
+ tgt_tab.add_row(t_name, t_guid, t_type)
139
+ # target_element = json.dumps(target[0]["targetElement"]["elementProperties"]["propertiesAsStrings"])
140
+ target_element = tgt_tab
141
+ else:
142
+ target_element = " "
143
+
144
+ process_name = action.get("processName", " ")
145
+ completion_message = action.get("completionMessage", " ")
146
+
147
+ core_info_md = (
148
+ f"* Start Time: {start_time}\n* Engine Name: {engine_name}\n* GUID: {action_guid}\n"
149
+ f"* Request TYpe: {request_type}"
150
+ )
151
+ core_info_out = Markdown(core_info_md)
152
+ table.add_row(
153
+ requested_time,
154
+ core_info_out,
155
+ action_status,
156
+ target_element,
157
+ completion_time,
158
+ process_name,
159
+ completion_message,
160
+ )
161
+ else:
162
+ print("Egeria integration daemon not running")
163
+ sys.exit()
164
+
165
+ return table
166
+
167
+ try:
168
+ if paging is True:
169
+ console = Console(width=width, force_terminal=not jupyter)
170
+ with console.pager():
171
+ console.print(generate_table())
172
+ else:
173
+ with Live(
174
+ generate_table(),
175
+ refresh_per_second=1,
176
+ screen=True,
177
+ vertical_overflow="visible",
178
+ ) as live:
179
+ while True:
180
+ time.sleep(2)
181
+ live.update(generate_table())
182
+
183
+ except (
184
+ InvalidParameterException,
185
+ PropertyServerException,
186
+ UserNotAuthorizedException,
187
+ ) as e:
188
+ print_exception_response(e)
189
+ except KeyboardInterrupt:
190
+ pass
191
+ finally:
192
+ g_client.close_session()
193
+
194
+
195
+ def main_live():
196
+ parser = argparse.ArgumentParser()
197
+ parser.add_argument("--server", help="Name of the server to display status for")
198
+ parser.add_argument("--url", help="URL Platform to connect to")
199
+ parser.add_argument("--userid", help="User Id")
200
+ parser.add_argument("--password", help="User Password")
201
+
202
+ args = parser.parse_args()
203
+
204
+ server = args.server if args.server is not None else EGERIA_VIEW_SERVER
205
+ url = args.url if args.url is not None else EGERIA_VIEW_SERVER_URL
206
+ userid = args.userid if args.userid is not None else EGERIA_USER
207
+ user_pass = args.password if args.password is not None else EGERIA_USER_PASSWORD
208
+
209
+ display_engine_activity_c(
210
+ server=server, url=url, user=userid, user_pass=user_pass, paging=False
211
+ )
212
+
213
+
214
+ def main_paging():
215
+ parser = argparse.ArgumentParser()
216
+ parser.add_argument("--server", help="Name of the server to display status for")
217
+ parser.add_argument("--url", help="URL Platform to connect to")
218
+ parser.add_argument("--userid", help="User Id")
219
+ parser.add_argument("--password", help="User Password")
220
+
221
+ args = parser.parse_args()
222
+
223
+ server = args.server if args.server is not None else EGERIA_VIEW_SERVER
224
+ url = args.url if args.url is not None else EGERIA_VIEW_SERVER_URL
225
+ userid = args.userid if args.userid is not None else EGERIA_USER
226
+ user_pass = args.password if args.password is not None else EGERIA_USER_PASSWORD
227
+
228
+ display_engine_activity_c(
229
+ server=server, url=url, user=userid, user_pass=user_pass, paging=True
230
+ )
231
+
232
+
233
+ if __name__ == "__main__":
234
+ main_live()
235
+
236
+ if __name__ == "__main_paging__":
237
+ main_paging()
@@ -88,7 +88,9 @@ def display_integration_daemon_status(
88
88
 
89
89
  reports = daemon_status["integrationConnectorReports"]
90
90
  if sort is True:
91
- connector_reports = sorted(reports, key=lambda x: x["connectorName"])
91
+ connector_reports = sorted(
92
+ reports, key=lambda x: x.get("connectorName", "---")
93
+ )
92
94
  else:
93
95
  connector_reports = reports
94
96
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: pyegeria
3
- Version: 0.7.29
3
+ Version: 0.7.30
4
4
  Summary: A python client for Egeria
5
5
  Home-page: https://github.com/odpi/egeria-python
6
6
  License: Apache 2.0
@@ -17,10 +17,10 @@ examples/widgets/cat/list_tech_types.py,sha256=20T4v6L5qeebSsaL1nGkFMDAIsy2W3A3S
17
17
  examples/widgets/cat/list_todos.py,sha256=_Pe3h74doX_cOoe0Z5_FvZtETBk3tkw2evfRpRgai5E,6283
18
18
  examples/widgets/cat/list_user_ids.py,sha256=7JinL7rknPbGusIb8ikXKEaV1vvbuvx_WWtbmlfS_DY,5093
19
19
  examples/widgets/cli/__init__.py,sha256=6d_R0KZBNnJy9EBz9J2xvGFlx-3j_ZPqPCxKgdvYeDQ,291
20
- examples/widgets/cli/egeria.py,sha256=LbF6ZsjhAsr-DBJCewdrBiVmD9D0tkn7KuaCXZFRP78,27490
20
+ examples/widgets/cli/egeria.py,sha256=7XqRhtHtWq2vfH4MCNpxqnNsYEsbKIRHW7GFE2AYjkg,28017
21
21
  examples/widgets/cli/egeria_cat.py,sha256=h029HG863NFocEYiy6hCmIBGdOiLEJQx6WACNXNLUBE,11964
22
22
  examples/widgets/cli/egeria_my.py,sha256=cGehUFrJKwNQ49CQ-rEX0M-6yjviRSb9KQjAcKD7Mq4,5993
23
- examples/widgets/cli/egeria_ops.py,sha256=az3P2GkHc-DfkFdD92ulw7TZ0XjwWPWP0pGBMc2RYQY,10139
23
+ examples/widgets/cli/egeria_ops.py,sha256=u0GLBbDuM7eHRdfKCyqGH3icWDclvkfofbfZoq6ObHA,11116
24
24
  examples/widgets/cli/egeria_tech.py,sha256=AA2PNDKebdDObtrmjF6BHaSuSpNVeQgB61CSX1cBvsg,10255
25
25
  examples/widgets/cli/ops_config.py,sha256=m4AfPjf-fR4EBTx8Dc2mcgrfWwAxb30YGeV-v79bg4U,1450
26
26
  examples/widgets/my/README.md,sha256=ZheFhj_VoPMhcWjW3pGchHB0vH_A9PklSmrSkzKdrcQ,844
@@ -39,9 +39,10 @@ examples/widgets/ops/list_catalog_targets.py,sha256=0FIZqZu7DSh7tnrme6EOhNiVvK8w
39
39
  examples/widgets/ops/load_archive.py,sha256=duf3wq2ANRBiOj9KTFsw8TseEkJLKdzITAeTCjsMvI0,2453
40
40
  examples/widgets/ops/monitor_asset_events.py,sha256=cjdlVqE0XYnoRW3aorNbsVkjByDXefPBnllaZLelGls,3838
41
41
  examples/widgets/ops/monitor_coco_status.py,sha256=ERz3OJ0TXImNKHGD4gJvgT3pl2gS23ewAdUuYVLUhEE,3299
42
- examples/widgets/ops/monitor_engine_activity.py,sha256=qMtthJKCYck0palkgacwSApyQOAaEiK2ZA8L0a2qfQc,8413
42
+ examples/widgets/ops/monitor_engine_activity.py,sha256=OkGoUYsJA4SWQl9xB0iOMSd2hoAv7TxnuiWylq3MO4U,8454
43
+ examples/widgets/ops/monitor_engine_activity_c.py,sha256=VOX3E_FaSAmDNGtyY7tOhxX_MF0LJ67n3G9ZWhMtqC8,8575
43
44
  examples/widgets/ops/monitor_gov_eng_status.py,sha256=QwSIzXDn81gJr36jTgJ-3JR0iAV6BPDfP1b7K9eCZlE,6162
44
- examples/widgets/ops/monitor_integ_daemon_status.py,sha256=NqviLqgykr45Fmf1CePeIqRTCn4gvSa6aykjvH9Gy0A,9183
45
+ examples/widgets/ops/monitor_integ_daemon_status.py,sha256=u15-tvGveO7_yV7JJmYkxiEDnq5KBk8J4hkw0id_LFA,9224
45
46
  examples/widgets/ops/monitor_platform_status.py,sha256=mgEeRjv2mIRBUxusHqeQGeoOp8Ehlk2IX-t3qtLKFqs,6123
46
47
  examples/widgets/ops/monitor_server_list.py,sha256=eHSeM5dW7Wyjp2zR_AD6_FalFnZ2dBaZKxtob2kva9I,4483
47
48
  examples/widgets/ops/monitor_server_status.py,sha256=A-8hMDfbscdcq-b1OD4wKn0tphumX8WIK-Hz8uPoFkc,3974
@@ -88,8 +89,8 @@ pyegeria/runtime_manager_omvs.py,sha256=oSVFeG_yBGXIvQR0EClLZqTZ6C5z5ReZzwm8cce8
88
89
  pyegeria/server_operations.py,sha256=1z2wZLdrNZG6HlswY_Eh8qI1mlcjsQ59zO-AMy9XbUU,16605
89
90
  pyegeria/utils.py,sha256=pkVmS3RrbjaS9yz7FtOCwaOfV5FMqz-__Rt5koCnd9c,5374
90
91
  pyegeria/valid_metadata_omvs.py,sha256=aisdRodIwJSkyArAzfm_sEnBELh69xE8k4Nea-vHu8M,36745
91
- pyegeria-0.7.29.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
92
- pyegeria-0.7.29.dist-info/METADATA,sha256=OxtFFPY5YsJetc3--FO-SFeHZlDsuhq-jdAphAcTvP4,2818
93
- pyegeria-0.7.29.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
94
- pyegeria-0.7.29.dist-info/entry_points.txt,sha256=22oy5-EM37ldb_-MPtiJygwXU217h8vb2_zT-7vn-yc,3571
95
- pyegeria-0.7.29.dist-info/RECORD,,
92
+ pyegeria-0.7.30.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
93
+ pyegeria-0.7.30.dist-info/METADATA,sha256=GUv23ihEaAeJlNKti02n5h3QumwbjBKoYQN5SEl3V98,2818
94
+ pyegeria-0.7.30.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
95
+ pyegeria-0.7.30.dist-info/entry_points.txt,sha256=22oy5-EM37ldb_-MPtiJygwXU217h8vb2_zT-7vn-yc,3571
96
+ pyegeria-0.7.30.dist-info/RECORD,,