Skip to content

Commit

Permalink
Merge pull request #251 from Panos512/20231019_allows_overwriting_tim…
Browse files Browse the repository at this point in the history
…estamps

enables metadata.timestamp overwrite from the messages in amq sender
  • Loading branch information
nikodemas authored Oct 19, 2023
2 parents ab2177c + 4ce894f commit ac40b45
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/python/CMSMonitoring/amq_sender.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ def to_chunks(data, samples=1000):
yield data[i : i + samples]


def send_to_amq(data, confs, batch_size, topic=None, doc_type=None):
def send_to_amq(data, confs, batch_size, topic=None, doc_type=None, overwrite_meta_ts=False):
"""Sends list of dictionary in chunks"""
wait_seconds = 0.001
if confs:
Expand Down Expand Up @@ -54,8 +54,9 @@ def send_to_amq(data, confs, batch_size, topic=None, doc_type=None):
)
messages = []
for msg in chunk:
ts = None if not overwrite_meta_ts else msg.get("timestamp")
notif, _, _ = stomp_amq.make_notification(
payload=msg, doc_type=doc_type, producer=producer
payload=msg, doc_type=doc_type, producer=producer, ts=ts
)
messages.append(notif)
if messages:
Expand Down

0 comments on commit ac40b45

Please sign in to comment.