Пример #1
0
def stats_growth(args):
    if len(args.command) == 0:
        get_data_growth()
        get_data_growth(month=1)
        get_data_growth(day=1)
        get_data_growth(hour=2)
        return

    commands = ['total', 'month', 'day', 'hour', 'help']
    command = args.command.pop(0)
    args_utils.valid_command(command, commands)

    if command == 'total':
        get_data_growth()
    elif command == 'month':
        offset = args_utils.get_or_default(args.command, 1)
        get_data_growth(month=offset)
    elif command == 'day':
        offset = args_utils.get_or_default(args.command, 1)
        get_data_growth(day=offset)
    elif command == 'hour':
        offset = args_utils.get_or_default(args.command, 1)
        get_data_growth(hour=offset)
    else:
        print("stats data_growth sub-commands: {}".format(", ".join(commands)))
        sys.exit()
Пример #2
0
def stats_command(args) -> None:
    if len(args.command) == 0:
        stats_users(args)
        #        stats_data(args)
        stats_rolling_users(args)
        stats_jobs(args)
        stats_queue(args)
        stats_rolling_workflows(args)
        stats_growth(args)
        get_nels_exports()
        get_nels_imports()
        get_workflow_stats()
        return

    commands = [
        'users', 'users-rolling', 'jobs', 'queue', 'data', 'growth', 'help'
    ]

    command = args.command.pop(0)
    args_utils.valid_command(command, commands)

    if command == 'users':
        stats_users(args)
    elif command == 'jobs':
        stats_jobs(args)
    elif command == 'data':
        stats_data(args)
    elif command == 'queue':
        stats_queue(args)
    elif command == 'growth':
        stats_growth(args)
    else:
        print("stat sub-commands: {}".format(", ".join(commands)))
        sys.exit()
Пример #3
0
def stats_data(args):
    if len(args.command) == 0:
        get_upload_stats()
        return

    commands = ['month', 'day', 'hour', 'help']
    command = args.command.pop(0)
    args_utils.valid_command(command, commands)

    size = offset = args_utils.get_or_default(args.command, 1)
    if command == 'month':
        get_upload_stats(month=size)
    elif command == 'day':
        get_upload_stats(day=size)
    elif command == 'hour':
        get_upload_stats(hour=size)
    else:
        print("stats users sub-commands: {}".format(", ".join(commands)))
        sys.exit()
Пример #4
0
def stats_users(args):
    if len(args.command) == 0:
        get_user_stats()
        return

    commands = ['year', 'month', 'help']
    command = args.command.pop(0)
    args_utils.valid_command(command, commands)

    if command == 'year':
        args_utils.count(1, len(args.command), msg="stats year require a year")
        get_user_stats(year=args.command.pop(0))
    elif command == 'month':
        args_utils.count(1,
                         len(args.command),
                         msg="stats month require a year-month")
        get_user_stats(month=args.command.pop(0))
    else:
        print("stats users sub-commands: {}".format(", ".join(commands)))
        sys.exit()