Skip to content

Commit

Permalink
Add factgenie list downloadable
Browse files Browse the repository at this point in the history
  • Loading branch information
oplatek committed Nov 13, 2024
1 parent ecb9e93 commit 69cf3a3
Showing 1 changed file with 22 additions and 2 deletions.
24 changes: 22 additions & 2 deletions factgenie/bin/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@


def list_datasets(app):
"""List all available datasets."""
"""List locally available datasets."""
from factgenie.workflows import get_local_dataset_overview

dataset_overview = get_local_dataset_overview(app)
Expand All @@ -19,6 +19,22 @@ def list_datasets(app):
print(dataset_id)


def list_downloadable(app):
from factgenie import workflows, utils

datasets = workflows.get_local_dataset_overview(app)

resources = utils.load_resources_config()

# set as `downloaded` the datasets that are already downloaded
for dataset_id in resources.keys():
resources[dataset_id]["downloaded"] = dataset_id in datasets

for dataset_id, dataset_info in resources.items():
print(f"{dataset_id} - downloaded: {dataset_info['downloaded']}")



def list_outputs(app):
"""List all available outputs."""
from factgenie.workflows import get_model_outputs_overview
Expand Down Expand Up @@ -58,7 +74,7 @@ def list_campaigns(app):


@app.cli.command("list")
@click.argument("output", type=click.Choice(["datasets", "outputs", "campaigns"]))
@click.argument("output", type=click.Choice(["datasets", "outputs", "campaigns", "downloadable"]))
def list_data(output: str):
"""List available data."""
if output == "datasets":
Expand All @@ -67,6 +83,10 @@ def list_data(output: str):
list_outputs(app)
elif output == "campaigns":
list_campaigns(app)
elif output == "downloadable":
list_downloadable(app)
else:
click.echo(list_data.get_help(click.Context(list_data)))


def show_dataset_info(app, dataset_id: str):
Expand Down

0 comments on commit 69cf3a3

Please sign in to comment.