Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

implement batch aggregation on cli #260

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 36 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 @@ -230,6 +230,41 @@ 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(
u'{} {}'.format(
Expand Down
Loading