Rfaulk has submitted this change and it was merged.
Change subject: add. method to retrieve all items from the broker queue.
......................................................................
add. method to retrieve all items from the broker queue.
Change-Id: I250ff95cf7c1797dce45ab3ba27cac3e0b6339e3
---
M user_metrics/api/broker.py
1 file changed, 18 insertions(+), 0 deletions(-)
Approvals:
Rfaulk: Verified; Looks good to me, approved
diff --git a/user_metrics/api/broker.py b/user_metrics/api/broker.py
index eb30d39..439ad9a 100644
--- a/user_metrics/api/broker.py
+++ b/user_metrics/api/broker.py
@@ -136,6 +136,24 @@
return None
+ def get_all_itmes(self, target):
+ """
+ Retrieve all values in the target
+ """
+ all_keys = list()
+ try:
+ with open(target, 'r') as f:
+ lines = f.read().split('\n')
+ for idx, line in enumerate(lines):
+ item = json.loads(line)
+ all_keys.append(item)
+ except IOError:
+ with open(target, 'w'):
+ pass
+
+ return None
+ return all_keys
+
def pop(self, target):
"""
Pop the top value from the list
--
To view, visit https://gerrit.wikimedia.org/r/78778
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I250ff95cf7c1797dce45ab3ba27cac3e0b6339e3
Gerrit-PatchSet: 1
Gerrit-Project: analytics/user-metrics
Gerrit-Branch: master
Gerrit-Owner: Rfaulk <[email protected]>
Gerrit-Reviewer: Rfaulk <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits