Skip to content

Commit

Permalink
Merge pull request #769 from shankari/minor_fixes_from_ceo
Browse files Browse the repository at this point in the history
Minor fixes from ceo
  • Loading branch information
shankari authored Sep 15, 2020
2 parents 02d23b2 + 46001af commit 0475b45
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 1 deletion.
6 changes: 5 additions & 1 deletion bin/push/push_to_users.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import uuid
import emission.storage.decorations.user_queries as esdu
import emission.net.ext_service.push.notify_usage as pnu
import emission.net.ext_service.push.notify_queries as pnq
import emission.core.wrapper.user as ecwu

if __name__ == '__main__':
Expand All @@ -25,14 +26,17 @@
group = parser.add_mutually_exclusive_group(required=True)
group.add_argument("-e", "--user_email", nargs="+")
group.add_argument("-u", "--user_uuid", nargs="+")
group.add_argument("-p", "--platform")
group.add_argument("-a", "--all", action="store_true")
parser.add_argument("-d", "--dev", action="store_true", default=False)

args = parser.parse_args()

if args.user_uuid:
uuid_list = [uuid.UUID(uuid_str) for uuid_str in args.user_uuid]
if args.all:
elif args.platform:
uuid_list = pnq.get_matching_user_ids(pnq.get_platform_query(args.platform))
elif args.all:
uuid_list = esdu.get_all_uuids()
else:
uuid_list = [ecwu.User.fromEmail(uuid_str).uuid for uuid_str in args.user_email]
Expand Down
4 changes: 4 additions & 0 deletions bin/push/send_survey.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import argparse
import uuid

import emission.storage.decorations.user_queries as esdu
import emission.net.ext_service.push.notify_usage as pnu
import emission.net.ext_service.push.query.dispatch as pqd
import emission.core.wrapper.user as ecwu
Expand All @@ -27,6 +28,7 @@ def get_uuid_list_from_spec(query_spec_file):
group.add_argument("-e", "--user_email", nargs="+")
group.add_argument("-u", "--user_uuid", nargs="+")
group.add_argument("-q", "--query_spec")
group.add_argument("-a", "--all", action="store_true")

parser.add_argument("-d", "--dev", action="store_true", default=False)
parser.add_argument("-s", "--show_emails", action="store_true", default=False,
Expand All @@ -45,6 +47,8 @@ def get_uuid_list_from_spec(query_spec_file):
uuid_list = [uuid.UUID(uuid_str) for uuid_str in args.user_uuid]
elif args.user_email:
uuid_list = [ecwu.User.fromEmail(uuid_str).uuid for uuid_str in args.user_email]
elif args.all:
uuid_list = esdu.get_all_uuids()
else:
assert args.query_spec is not None
uuid_list = get_uuid_list_from_spec(args.query_spec)
Expand Down
2 changes: 2 additions & 0 deletions emission/analysis/intake/segmentation/trip_segmentation.py
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,8 @@ def get_last_ts_processed(filter_methods):
if last_ts_processed is None or method.last_ts_processed > last_ts_processed:
last_ts_processed = method.last_ts_processed
logging.debug("Set last_ts_processed = %s from method %s" % (last_ts_processed, method))
except TypeError as e:
logging.debug("Processing method %s got error %s, skipping" % (method, e))
except AttributeError as e:
logging.debug("Processing method %s got error %s, skipping" % (method, e))
logging.info("Returning last_ts_processed = %s" % last_ts_processed)
Expand Down

0 comments on commit 0475b45

Please sign in to comment.