Unverified Commit 3e4954d3 by Nadeem Shahzad Committed by GitHub

Merge pull request #4679 from edx/nadeem/OPS-3254

Add retries to notify hipchat (OPS-3254)
parents 5fa7a6cb 7e00beec
...@@ -164,8 +164,22 @@ if __name__ == '__main__': ...@@ -164,8 +164,22 @@ if __name__ == '__main__':
try: try:
if args.hipchat_api_key: if args.hipchat_api_key:
hc = hipchat.HipChat(token=args.hipchat_api_key) hc = hipchat.HipChat(token=args.hipchat_api_key)
notify = lambda message: hc.message_room(room_id=args.hipchat_room, def notify(message):
message_from=HIPCHAT_USER, message=message) RETRIES = 3
last_exception = None
for _ in range(RETRIES):
try:
hc.message_room(
room_id=args.hipchat_room,
message_from=HIPCHAT_USER, message=message
)
break
except Exception as e:
last_exception = e
else:
print("Failed to send message on HipChat, {}".format(last_exception))
traceback.print_exc()
except Exception as e: except Exception as e:
print("Failed to initialize hipchat, {}".format(e)) print("Failed to initialize hipchat, {}".format(e))
traceback.print_exc() traceback.print_exc()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment