Skip to content

Commit

Permalink
Merge pull request #79 from lxfind/diem-dep-github-branch
Browse files Browse the repository at this point in the history
[scripts] Allow specifying branch and repo when switching diem repository
  • Loading branch information
lxfind authored Dec 21, 2021
2 parents 872db40 + 6c44937 commit fc18545
Showing 1 changed file with 24 additions and 13 deletions.
37 changes: 24 additions & 13 deletions scripts/diem_dependency.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,9 @@
import os
import re

CURRENT_REV = "661a2d1367a64a02027e4ed8f4b18f0a37cfaa17"
ROOT = os.path.join(os.path.dirname(__file__), "../")
PATTERN = re.compile(
'(\s*)(.+) = {{ git = "https://github.com/diem/diem", rev="{}" }}(\s*)'.format(
CURRENT_REV
)
'(\s*)(.+) = { git = "https://github.com/.+/diem", (?:rev|branch)=".+" }(\s*)'
)


Expand All @@ -21,13 +18,17 @@ def parse_args():
description="""
Automatically manage the dependency path to Diem repository.
Command "local" switches the dependency from git to local path.
Command "upgrade" upgrades the git revision.
Command "upgrade" upgrades the git revision. A repository can be
specified if we want to use a fork instead of upstream.
A revision or a branch also needs to be specified.
""",
)
local = subparser.add_parser("local")
remote = subparser.add_parser("remote")
subparser.add_parser("local")
upgrade = subparser.add_parser("upgrade")
upgrade.add_argument("--rev", type=str, required=True)
upgrade.add_argument("--repo", required=False, default="diem")
upgrade_group = upgrade.add_mutually_exclusive_group(required=True)
upgrade_group.add_argument("--rev")
upgrade_group.add_argument("--branch")
return parser.parse_args()


Expand Down Expand Up @@ -76,18 +77,28 @@ def process_line(line, depth):
scan_files(ROOT, process_line)


def upgrade_revision(rev):
def upgrade_revision(repo, rev, branch):
assert (args.rev is None) != (args.branch is None)
def process_line(line, _):
return line.replace(CURRENT_REV, rev)
m = PATTERN.match(line)
if m:
prefix = m.group(1)
name = m.group(2)
postfix = m.group(3)
return '{}{} = {{ git = "https://github.com/{}/diem", {}="{}" }}{}'.format(
prefix, name, repo,
"branch" if branch else "rev",
branch if branch else rev,
postfix
)
return line

scan_files(ROOT, process_line)
# Also patch the script itself with the new revision.
scan_file(__file__, process_line)


args = parse_args()
if args.command == "local":
switch_to_local()
else:
assert args.command == "upgrade"
upgrade_revision(args.rev)
upgrade_revision(args.repo, args.rev, args.branch)

1 comment on commit fc18545

@github-actions
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bench results

�[0m�[0m�[1m�[32m Finished�[0m release [optimized + debuginfo] target(s) in 1.38s
�[0m�[0m�[1m�[32m Running�[0m target/release/bench
[2021-12-21T01:43:33Z INFO bench] Preparing accounts.
[2021-12-21T01:43:34Z INFO bench] Preparing transactions.
[2021-12-21T01:43:43Z INFO fastpay::network] Listening to Udp traffic on 127.0.0.1:9569
[2021-12-21T01:43:43Z INFO fastpay::network] Listening to Udp traffic on 127.0.0.1:9559
[2021-12-21T01:43:43Z INFO fastpay::network] Listening to Udp traffic on 127.0.0.1:9558
[2021-12-21T01:43:43Z INFO fastpay::network] Listening to Udp traffic on 127.0.0.1:9557
[2021-12-21T01:43:43Z INFO fastpay::network] Listening to Udp traffic on 127.0.0.1:9555
[2021-12-21T01:43:43Z INFO fastpay::network] Listening to Udp traffic on 127.0.0.1:9566
[2021-12-21T01:43:43Z INFO fastpay::network] Listening to Udp traffic on 127.0.0.1:9567
[2021-12-21T01:43:43Z INFO fastpay::network] Listening to Udp traffic on 127.0.0.1:9568
[2021-12-21T01:43:43Z INFO fastpay::network] Listening to Udp traffic on 127.0.0.1:9565
[2021-12-21T01:43:43Z INFO fastpay::network] Listening to Udp traffic on 127.0.0.1:9556
[2021-12-21T01:43:43Z INFO fastpay::network] Listening to Udp traffic on 127.0.0.1:9561
[2021-12-21T01:43:43Z INFO fastpay::network] Listening to Udp traffic on 127.0.0.1:9563
[2021-12-21T01:43:43Z INFO fastpay::network] Listening to Udp traffic on 127.0.0.1:9560
[2021-12-21T01:43:43Z INFO fastpay::network] Listening to Udp traffic on 127.0.0.1:9564
[2021-12-21T01:43:43Z INFO fastpay::network] Listening to Udp traffic on 127.0.0.1:9562
[2021-12-21T01:43:44Z INFO bench] Set max_in_flight per shard to 66
[2021-12-21T01:43:44Z INFO bench] Sending requests.
[2021-12-21T01:43:44Z INFO fastpay::network] Sending Udp requests to 127.0.0.1:9569 (shard 14)
[2021-12-21T01:43:44Z INFO fastpay::network] Sending Udp requests to 127.0.0.1:9565 (shard 10)
[2021-12-21T01:43:44Z INFO fastpay::network] Sending Udp requests to 127.0.0.1:9566 (shard 11)
[2021-12-21T01:43:44Z INFO fastpay::network] Sending Udp requests to 127.0.0.1:9564 (shard 9)
[2021-12-21T01:43:44Z INFO fastpay::network] Sending Udp requests to 127.0.0.1:9557 (shard 2)
[2021-12-21T01:43:44Z INFO fastpay::network] Sending Udp requests to 127.0.0.1:9562 (shard 7)
[2021-12-21T01:43:44Z INFO fastpay::network] Sending Udp requests to 127.0.0.1:9555 (shard 0)
[2021-12-21T01:43:44Z INFO fastpay::network] Sending Udp requests to 127.0.0.1:9556 (shard 1)
[2021-12-21T01:43:44Z INFO fastpay::network] Sending Udp requests to 127.0.0.1:9568 (shard 13)
[2021-12-21T01:43:44Z INFO fastpay::network] Sending Udp requests to 127.0.0.1:9567 (shard 12)
[2021-12-21T01:43:44Z INFO fastpay::network] Sending Udp requests to 127.0.0.1:9558 (shard 3)
[2021-12-21T01:43:44Z INFO fastpay::network] Sending Udp requests to 127.0.0.1:9559 (shard 4)
[2021-12-21T01:43:44Z INFO fastpay::network] Sending Udp requests to 127.0.0.1:9560 (shard 5)
[2021-12-21T01:43:44Z INFO fastpay::network] Sending Udp requests to 127.0.0.1:9561 (shard 6)
[2021-12-21T01:43:44Z INFO fastpay::network] Sending Udp requests to 127.0.0.1:9563 (shard 8)
[2021-12-21T01:43:45Z INFO fastpay::network] In flight 66 Remaining 5000
[2021-12-21T01:43:55Z INFO fastpay::network] 127.0.0.1:9557 (shard 2) has processed 5000 packets
[2021-12-21T01:43:55Z INFO fastpay::network] 127.0.0.1:9556 (shard 1) has processed 5000 packets
[2021-12-21T01:43:55Z INFO fastpay::network] 127.0.0.1:9564 (shard 9) has processed 5000 packets
[2021-12-21T01:43:55Z INFO fastpay::network] 127.0.0.1:9568 (shard 13) has processed 5000 packets
[2021-12-21T01:43:55Z INFO fastpay::network] 127.0.0.1:9569 (shard 14) has processed 5000 packets
[2021-12-21T01:43:55Z INFO fastpay::network] 127.0.0.1:9563 (shard 8) has processed 5000 packets
[2021-12-21T01:43:56Z INFO fastpay::network] 127.0.0.1:9562 (shard 7) has processed 5000 packets
[2021-12-21T01:43:56Z INFO fastpay::network] 127.0.0.1:9559 (shard 4) has processed 5000 packets
[2021-12-21T01:43:56Z INFO fastpay::network] 127.0.0.1:9565 (shard 10) has processed 5000 packets
[2021-12-21T01:43:56Z INFO fastpay::network] 127.0.0.1:9566 (shard 11) has processed 5000 packets
[2021-12-21T01:43:56Z INFO fastpay::network] 127.0.0.1:9555 (shard 0) has processed 5000 packets
[2021-12-21T01:43:56Z INFO fastpay::network] 127.0.0.1:9558 (shard 3) has processed 5000 packets
[2021-12-21T01:43:56Z INFO fastpay::network] 127.0.0.1:9561 (shard 6) has processed 5000 packets
[2021-12-21T01:43:56Z INFO fastpay::network] 127.0.0.1:9567 (shard 12) has processed 5000 packets
[2021-12-21T01:43:56Z INFO fastpay::network] 127.0.0.1:9560 (shard 5) has processed 5000 packets
[2021-12-21T01:43:56Z INFO fastpay::network] Done sending Udp requests to 127.0.0.1:9556 (shard 1)
[2021-12-21T01:43:56Z INFO fastpay::network] Done sending Udp requests to 127.0.0.1:9569 (shard 14)
[2021-12-21T01:43:56Z INFO fastpay::network] Done sending Udp requests to 127.0.0.1:9568 (shard 13)
[2021-12-21T01:43:56Z INFO fastpay::network] Done sending Udp requests to 127.0.0.1:9562 (shard 7)
[2021-12-21T01:43:56Z INFO fastpay::network] Done sending Udp requests to 127.0.0.1:9563 (shard 8)
[2021-12-21T01:43:56Z INFO fastpay::network] Done sending Udp requests to 127.0.0.1:9564 (shard 9)
[2021-12-21T01:43:56Z INFO fastpay::network] Done sending Udp requests to 127.0.0.1:9557 (shard 2)
[2021-12-21T01:43:56Z INFO fastpay::network] Done sending Udp requests to 127.0.0.1:9558 (shard 3)
[2021-12-21T01:43:56Z INFO fastpay::network] Done sending Udp requests to 127.0.0.1:9559 (shard 4)
[2021-12-21T01:43:56Z INFO fastpay::network] Done sending Udp requests to 127.0.0.1:9565 (shard 10)
[2021-12-21T01:43:56Z INFO fastpay::network] Done sending Udp requests to 127.0.0.1:9555 (shard 0)
[2021-12-21T01:43:56Z INFO fastpay::network] Done sending Udp requests to 127.0.0.1:9566 (shard 11)
[2021-12-21T01:43:56Z INFO fastpay::network] Done sending Udp requests to 127.0.0.1:9561 (shard 6)
[2021-12-21T01:43:56Z INFO fastpay::network] Done sending Udp requests to 127.0.0.1:9560 (shard 5)
[2021-12-21T01:43:56Z INFO fastpay::network] Done sending Udp requests to 127.0.0.1:9567 (shard 12)
[2021-12-21T01:43:56Z INFO bench] Received 80000 responses.
[2021-12-21T01:43:56Z WARN bench] Total time: 12126377ms, items: 40000, tx/sec: 3298.594460653829

Please sign in to comment.