Changeset View
Changeset View
Standalone View
Standalone View
swh/scheduler/cli.py
Show First 20 Lines • Show All 399 Lines • ▼ Show 20 Lines | @click.option('--batch-index', default=1000, type=click.INT, | ||||
help='Batch size of tasks to read from db to archive') | help='Batch size of tasks to read from db to archive') | ||||
@click.option('--bulk-index', default=200, type=click.INT, | @click.option('--bulk-index', default=200, type=click.INT, | ||||
help='Batch size of tasks to bulk index') | help='Batch size of tasks to bulk index') | ||||
@click.option('--batch-clean', default=1000, type=click.INT, | @click.option('--batch-clean', default=1000, type=click.INT, | ||||
help='Batch size of task to clean after archival') | help='Batch size of task to clean after archival') | ||||
@click.option('--dry-run/--no-dry-run', is_flag=True, default=False, | @click.option('--dry-run/--no-dry-run', is_flag=True, default=False, | ||||
help='Default to list only what would be archived.') | help='Default to list only what would be archived.') | ||||
@click.option('--verbose', is_flag=True, default=False, | @click.option('--verbose', is_flag=True, default=False, | ||||
help='Default to list only what would be archived.') | help='Verbose mode') | ||||
@click.option('--cleanup/--no-cleanup', is_flag=True, default=True, | @click.option('--cleanup/--no-cleanup', is_flag=True, default=True, | ||||
help='Clean up archived tasks (default)') | help='Clean up archived tasks (default)') | ||||
@click.option('--start-from', type=click.INT, default=-1, | @click.option('--start-from', type=click.INT, default=-1, | ||||
help='(Optional) default task id to start from. Default is -1.') | help='(Optional) default task id to start from. Default is -1.') | ||||
@click.pass_context | @click.pass_context | ||||
def archive_tasks(ctx, before, after, batch_index, bulk_index, batch_clean, | def archive_tasks(ctx, before, after, batch_index, bulk_index, batch_clean, | ||||
dry_run, verbose, cleanup, start_from): | dry_run, verbose, cleanup, start_from): | ||||
"""Archive task/task_run whose (task_type is 'oneshot' and task_status | """Archive task/task_run whose (task_type is 'oneshot' and task_status | ||||
▲ Show 20 Lines • Show All 155 Lines • ▼ Show 20 Lines | |||||
@cli.group('task-type') | @cli.group('task-type') | ||||
@click.pass_context | @click.pass_context | ||||
def task_type(ctx): | def task_type(ctx): | ||||
"""Manipulate task types.""" | """Manipulate task types.""" | ||||
pass | pass | ||||
@task_type.command('list') | @task_type.command('list') | ||||
@click.option('--verbose', '-v', is_flag=True, default=False) | @click.option('--verbose', '-v', is_flag=True, default=False, | ||||
help='Verbose mode') | |||||
@click.option('--task_type', '-t', multiple=True, default=None, | @click.option('--task_type', '-t', multiple=True, default=None, | ||||
help='List task types of given type') | help='List task types of given type') | ||||
@click.option('--task_name', '-n', multiple=True, default=None, | @click.option('--task_name', '-n', multiple=True, default=None, | ||||
help='List task types of given backend task name') | help='List task types of given backend task name') | ||||
@click.pass_context | @click.pass_context | ||||
def list_task_types(ctx, verbose, task_type, task_name): | def list_task_types(ctx, verbose, task_type, task_name): | ||||
click.echo("Known task types:") | click.echo("Known task types:") | ||||
if verbose: | if verbose: | ||||
▲ Show 20 Lines • Show All 91 Lines • Show Last 20 Lines |