Skip to content

Printstats

snoop.data.management.commands.printstats #

Print table with task counts.

Classes#

Command #

Print task stats.

Methods#
add_arguments(self, parser) #

Only argument is the collection.

Source code in snoop/data/management/commands/printstats.py
def add_arguments(self, parser):
    """Only argument is the collection.
    """
    parser.add_argument('collection', type=str)
    parser.add_argument('--force', action='store_true', help="Run task in foreground mode.")
handle(self, collection, **options) #

Runs snoop.data.admin.get_stats and prints result.

Source code in snoop/data/management/commands/printstats.py
def handle(self, collection, **options):
    """Runs [snoop.data.admin.get_stats][] and prints result.
    """

    logging_for_management_command(options['verbosity'])
    col = collections.ALL[collection]
    with col.set_current():
        stats = get_stats(options['force'])
        if not stats:
            log.warning('no tasks found')

        pprint.pp(stats, compact=True, width=120, indent=2)