-
Notifications
You must be signed in to change notification settings - Fork 35
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Proposal - Show repeated commands as separate positions #53
Comments
@robd Please hold off on this one for now, as I think some more discussion is needed. I am worried that this changes what I consider desirable behavior for multi-server deployments, where the same command running on multiple servers share the same number prefix. When e.g. running
Rather than:
In my mind, it is one command, three executions rather than three separate commands (even though it really is three distinct command UUIDs behind the scenes). That is why airbrussh currently compares commands using That said, I agree that if you did run the same command three times in a row on one server, that the output is not ideal. However I consider that a fairly uncommon scenario. Right now |
Ah OK I see - that makes sense, and I agree I guess I am just unfortunate in that I happen to see this during my deployments:
Output with #54:
As you can see, it's quite misleading at the moment. There are 12 commands, not 9 as reported by Airbrussh, and the order of command completions isn't ideal. Obviously I could fix this by using a different temporary filename, but I think it would be better if I didn't have to code round Airbrussh. I now understand what I guess this is non trivial to fix. Do I remember you saying that the command is duplicated for each server? I guess it must be in order to store separate command output etc. As I see it there are 2 responsibilities needed from the history:
For me, the ideal fix would be to split the |
Exactly!
Yes, that was my thought as well. Without that change, I don't think there is enough information in the current Command object to distinguish a duplicate command from multi-server execution. |
No, I agree. I thought of a couple of workarounds, such as hooking SSHKit / Capistrano to detect if there are multiple hosts, or moving into 'multiple host' matching mode once we spot a different host on a command. But I think it would be cleaner just to fix this in SSHKit. Just out of interest - do you use Airbrussh on multiple hosts day to day? I never have, so I always forget about this (common) use case. |
Yes, right now I have two active projects that use multi-server production environments: one with 3 servers (app, db, worker), and one with 2 (app, db). |
Would ignoring only consecutive executions work as a viable workaround for this? It may not be bullet-proof, but it seems like an improvement on the current implementation? |
Currently, if you call the same command multiple times, airbrussh doesn't really print out the right thing.
Below is some sample output, which I've annotated with the problems as I see them:
I propose to increment the command position in these cases, so it's clear which instance of the command the output belongs to. In order to achieve this, I'm thinking we could rely on the command uuid and enhance the command history to store all command executions, even if they have the same command string.
My idea is to modify the command history so it is never cleared. It would therefore be a complete command history rather than just being the history for the most recent task. I would store each command, in order as they are started. I would also store the current rake task against each command at the time the command is started.
I would then reimplement the methods which rely on the command history (eg
first_execution
,position
, etc) using the new full command history.As well as supporting repeated commands, I think this would make the code easier to reason about. At the moment I find the behaviour to do with clearing the history, storing the last task name and adding new commands hard to understand.
@mattbrictson Does this make sense? Should I look into this?
The text was updated successfully, but these errors were encountered: