docs: def run(
          self,
          task,
          num_workers=None,
          raise_on_error=None,
          on_good=True,
          on_failed=False,
          **kwargs,
      ):
          """
          Run task over all the hosts in the inventory.
  
          Arguments:
              task (``callable``): function or callable that will be run against each device in
                the inventory
              num_workers(``int``): Override for how many hosts to run in paralell for this task
              raise_on_error (``bool``): Override raise_on_error behavior
              on_good(``bool``): Whether to run or not this task on hosts marked as good
              on_failed(``bool``): Whether to run or not this task on hosts marked as failed
              **kwargs: additional argument to pass to ``task`` when calling it
  
          Raises:
              :obj:`nornir.core.exceptions.NornirExecutionError`: if at least a task fails
                and self.config.core.raise_on_error is set to ``True``
  
          Returns:
              :obj:`nornir.core.task.AggregatedResult`: results of each execution
          """
          num_workers = num_workers or self.config.core.num_workers
  
          run_on = []
          if on_good:
              for name, host in self.inventory.hosts.items():
                  if name not in self.data.failed_hosts:
                      run_on.append(host)
          if on_failed:
              for name, host in self.inventory.hosts.items():
                  if name in self.data.failed_hosts:
                      run_on.append(host)
  
          num_hosts = len(self.inventory.hosts)
          task_name = kwargs.get("name") or task.__name__
          if num_hosts:
              logger.info(
                  f"Running task %r with args %s on %d hosts",
                  task_name,
                  kwargs,
                  num_hosts,
              )
          else:
              logger.warning("Task %r has not been run – 0 hosts selected", task_name)
  
          if num_workers == 1:
              result = self._run_serial(task, run_on, **kwargs)
          else:
              result = self._run_parallel(task, run_on, num_workers, **kwargs)
  
          raise_on_error = (
              raise_on_error
              if raise_on_error is not None
              else self.config.core.raise_on_error
          )  # noqa
          if raise_on_error:
              result.raise_on_error()
          else:
              self.data.failed_hosts.update(result.failed_hosts.keys())
          return result