pyinfra-dev / pyinfra-dev/pyinfra

pyinfra performance repo questions

Open
#920 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

CLI discussion
Dominant language
Python
Stars
6k
Forks
548
Avg merge
7d 17h
Merged PRs (30d)
13

Description

I recently made some benchmark tests to compare sakes and Ansibles performance, and came across the pyinfra-performance repo, so decided to throw in pyinfra as well.

The results I got were a bit different from the pyinfra performance repo:

  • Ansible ran faster than pyinfra for hosts < 50 for a single shell command, and hosts < 10 for multiple commands

Note, forks wasn't set for Ansible in the pyinfra performance repo, so it was limited to 5, whereas pyinfra ran with many more processes.
Perhaps I misconfigured pyinfra/Ansible somehow, the pyinfra implementation is here https://github.com/alajmo/sake-performance/tree/main/pyinfra.

Anyway, I also spotted some different behavior to how Sake/Ansible handles CLI output compared to pyinfra:

  • it seems pyinfra output is directed to stderr, so it was a bit difficult to utilize gnutime for benchmarking, for instance:
    • sake: sake run ping -s servers --limit=8 > /dev/null prints nothing
    • ansible: ansible-playbook ping-playbook.yaml -i inventory.py > /dev/null prints nothing
    • pyinfra: pyinfra inventory.py pyinfra-ping.py > /dev/null prints
          --> Loading config...
      
          --> Loading inventory...
      
          --> Connecting to hosts...
          /bin/zsh: can't open input file: echo 0.0.0.0 | grep -q '^dedi[0-9]\+$'
              [host_0] Could not connect ([Errno None] Unable to connect to port 10000 on 0.0.0.0)
          --> pyinfra error: No hosts remaining!
      
  • I kept getting the error /bin/zsh: can't open input file: echo 0.0.0.0 | grep -q '^dedi[0-9]\+$', even though the tasks were running just fine.

Also, I couldn't find any documentation but is this description of how pyinfra works correct:

  • Parse config files
  • Connect to servers serially and gathers facts
  • Do work locally using the facts and figure out which operations to perform on hosts
  • Perform operations on hosts in parallel by sending out shell commands

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the commands and output redirection examples from the issue, then compare the pyinfra-performance repository with the linked sake-performance implementation. Review how pyinfra gathers facts, runs operations, and emits CLI output. Done means the benchmark differences, stderr behavior, shell error, and execution flow are documented with clear answers.

Written by the indexing model from the issue text.

Assessment

Tech stack
python, shell
Domain
documentation, performance
Issue type
Documentation
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
20/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.