Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

enables metadata.timestamp overwrite from the messages in amq sender #251

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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