Skip to content

performance_bin fails if --states path doesn't end with trailing slash / #273

@tangruize

Description

@tangruize

When running performance_bin commands in tutorial, if the path of --states argument doesn't end with /, the command fails:

# This fails
bazel-bin/performance/performance_bin \
  --states samples/simple-coin/out/run_2024-05-07_23-46-17  \
  --source samples/simple-coin/CoinToss.json

# This works
bazel-bin/performance/performance_bin \
  --states samples/simple-coin/out/run_2024-05-07_23-46-17/  \
  --source samples/simple-coin/CoinToss.json

The root cause is:

pattern = os.path.join(f"{path_prefix}*adjacency_lists_*.pb")
links = graph.Links()
return load_proto_files(pattern, links)
def load_nodes_from_proto_files(path_prefix):
pattern = os.path.join(f"{path_prefix}*nodes_*.pb")

A potential fix:

def load_adj_lists_from_proto_files(path_prefix):
    pattern = os.path.join(path_prefix, "adjacency_lists_*.pb")
    links = graph.Links()
    return load_proto_files(pattern, links)


def load_nodes_from_proto_files(path_prefix):
    pattern = os.path.join(path_prefix, "nodes_*.pb")
    pb = graph.Nodes()
    return load_proto_files(pattern, pb)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions