def update_issues(auth, proxy): issues = mongohelper.get_unassigned_issues(config) valid_commenters = mongohelper.get_10gen_commenters(config) for issue in issues: issueid = issue['_id'] try: commenters = jirahelpers.get_issue_commenters(auth, proxy, issueid) valid_comments = valid_commenters & commenters if len(valid_comments) > 0: mongohelper.set_inprogress(config, issueid) except: # most probably due to ticket rename logger.debug('Error fetching commenters for Issue %s' % (issueid)) mongohelper.remove_ticket(config, issueid)
def main(input_config): global config try: logger.info('Started %s monitor' % (module)) config = input_config initialize() logger.info('Getting unattended issues') issues = mongohelper.get_unassigned_issues(config) logger.info('Got %d unattended issues' % len(issues)) if len(issues) > 0: classify_issues(issues) if len(category1issues) > 0: logger.info('Escalating category 1 issues') mailhelpers.email_issues(config, config.dev_id, 'Blocker issues that are open for at least 30 minutes', category1issues) logger.info('Done escalating category 1 issues') if len(category2issues) > 0: logger.info('Escalating category 2 issues') mailhelpers.email_issues(config, config.dev_id, 'Critical issues that are open for at least 40 minutes', category2issues) logger.info('Done escalating category 2 issues') if len(category3issues) > 0: logger.info('Escalating category 3 issues') mailhelpers.email_issues(config, config.dev_id, 'Major issues that are open for at least 2 hours', category3issues) logger.info('Done escalating category 3 issues') if len(category4issues) > 0: logger.info('Escalating category 4 issues') mailhelpers.email_issues(config, config.dev_id, 'Issues that are open for at least 4 hours', category4issues) logger.info('Done escalating category 4 issues') except: error = traceback.format_exc() logger.critical(error) mailhelpers.alert_admin(config, module, error) raise