Skip to content

Commit

Permalink
record data may be binary
Browse files Browse the repository at this point in the history
  • Loading branch information
Ubuntu committed Oct 10, 2019
1 parent 32493e8 commit 37d4670
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions cufacesearch/cufacesearch/ingester/kinesis_ingester.py
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,7 @@ def get_msg_json(self):
print(msg.format(self.pp, len(records)))
if self.verbose > 4:
lag_ms = rec_response['MillisBehindLatest']
msg = "[{}: log] Lagging by {:.2f}s"
msg = "[{}: log] Lagging by {:.3f}s"
print(msg.format(self.pp, lag_ms/1000.0))
sleep_count = 0
for rec in records:
Expand All @@ -283,8 +283,14 @@ def get_msg_json(self):
try:
rec_json = json.loads(rec['Data'])
except ValueError:
msg = "[{}: WARNING] Could not parse record at SequenceNumber {}"
print(msg.format(self.pp, sqn))
if 'Data' in rec:
#msg = "[{}: WARNING] Could not parse record at SequenceNumber {}. rec['Data']: {}"
#print(msg.format(self.pp, sqn, rec['Data']))
msg = "[{}: WARNING] Could not parse record at SequenceNumber {}. rec['Data'] may contain binary data"
print(msg.format(self.pp, sqn))
else:
msg = "[{}: WARNING] Could not parse record at SequenceNumber {}. Record has no 'Data' field"
print(msg.format(self.pp, sqn))
continue
if self.verbose > 5:
#msg = "[{}: log] Found message at SequenceNumber {} in shard {}: {}"
Expand Down

0 comments on commit 37d4670

Please sign in to comment.