Skip to main content

nornir-ray

nornir-ray is a runner plugin for Nornir. It runs each host's task on a Ray cluster instead of a thread pool on one machine.

You keep your Nornir scripts, inventory and tasks. You change one setting, the runner, and Nornir sends the work for each host to a pool of worker processes. The worker processes can run on your own machine or on several machines.

Early development

nornir-ray is in early development. It targets Nornir 3.7.0b1, a pre-release that adds the runner features this plugin depends on.

What you use it for​

  • Run tasks on more hosts at the same time. Nornir's built-in threaded runner uses the threads of one Python process on one machine. With nornir-ray, each machine of the cluster runs several worker processes, and each worker process runs many hosts at the same time.
  • Keep device sessions open between runs. A host always goes to the same worker while the pool of workers does not change. The session that a task opens to a device stays open on that worker, and the next run uses it again.
  • Run tasks from machines that can reach the devices. The machine that runs your script does not need to connect to the devices. The workers connect to them.

What stays the same​

  • You call nr.run, nr.arun, nr.submit, nr.stream and nr.run_operation as before.
  • You read the results in the same way. A task that fails on one host does not change the result of the other hosts.
  • Deadlines and cancellation follow the same rules as Nornir's built-in runners.

The idea in one diagram​

The runner gives each host to one worker. The worker runs the task, connects to the device and sends the result back. Your script receives the same result objects as with any other runner.

Where to go next​

You want toRead
Run your first task with the runnerQuickstart
Understand the parts and their namesHow it works
Decide between one machine and a clusterChoose a deployment
Look up an option or an errorRunner options, Errors
Understand the code of the pluginInternal components