Exemple #1
0
def api_repos(repo_username):
    data = {}
    try:
        data["repos"] = github_api.fetch_repos_with_issues(repo_username)
    except Exception as ex:
        print 'api_repos error: %s' % ex
        data = { 'error' : '%s' % ex }
    return Response(json.dumps(data), mimetype='application/json')
def run_maintenance_tasks():
    """
    maintenance tasks to run on older issues.
    """

    organization = 'driftyco'

    print "Running daily tasks, %s" % (organization)

    try:
        repos = github_api.fetch_repos_with_issues(organization)

        for repo in repos:
            repo_username = repo.get('repo_username')
            repo_id = repo.get('repo_id')
            print 'Running daily tasks: %s/%s' % (repo_username, repo_id)

            open_issues = []
            try:
                open_issues = github_api.fetch_open_issues(repo_username, repo_id)
                if not open_issues or not isinstance(open_issues, list) or not len(open_issues):
                    print 'No issues for %s/%s' % (repo_username, repo_id)
                    continue

                for issue in open_issues:
                    issue_maintenance(repo_username, repo_id, issue)

            except Exception as ex:
                print 'run_maintenance_tasks repo error, %s/%s: %s' % (repo_username, repo_id, ex)

            print "open issues, %s/%s: %s" % (repo_username, repo_id, len(open_issues))

        set_last_update()

    except Exception as ex2:
        print 'run_maintenance_tasks error: %s' % (ex2)