Skip to content

Commit

Permalink
implement batch aggregation on cli
Browse files Browse the repository at this point in the history
  • Loading branch information
Tooyosi committed Oct 1, 2024
1 parent aab42a0 commit 9a292ea
Showing 1 changed file with 27 additions and 1 deletion.
28 changes: 27 additions & 1 deletion panoptes_cli/commands/workflow.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

from panoptes_cli.scripts.panoptes import cli
from panoptes_client import Workflow

from panoptes_client.panoptes import PanoptesAPIException

@cli.group()
def workflow():
Expand Down Expand Up @@ -229,6 +229,32 @@ def delete(force, workflow_ids):
)
workflow.delete()

@workflow.command()
@click.argument('workflow-id', required=True, type=int)
@click.argument('user-id', required=True, type=int)
@click.option('--delete-if-exists', '-d', is_flag=True, help='Delete if it exists.')
def run_aggregation(workflow_id, user_id, delete_if_exists):
agg = Workflow(workflow_id).run_aggregation(user_id, delete_if_exists)
try:
click.echo(agg.raw)
except PanoptesAPIException as err:
click.echo(err)

@workflow.command()
@click.argument('workflow-id', required=True, type=int)
def get_batch_aggregations(workflow_id):
agg = Workflow(workflow_id).get_batch_aggregations()
click.echo(agg.object_list)

@workflow.command()
@click.argument('workflow-id', required=True, type=int)
def check_batch_aggregation_run_status(workflow_id):
click.echo(Workflow(workflow_id).check_batch_aggregation_run_status())

@workflow.command()
@click.argument('workflow-id', required=True, type=int)
def get_batch_aggregation_links(workflow_id):
click.echo(Workflow(workflow_id).get_batch_aggregation_links())

def echo_workflow(workflow):
click.echo(
Expand Down

0 comments on commit 9a292ea

Please sign in to comment.