Skip to content

Commit

Permalink
fixup!: log on success
Browse files Browse the repository at this point in the history
  • Loading branch information
Rebecca Graber committed Aug 22, 2023
1 parent 79c2afa commit 9e77e1a
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions edx_arch_experiments/scripts/republish_failed_events.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,9 @@ def read_and_send_events(filename):
with open(filename) as log_file:
reader = csv.DictReader(log_file)
# Make sure csv contains all necessary columns for republishing
if not all(column in reader.fieldnames for column in log_columns):
print(f'Missing required columns {set(log_columns).difference(set(reader.fieldnames))}. Cannot'
f' republish events.')
missing_columns = set(log_columns).difference(set(reader.fieldnames))
if len(missing_columns) > 0:
print(f'Missing required columns {missing_columns}. Cannot republish events.')
sys.exit(1)
ids = set()
for row in reader:
Expand All @@ -71,6 +71,8 @@ def read_and_send_events(filename):

producer.send(signal=signal, event_data=event_data, event_key_field=event_key_field, topic=topic,
event_metadata=metadata)
print(f'Successfuly published event to event bus. {event_data=} {topic=} {event_key_field=}'
f' metadata={metadata.to_json()}')
finally:
producer.prepare_for_shutdown()

Expand Down

0 comments on commit 9e77e1a

Please sign in to comment.