
Security News
Crates.io Users Targeted by Phishing Emails
The Rust Security Response WG is warning of phishing emails from rustfoundation.dev targeting crates.io users.
nornir_progressbar is a runner plugin for turning your task executions into nice-looking tqdm progress bars. It can be used with both of Nornir's standard Runners:
Install the package from PyPi with pip.
pip install nornir-progressbar
Be sure to register the RunnerPlugin within your Nornir script before using it.
To use the Multi-threaded execution, register the class ThreadedProgressBarRunner:
from nornir_progressbar.plugins.runners import ThreadedProgressBarRunner
from nornir.core.plugins.runners import RunnersPluginRegister
from nornir import InitNornir
RunnersPluginRegister.register("ProgressBar", ThreadedProgressBarRunner)
nr = InitNornir(config_file='sample_config.yaml')
For serial executions, use SerialProgressBarRunner instead:
from nornir_progressbar.plugins.runners import SerialProgressBarRunner
from nornir.core.plugins.runners import RunnersPluginRegister
from nornir import InitNornir
RunnersPluginRegister.register("ProgressBar", SerialProgressBarRunner)
nr = InitNornir(config_file='sample_config.yaml')
Your nornir config file should point to the new runner plugin:
---
inventory:
plugin: SimpleInventory
options:
host_file: "inventory/hosts.yaml"
group_file: "inventory/groups.yaml"
defaults_file: "inventory/defaults.yaml"
runner:
plugin: ProgressBar
options:
num_workers: 10
And that's it! Whenever you execute a nornir task, a progress bar will appear for each host in the inventory, incrementing for each host that finishes execution. The name of the task being run is used as the progress bar's description.
The plugin uses tqdm to render the progress bar. Keyword arguments can be passed directly to the tqdm() call by setting them under the plugin options. Adding a 'desc' argument will provide a custom description to the progress bar. Consult tqdm's documentation for all the keyword arguments supported.
---
inventory:
plugin: SimpleInventory
options:
host_file: "inventory/hosts.yaml"
group_file: "inventory/groups.yaml"
defaults_file: "inventory/defaults.yaml"
runner:
plugin: ProgressBar
options:
num_workers: 10
desc: Toto tata
leave: False
The above configuration yields a single progress bar with description "Toto tata"
that gets replaced every time a task finishes execution.
Use the ascii
option to get an ASCII progress bar.
---
inventory:
plugin: SimpleInventory
options:
host_file: "inventory/hosts.yaml"
group_file: "inventory/groups.yaml"
defaults_file: "inventory/defaults.yaml"
runner:
plugin: ProgressBar
options:
num_workers: 10
ascii: True
FAQs
Multi-threaded runner plugin for nornir that prints a cute progress bar.
We found that nornir-progressbar demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
The Rust Security Response WG is warning of phishing emails from rustfoundation.dev targeting crates.io users.
Product
Socket now lets you customize pull request alert headers, helping security teams share clear guidance right in PRs to speed reviews and reduce back-and-forth.
Product
Socket's Rust support is moving to Beta: all users can scan Cargo projects and generate SBOMs, including Cargo.toml-only crates, with Rust-aware supply chain checks.