Skip to main content

Collection of 'nice looking' functions with rich for nornir

Project description

nornir_rich

Install

pip install nornir-rich

Usage

Features

  • Print functions
    • print_result
    • print_failed_hosts
    • print_inventory
  • Processors
    • progressbar

Print example

from nornir_rich.functions import print_result

results = nr.run(
    task=hello_world
)

print_result(results)
print_result(results, vars=["diff", "result", "name", "exception", "severity_level"])

Progress bar example

from time import sleep
from nornir_rich.progress_bar import RichProgressBar


def random_sleep(task: Task) -> Result:
    delay = randrange(10)
    sleep(delay)
    return Result(host=task.host, result=f"{delay} seconds delay")


nr_with_processors = nr.with_processors([RichProgressBar()])
result = nr_with_processors.run(task=random_sleep)

Images

Print Inventory

Print inventory

Print Result

Print Result

Progress Bar

Progress Bar

More examples

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

nornir_rich-0.1.6.tar.gz (4.9 kB view hashes)

Uploaded Source

Built Distribution

nornir_rich-0.1.6-py3-none-any.whl (5.7 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page