I have a question regarding the usage of tmuxp :
For example say I have an iteration from 1 to 100.
in one terminal i need to run:
for i in range(100):
I would like to know if it's possible to separate this work into four parts and run the following in each part:
for i in range(25):
I don't want to write yml or json config file for this run, but want to integrate them into the codes. can you please offer some hints?
It would help me to know more about the script's behavior / big picture. What are you trying to do? Is this a python script?
Any snippets / etc. you can share? How would you envision the workflow to be?
I would like to help write an example so it can used it to demonstrate the API.
Thanks for the quick reply. My workflow is a python script to sequentially login to a number of network devices and perform some duties there. It's written in a for loop which iterate over the device objects and the device object itself calls its method to perform the work.
Due to the large number of devices, I would like this work to be separated into 2 or 4 pieces, and I hope it could be shown on different blocks of the screen. I thought tmuxp should support such functionality.
As to the actual code snippet, I haven't got it hosted on github, but you can consider it as breaking a for loop into different sections and running them in different parts of the screen.
This has been very thought provoking. This is exactly the place tmuxp can shine very well.
Exactly. 1 Windows, an each section is a pane.
One thing to be aware of is, each pane needs a way to communicate.
Have you investigated ways this could be done asynchronously / with a queue?
I am going to think this over more. Tmuxp's API would be very useful.
Imagine you have terminals open and you want the script to communicate via the For loop via a Queue (via it zeromq, twisted, etc.). If you could send me the boilerplate to how you're doing that, I could piece together an example faster.
Sorry for the late reply and happy new year.
The following is my sample client script to run few executions on different devices concurrently, by using the python built-in Threading and Queue module.
@ycui - I have a lot on my plate right now. I am assigning this to me.
This is common enough of a use case for tmux (especially with tmuxp involved) it should be used as an example. I will ping here when I have a demonstration.