Ejemplo n.º 1
0
def main():
    parser = make_parser()
    args = parser.parse_args()
    if isinstance(args.date, basestring):
        # user passed in a custom date, so we need to parse it
        args.date = parse_datestring(args.date).date()

    ensure_github_creds()

    if args.table:
        print(generate_pr_table(args.previous, args.current))
        return

    print("Generating stage verification email and its list of recipients. This may take around a minute...")
    print(generate_email(args.previous, args.current, release_date=args.date).encode('UTF-8'))
    print("\n")
    print("Wiki Table:")
    print(
        "Type Ctrl+Shift+D on Confluence to embed the following table "
        "in your release wiki page"
    )
    print("\n")
    print(generate_pr_table(args.previous, args.current))
    commits_without_prs = get_commits_not_in_prs(args.previous, args.current)
    if commits_without_prs:
        num = len(commits_without_prs)
        plural = num > 1
        print("\n")
        print(
            "There {are} {num} {commits} in this release that did not come in "
            "through pull requests!".format(
                num=num, are="are" if plural else "is",
                commits="commits" if plural else "commit"
            )
        )
        print("\n")
        print(generate_commit_table(args.previous, args.current))

    if args.cut_branch:
        branch_name = cut_release_branch(args.date)
        if branch_name:
            print(
                "OPEN THE PULL REQUEST: https://github.com/edx/edx-platform/compare/release...{name}".format(
                    name=branch_name
                )
            )
    else:
        print("Skipping branch cut")
Ejemplo n.º 2
0
def main():
    parser = make_parser()
    args = parser.parse_args()
    if isinstance(args.date, basestring):
        # user passed in a custom date, so we need to parse it
        args.date = parse_datestring(args.date).date()

    ensure_github_creds()

    if args.table:
        print(generate_pr_table(args.previous, args.current))
        return

    print(
        "Generating stage verification email and its list of recipients. This may take around a minute..."
    )
    print(
        generate_email(args.previous, args.current,
                       release_date=args.date).encode('UTF-8'))
    print("\n")
    print("Wiki Table:")
    print("Type Ctrl+Shift+D on Confluence to embed the following table "
          "in your release wiki page")
    print("\n")
    print(generate_pr_table(args.previous, args.current))
    commits_without_prs = get_commits_not_in_prs(args.previous, args.current)
    if commits_without_prs:
        num = len(commits_without_prs)
        plural = num > 1
        print("\n")
        print(
            "There {are} {num} {commits} in this release that did not come in "
            "through pull requests!".format(
                num=num,
                are="are" if plural else "is",
                commits="commits" if plural else "commit"))
        print("\n")
        print(generate_commit_table(args.previous, args.current))

    if args.cut_branch:
        branch_name = cut_release_branch(args.date)
        if branch_name:
            print(
                "OPEN THE PULL REQUEST: https://github.com/edx/edx-platform/compare/release...{name}"
                .format(name=branch_name))
    else:
        print("Skipping branch cut")
Ejemplo n.º 3
0
def main():
    parser = make_parser()
    args = parser.parse_args()
    if isinstance(args.date, basestring):
        # user passed in a custom date, so we need to parse it
        args.date = parse_datestring(args.date).date()
    commit_range = "{0}..{1}".format(args.previous, args.current)

    if args.table:
        print(generate_table(commit_range, include_merge=args.merge))
        return

    print("EMAIL:")
    print(generate_email(commit_range, release_date=args.date).encode("UTF-8"))
    print("\n")
    print("Wiki Table:")
    print("Type Ctrl+Shift+D on Confluence to embed the following table " "in your release wiki page")
    print("\n")
    print(generate_table(commit_range, include_merge=args.merge).encode("UTF-8"))
Ejemplo n.º 4
0
def main():
    parser = make_parser()
    args = parser.parse_args()
    if isinstance(args.date, basestring):
        # user passed in a custom date, so we need to parse it
        args.date = parse_datestring(args.date).date()
    commit_range = "{0}..{1}".format(args.previous, args.current)

    if args.table:
        print(generate_table(commit_range, include_merge=args.merge))
        return

    print("EMAIL:")
    print(generate_email(commit_range, release_date=args.date))
    print("\n")
    print("Wiki Table:")
    print("Type Ctrl+Shift+D on Confluence to embed the following table "
          "in your release wiki page")
    print("\n")
    print(generate_table(commit_range, include_merge=args.merge))
Ejemplo n.º 5
0
def main():
    parser = make_parser()
    args = parser.parse_args()
    if isinstance(args.date, basestring):
        # user passed in a custom date, so we need to parse it
        args.date = parse_datestring(args.date).date()

    ensure_github_creds()

    if args.table:
        print(generate_pr_table(args.previous, args.current))
        return

    print("EMAIL:")
    print(generate_email(args.previous, args.current, release_date=args.date).encode('UTF-8'))
    print("\n")
    print("Wiki Table:")
    print(
        "Type Ctrl+Shift+D on Confluence to embed the following table "
        "in your release wiki page"
    )
    print("\n")
    print(generate_pr_table(args.previous, args.current))
    commits_without_prs = get_commits_not_in_prs(args.previous, args.current)
    if commits_without_prs:
        num = len(commits_without_prs)
        plural = num > 1
        print("\n")
        print(
            "There {are} {num} {commits} in this release that did not come in "
            "through pull requests!".format(
                num=num, are="are" if plural else "is",
                commits="commits" if plural else "commit"
            )
        )
        print("\n")
        print(generate_commit_table(args.previous, args.current))
Ejemplo n.º 6
0
def main():
    parser = make_parser()
    args = parser.parse_args()
    if isinstance(args.date, basestring):
        # user passed in a custom date, so we need to parse it
        args.date = parse_datestring(args.date).date()

    ensure_github_creds()

    if args.table:
        print(generate_pr_table(args.previous, args.current))
        return

    print("EMAIL:")
    print(generate_email(args.previous, args.current, release_date=args.date).encode('UTF-8'))
    print("\n")
    print("Wiki Table:")
    print(
        "Type Ctrl+Shift+D on Confluence to embed the following table "
        "in your release wiki page"
    )
    print("\n")
    print(generate_pr_table(args.previous, args.current))
    commits_without_prs = get_commits_not_in_prs(args.previous, args.current)
    if commits_without_prs:
        num = len(commits_without_prs)
        plural = num > 1
        print("\n")
        print(
            "There {are} {num} {commits} in this release that did not come in "
            "through pull requests!".format(
                num=num, are="are" if plural else "is",
                commits="commits" if plural else "commit"
            )
        )
        print("\n")
        print(generate_commit_table(args.previous, args.current))
Ejemplo n.º 7
0
def service_request(event):
    if 'SERVICE_LIMIT' in event:
        service_limit = float(event['SERVICE_LIMIT'])
    else:
        service_limit = 5

    print("Service Request")
    if 'data_requests' not in event:
        data_requests = memory.remember(tree="data_requests")
    else:
        data_requests = json.loads(event['data_requests'])

    print("Found {} requests".format(len(data_requests)))

    print("Retrieving active connections")
    connections = WebSocketMemory(memory.tablename).get_active_connections()

    data_requests = prune_inactive_requests(data_requests, connections)

    print("Attempting to service {} requests".format(len(data_requests)))
    to_forget = []
    for data_request in data_requests[:service_limit]:
        connection_id = data_request_trunk_to_cid(data_request['TRUNK'])
        trunk = data_request[
            'REQUEST_TRUNK'] if 'REQUEST_TRUNK' in data_request else None
        root = data_request[
            'REQUEST_ROOT'] if 'REQUEST_ROOT' in data_request else None
        branch = data_request[
            'REQUEST_BRANCH'] if 'REQUEST_BRANCH' in data_request else None
        tree = data_request['REQUEST_TREE']

        if 'Limit' in data_request:
            data_request['Limit'] = int(data_request['Limit'])

        if 'ScanIndexForward' in data_request:
            data_request['ScanIndexForward'] = json.loads(
                data_request['ScanIndexForward'])

        nonkwargs = [
            "action", "TRUNK", "TREE", "WRITESTAMP", "REQUEST_TREE",
            "REQUEST_TRUNK", "REQUEST_ROOT", "REQUEST_BRANCH"
        ]
        request_kwargs = {
            key: value
            for key, value in data_request.items() if key not in nonkwargs
        }
        request_kwargs = {
            'tree': tree,
            'root': root,
            'trunk': trunk,
            'branch': branch,
            **request_kwargs
        }
        print("Memory request: {}".format(request_kwargs))
        memories = memory.remember(**request_kwargs)

        print("Recovered {} memories".format(len(memories)))
        for memory_chunk in chunks(memories, 500):
            try:
                send_data(memory_chunk, connection_id)
            except Exception:
                print("Failed to send data to connection")
                print(generate_traceback())

        try:
            branchdate = parse_datestring(str(branch)).astimezone(pytz.utc)
            if branchdate > datetime.utcnow():
                print("Removing serviced data request")
                to_forget.append(data_request)
        except ValueError:
            print("Branch is not date-like")

        try:
            data_request['REQUEST_ROOT'] = datetime.utcnow().strftime(
                TIME_FORMAT)
            memory.memorize([data_request])
        except Exception:
            print("Unable to update request with completed time")

    print("Removing completed requests")
    memory.forget(to_forget)

    leftover = data_requests[service_limit:]

    if leftover:
        print("{} more requests. Spawning new servicer".format(len(leftover)))
        event = {"routeKey": "service", "data_requests": leftover}
        spawn_servicer()