-
Notifications
You must be signed in to change notification settings - Fork 36
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
delete random AS graphs of size `n` using either default tag (latest) or random tags from SUPPORTED_TAGS
- Loading branch information
1 parent
417a6a7
commit b2126dd
Showing
4 changed files
with
164 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
from pathlib import Path | ||
from typing import List | ||
|
||
import click | ||
from rich import print | ||
|
||
from warnet.cli.rpc import rpc_call | ||
from warnet.utils import DEFAULT_TAG | ||
|
||
|
||
@click.group(name="graph") | ||
def graph(): | ||
"""Graph commands""" | ||
|
||
|
||
@graph.command() | ||
@click.argument("params", nargs=-1, type=str) | ||
@click.option("--outfile", type=Path) | ||
@click.option("--version", type=str, default=DEFAULT_TAG) | ||
@click.option("--bitcoin_conf", type=Path) | ||
@click.option("--random", is_flag=True) | ||
def create(params: List[str], outfile: Path, version: str, bitcoin_conf: Path, random: bool = False): | ||
""" | ||
Create a graph file of type random AS graph with [params] | ||
""" | ||
try: | ||
result = rpc_call( | ||
"graph_generate", | ||
{ | ||
"params": params, | ||
"outfile": str(outfile) if outfile else "", | ||
"version": version, | ||
"bitcoin_conf": str(bitcoin_conf), | ||
"random": random | ||
}, | ||
) | ||
print(result) | ||
except Exception as e: | ||
print(f"Error generating graph: {e}") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters