jenkins-bot has submitted this change and it was merged.
Change subject: Extend logging
......................................................................
Extend logging
Now all code paths in wikibugs.py actually log the result; in addition
added 'started'/'stopped' log entries so it's easier to see what happened
when in the log files
Change-Id: I04966bdc255eb20d5e65c38ecce7b0ee7b9bf1d6
---
M redis2irc.py
M wikibugs.py
2 files changed, 29 insertions(+), 7 deletions(-)
Approvals:
Legoktm: Looks good to me, approved
jenkins-bot: Verified
diff --git a/redis2irc.py b/redis2irc.py
index ed1f67d..26ae99a 100644
--- a/redis2irc.py
+++ b/redis2irc.py
@@ -77,6 +77,7 @@
"""
if useful_info['user'] == 'gerritbot':
# Ignore "Patch to review" stuff
+ logger.debug("Skipped %s by gerritbot" % useful_info['url'])
return
updated = bot.chanfilter.update()
if updated:
@@ -156,4 +157,11 @@
bot.run()
if __name__ == '__main__':
- main()
+ try:
+ logger.info("Started")
+ main()
+ except Exception as e:
+ logger.exception("Uncaught Exception:")
+ raise
+ finally:
+ logger.info("Stopped")
diff --git a/wikibugs.py b/wikibugs.py
index 4eb6c44..3991356 100644
--- a/wikibugs.py
+++ b/wikibugs.py
@@ -95,7 +95,7 @@
:param task_id: T###
:type task_id: basestring
"""
- logging.debug('Getting maniphest.info for %s' % task_id)
+ logger.info('Getting maniphest.info for %s' % task_id)
task_id = int(task_id[1:])
info = self.phab.request('maniphest.info', {
'task_id': task_id
@@ -210,9 +210,9 @@
"""
phid_type = self.get_type_from_phid(event_info['data']['objectPHID'])
if phid_type != 'TASK': # Only handle Maniphest Tasks for now
- logging.debug('Skipping %s, it is of type %s' %
(event_info['data']['objectPHID'], phid_type))
+ logger.debug('Skipping %s, it is of type %s' %
(event_info['data']['objectPHID'], phid_type))
return
- logging.debug('Processing %s' % event_info['data']['objectPHID'])
+ logger.debug('Processing %s' % event_info['data']['objectPHID'])
phid_info = self.phid_info(event_info['data']['objectPHID'])
task_info = self.maniphest_info(phid_info['name'])
@@ -224,6 +224,7 @@
task_page, event_info['data']['transactionPHIDs']
)
except Exception as e:
+ logger.exception("Could not retrieve anchor for %s" %
event_info['data']['transactionPHIDs'])
if self.raise_errors:
raise
open("/data/project/wikibugs/errors/XACT-anchor/" +
event_info['data']['objectPHID'], "w").write(
@@ -234,6 +235,7 @@
try:
projects = self.get_tags(task_page)
except Exception as e:
+ logger.exception("Could not retrieve tags for %s" %
event_info['data']['transactionPHIDs'])
if self.raise_errors:
raise
open("/data/project/wikibugs/errors/scrape-tags/" +
event_info['data']['objectPHID'], "w").write(
@@ -258,6 +260,10 @@
]
for event in ignored:
if event in transactions and len(transactions) == 1:
+ logging.debug("Skipping {PHID} which only has an event of type
{ttype}".format(
+ PHID=event_info['data']['transactionPHIDs'],
+ ttype=event,
+ ))
return
if 'title' in transactions:
@@ -307,6 +313,14 @@
from collections import OrderedDict # noqa
bugs.process_event(eval(open(file).readline()))
- while 1:
- bugs.poll()
- time.sleep(1)
+ logger.info("Starting polling cycle")
+ try:
+ while 1:
+ bugs.poll()
+ time.sleep(1)
+ except Exception as e:
+ print("dafuq")
+ logger.exception("Uncaught Exception in polling cycle:")
+ raise
+ finally:
+ logger.info("Shutting down")
--
To view, visit https://gerrit.wikimedia.org/r/189322
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I04966bdc255eb20d5e65c38ecce7b0ee7b9bf1d6
Gerrit-PatchSet: 2
Gerrit-Project: labs/tools/wikibugs2
Gerrit-Branch: master
Gerrit-Owner: Merlijn van Deen <[email protected]>
Gerrit-Reviewer: Legoktm <[email protected]>
Gerrit-Reviewer: jenkins-bot <>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits