Open u1735067 opened 8 months ago
The problem is that data resides in completely different parts of the stack. An easier solution would be to pass that information explicitly to your processor.
class ProgressProcessor(Processor):
def __init__(self, on_good, on_failed, raise_on_error):
...
Alternatively we could move this:
https://github.com/nornir-automation/nornir/blob/v3.4.1/nornir/core/__init__.py#L116
to here:
https://github.com/nornir-automation/nornir/blob/v3.4.1/nornir/core/__init__.py#L138
and pass run_on
to task_started
but that would be a breaking change so we need to think carefully about it.
The progress bar from nornir_rich has the option to pass the number of hosts implemented. Maybe the code helps you.
Hi,
processors are very powerful but one limitation is that is doesn't seem possible to know the (number of) hosts actually in the run, as the list according to
on_good
andon_failed
is calculated (https://github.com/nornir-automation/nornir/blob/v3.4.1/nornir/core/__init__.py#L118) aftertask_started()
is called, could it be possible to have access to this information (as well ason_good
andon_failed
and mayberaise_on_error
)?One hacky way to get this informations is:
Thanks