Skip to content

Commit 5714a5f

Browse files
authored
Merge pull request #23 from dwolfson/v.40
several fixes to coco config and to some of the widgets
2 parents d40e2ae + 8e95f37 commit 5714a5f

File tree

8 files changed

+50
-126
lines changed

8 files changed

+50
-126
lines changed

examples/Coco_config/config_cocoMDS1.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -40,16 +40,16 @@
4040

4141
# Can also inherit event bus config from application properties
4242

43-
# event_bus_config = {
44-
# "producer": {
45-
# "bootstrap.servers": "localhost:9092"
46-
# },
47-
# "consumer": {
48-
# "bootstrap.servers": "localhost:9092"
49-
# }
50-
# }
51-
52-
# o_client.set_event_bus(event_bus_config)
43+
event_bus_config = {
44+
"producer": {
45+
"bootstrap.servers": "{{kafkaEndpoint}}"
46+
},
47+
"consumer": {
48+
"bootstrap.servers": "{{kafkaEndpoint}}"
49+
}
50+
}
51+
52+
o_client.set_event_bus(event_bus_config)
5353

5454
security_connection_body = {
5555
"class": "Connection",

examples/Coco_config/config_cocoMDS2.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -44,16 +44,16 @@
4444

4545
# Inherit event bus config
4646

47-
# event_bus_config = {
48-
# "producer": {
49-
# "bootstrap.servers": "localhost:9092"
50-
# },
51-
# "consumer": {
52-
# "bootstrap.servers": "localhost:9092"
53-
# }
54-
# }
55-
#
56-
# o_client.set_event_bus(event_bus_config)
47+
event_bus_config = {
48+
"producer": {
49+
"bootstrap.servers": "{{kafkaEndpoint}}"
50+
},
51+
"consumer": {
52+
"bootstrap.servers": "{{kafkaEndpoint}}"
53+
}
54+
}
55+
56+
o_client.set_event_bus(event_bus_config)
5757

5858
security_connection_body = {
5959
"class": "Connection",
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
import subprocess
2+
3+
startup_scripts = ["config_cocoMDS1.py", "config_cocoMDS2.py",
4+
"config_cocoMDS3.py", "config_cocoMDS4.py",
5+
"config_cocoMDS5.py", "config_cocoMDSx.py",
6+
"config_cocoView1.py", "config_exchangeDL01.py",
7+
"config_monitorDev01.py", "config_monitorGov01.py"]
8+
for script in startup_scripts:
9+
subprocess.call(["python",script])

examples/widgets/catalog_user/view_asset_graph.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,10 @@ def build_classifications(classification: dict) -> Markdown:
4848
if c_type == "Anchors":
4949
continue
5050
class_md += f"* Classification: {c_type}\n"
51-
class_props = c["classificationProperties"]
52-
for prop in class_props.keys():
53-
class_md += f"\t* {prop}: {class_props[prop]}\n"
51+
class_props = c.get("classificationProperties","---")
52+
if type(class_props) is list:
53+
for prop in class_props.keys():
54+
class_md += f"\t* {prop}: {class_props[prop]}\n"
5455
if class_md == "":
5556
output = None
5657
else:

examples/widgets/operational/view_asset_changes.py

Lines changed: 0 additions & 82 deletions
This file was deleted.

examples/widgets/operational/view_asset_events.py

Lines changed: 10 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@
1010
import time
1111
import argparse
1212
from confluent_kafka import Consumer, KafkaException
13-
14-
13+
from datetime import datetime
14+
from rich.prompt import Prompt
1515
from rich.table import Table
1616
from rich.live import Live
1717
from rich.console import Console
@@ -21,15 +21,18 @@
2121

2222
disable_ssl_warnings = True
2323
console = Console(width=200)
24-
24+
now = datetime.now()
25+
current_time = now.strftime("%H:%M:%S")
2526

2627
from confluent_kafka import Consumer, KafkaException
2728

29+
earliest_latest = Prompt.ask("Msgs from earliest or latest:", default="earliest")
30+
2831
# Define the Kafka consumer configuration.
2932
config = {
3033
'bootstrap.servers': 'localhost:9092', # replace with your Kafka broker(s)
31-
'group.id': "w4", # replace with your consumer group
32-
'auto.offset.reset': 'earliest' # can be set to 'earliest' or 'latest'
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'
3336
}
3437

3538
# Initialize a Kafka consumer.
@@ -54,14 +57,6 @@
5457

5558
type_name = event["elementHeader"]["type"]["typeName"]
5659
origin = event["elementHeader"]["origin"]["sourceServer"]
57-
# classifications = event['elementHeader']["classifications"]
58-
# classification_md = ""
59-
# for c in classifications:
60-
# cp = c.get("classificationProperties", None)
61-
# if cp is not None:
62-
# cl_name = c["classificationProperties"].get("name", None)
63-
# cl = cl_name if not None else c["classificationName"]
64-
# classification_md += f"* classifications: {cl}\n"
6560

6661
element_properties = event["elementProperties"]
6762
element_properties_keys = element_properties.keys()
@@ -72,10 +67,10 @@
7267
console.rule(style= "[bold red]")
7368
console.rule(f"\tMessage TimeStamp: {event_time}\t eventType: {event_type}\t typeName: {type_name}\t guid: {guid}")
7469
msg = (
75-
# f"classifications: \n{classification_md}\n"
70+
7671
f"properties: \n{props}\n\n")
7772
msg = Markdown(msg)
78-
# msg = json.dumps(event, indent=4)
73+
7974
console.print(msg)
8075
finally:
8176
# Close down consumer to commit final offsets.

tests/test_automated_curation_omvs.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
from rich.console import Console
1818
from rich.pretty import pprint
1919

20-
from pyegeria import AutomatedCuration
20+
from pyegeria import AutomatedCuration, PostgreSQL_Server_Integration_Connector_GUID
2121
from pyegeria._exceptions import (InvalidParameterException, PropertyServerException, UserNotAuthorizedException,
2222
print_exception_response, )
2323

@@ -834,11 +834,12 @@ def test_add_catalog_target(self):
834834
a_client = AutomatedCuration(self.good_view_server_1, self.good_platform1_url, user_id=self.good_user_2,
835835
user_pwd="secret")
836836
token = a_client.create_egeria_bearer_token()
837-
element_guid = "061a4fb3-7d41-4e52-9080-65e9c61084d2"
838-
catalog_target_name = "deltalake experiments"
839-
file_folder_integ_con = "cd6479e1-2fe7-4426-b358-8a0cf70be117"
837+
element_guid = "c155848f-60db-4265-aeb7-75cd7124806f"
838+
catalog_target_name = "laz postgres server"
839+
840840
start_time = time.perf_counter()
841-
guid = a_client.add_catalog_target(file_folder_integ_con, element_guid, catalog_target_name)
841+
guid = a_client.add_catalog_target(PostgreSQL_Server_Integration_Connector_GUID,
842+
element_guid, catalog_target_name)
842843
duration = time.perf_counter() - start_time
843844
print(f"guid returned is: {guid}")
844845
print(f"\n\tDuration was {duration} seconds")

tests/test_server_operations.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ def test_restart_integration_connector(self, server:str = good_server_2):
179179
print_exception_response(e)
180180
assert e.related_http_code != "200", "Invalid parameters"
181181

182-
def test_refresh_integration_connectors(self, server:str = good_server_2):
182+
def test_refresh_integration_connectors(self, server:str = good_server_3):
183183
try:
184184
server_name = "integration-daemon"
185185
connector = "FilesMonitor"

0 commit comments

Comments
 (0)