-
-
Notifications
You must be signed in to change notification settings - Fork 465
Description
Describe the bug
I have a recursive callback: https://github.com/geerlingguy/sbc-reviews/blob/master/benchmark/tasks/ollama-benchmark.py#L55
This callback is called in a loop for a number of operations, and each time it is called, it should run the operation, report the result, then the next iteration should run.
Right now, with the latest devel version of pyinfra (installed from latest git commit), when I run my Pyinfra scripts, it hangs on the task:
--> Starting operation: Execute task loop
Starting nested operation: tasks/ollama-benchmark.py | Download Ollama Install Script
[10.0.2.212] nested No changes
Starting nested operation: tasks/ollama-benchmark.py | Clone ollama-benchmark with git.
[10.0.2.212] nested Success
Starting nested operation: tasks/ollama-benchmark.py | Execute Ollama loop
Starting nested operation: tasks/ollama-benchmark.py | Download Ollama model: llama3.2:3b
[10.0.2.212] nested Success
Starting nested operation: tasks/ollama-benchmark.py | Benchmark Ollama model: llama3.2:3b
[hangs here...]
When I press Ctrl-C to stop the script, the operation is actually run on the device being managed, but of course the results are not then reported back—and the rest of the loop is not run, since I've bailed out on the process.
To Reproduce
See above—note that you had set up a reproducer for my infinite callback recursion with this same callback earlier: #1283
The same code had worked previously when manually applying your fix to an older 3.2 install, but installing from git source seems to not work. Haven't done a bisect yet to see if there's a commit where things go wrong.
Expected behavior
I expect the callback to loop and run all jobs.
Meta
$ pyinfra --support
If you are having issues with pyinfra or wish to make feature requests, please
check out the GitHub issues at https://github.com/Fizzadar/pyinfra/issues .
When adding an issue, be sure to include the following:
System: Darwin
Platform: macOS-15.4.1-arm64-arm-64bit-Mach-O
Release: 24.4.0
Machine: arm64
pyinfra: v3.2
black: v25.1.0
black: v25.1.0
click: v8.1.8
distro: v1.9.0
gevent: v24.11.1
importlib_metadata: v8.6.1
jinja2: v3.1.6
packaging: v24.2
paramiko: v3.5.1
python-dateutil: v2.9.0.post0
pywinrm: v0.5.0
pyyaml: v6.0.2
pyyaml: v6.0.2
setuptools: v76.0.0
typeguard: v4.4.2
typing-extensions: v4.13.2
wheel: v0.45.1
Executable: /opt/homebrew/bin/pyinfra
Python: 3.13.3 (CPython, Clang 16.0.0 (clang-1600.0.26.6))
Installed via pip. Debug output where it starts to hang:
...
Starting nested operation: tasks/ollama-benchmark.py | Execute Ollama loop
Starting nested operation: tasks/ollama-benchmark.py | Download Ollama model: llama3.2:3b
[10.0.2.212] nested >>> sh -c 'ollama pull llama3.2:3b'
[10.0.2.212] nested Success
Starting nested operation: tasks/ollama-benchmark.py | Benchmark Ollama model: llama3.2:3b
[10.0.2.212] nested >>> sh -c '/home/jgeerling/Downloads/ollama-benchmark/obench.sh -m llama3.2:3b -c 3 --markdown'
| {10.0.2.212}