Skip to content

Commit

Permalink
better error reporting
Browse files Browse the repository at this point in the history
  • Loading branch information
Kyle Lahnakoski committed Jan 16, 2014
1 parent a0f3a05 commit 2ee6ce8
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 3 deletions.
25 changes: 24 additions & 1 deletion bzETL/bz_etl.py
Expand Up @@ -183,7 +183,9 @@ def incremental_etl(settings, param, db, es, es_comments, output_queue):
private_bugs = get_private_bugs(db, param)
es.delete_record({"terms": {"bug_id": private_bugs}})
es_comments.delete_record({"terms": {"bug_id": private_bugs}})
Log.note("Ensure the following private bugs are deleted:\n{{private_bugs}}", {"private_bugs": private_bugs})

still_existing = get_bug_ids(es, {"terms":{"bug_id":private_bugs}})
Log.note("Ensure the following private bugs are deleted:\n{{private_bugs}}", {"private_bugs": still_existing})

#RECENT PUBLIC BUGS
possible_public_bugs = get_recent_private_bugs(db, param)
Expand Down Expand Up @@ -400,6 +402,27 @@ def main(settings, es=None, es_comments=None):
except Exception, e:
pass

def get_bug_ids(es, filter):
try:
results = es.search({
"query": {"filtered": {
"query": {"match_all": {}},
"filter": filter
}},
"from": 0,
"size": 200000,
"sort": [],
"fields": ["bug_id"]
})

return results.hits.fields.bug_id
except Exception, e:
Log.error("Can not get_max_bug from {{host}}/{{index}}", {
"host": es.settings.host,
"index": es.settings.index
}, e)



def get_max_bug_id(es):
try:
Expand Down
12 changes: 10 additions & 2 deletions tests/resources/python/leak_check.py
Expand Up @@ -279,10 +279,18 @@ def main():
finally:
pass

def error():
def error(results):
settings = startup.read_settings()

content = []
for e in results.errors:
content.append("FAIL: "+str(e[0]._testMethodName))
for f in results.failures:
content.append("FAIL: "+str(f[0]._testMethodName))


Emailer(settings.email).send_email(
text_data = "The BZ ETL leak checker seems to have found leaks! Shutdown access to public cluster now!"
text_data = "\n".join(content)
)


Expand Down

0 comments on commit 2ee6ce8

Please sign in to comment.