Unverified Commit 7ab10348 authored by Jinjing Zhou's avatar Jinjing Zhou Committed by GitHub
Browse files

Sort recipe in DGL-Go (#3781)



* add

* remove

* fix

* rework the readme and some changes

* add png

* update png

* add recipe get

* sort recipe list and remove copy

* fix
Co-authored-by: default avatarMinjie Wang <wmjlyjemaine@gmail.com>
Co-authored-by: default avatarQuan (Andy) Gan <coin2028@hotmail.com>
parent 869991d7
......@@ -13,21 +13,20 @@ def list_recipes():
typer.echo("="*len(header))
typer.echo(header)
typer.echo("="*len(header))
output_list = []
for file in file_list:
cfg = yaml.safe_load(Path(file).open("r"))
typer.echo("| {:<30} | {:<18} | {:<20} |".format(file.name, cfg["pipeline_name"], cfg["data"]["name"]))
output_list.append({
"file_name": file.name,
"pipeline_name": cfg["pipeline_name"],
"dataset_name": cfg["data"]["name"]
})
# sort by pipeline, if same sort by dataset, if same sort by file name
output_list.sort(key=lambda f: (f["pipeline_name"], f["dataset_name"], f["file_name"]))
for f in output_list:
typer.echo("| {:<30} | {:<18} | {:<20} |".format(f["file_name"], f["pipeline_name"], f["dataset_name"]))
typer.echo("="*len(header))
def copy_recipes(dir: str = typer.Option("dglgo_example_recipes", help="directory name for recipes")):
file_current_dir = Path(__file__).resolve().parent
recipe_dir = file_current_dir.parent.parent / "recipes"
current_dir = Path(os.getcwd())
new_dir = current_dir / dir
new_dir.mkdir(parents=True, exist_ok=True)
for file in recipe_dir.glob("*.yaml"):
shutil.copy(file, new_dir)
print("Example recipes are copied to {}".format(new_dir.absolute()))
def get_recipe(recipe_name: Optional[str] = typer.Argument(None, help="The recipe filename to get, e.q. nodepred_citeseer_gcn.yaml")):
if recipe_name is None:
typer.echo("Usage: dgl recipe get [RECIPE_NAME] \n")
......@@ -47,7 +46,6 @@ def get_recipe(recipe_name: Optional[str] = typer.Argument(None, help="The recip
recipe_app = typer.Typer(help="Get example recipes")
recipe_app.command(name="list", help="List all available example recipes")(list_recipes)
recipe_app.command(name="copy", help="Copy all available example recipes to current directory")(copy_recipes)
recipe_app.command(name="get", help="Copy the recipe to current directory")(get_recipe)
if __name__ == "__main__":
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment