Skip to content
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

Option to retry failed commands #1578

Open
jheld opened this issue May 8, 2020 · 3 comments
Open

Option to retry failed commands #1578

jheld opened this issue May 8, 2020 · 3 comments
Labels
feature:new something does not exist yet, but should help:wanted Issues that have been acknowledged, a solution determined and a PR might likely be accepted.

Comments

@jheld
Copy link

jheld commented May 8, 2020

If an environment fails the test run, I think it would be nice to have support for automatically retrying the test environment.

Brute force would be simply to retry (with a parameter for the number of max retries). I'd also be interested in a way to tell the environment to run an altered command on the retry, in case only a subset of tests for that env would need to be re-run.

I think this probably would live as a plugin, but I'm not sure if the tox plugin system would even be able to support this sort of flow change.

I hope to research this more and if I find something before anyone responds, I'll post back.

With the hook system there is: tox_runtest. I'm uncertain exactly how the order of external registered plugins will be added against the one defined by tox. I am assuming they go first (esp given it runs with completion on first hook returning non None).

For a retry plugin to work, I think it would have to use the hookwrapper option, and as such it will call the other hooks until they succeed or max-retries reached. Still I'm a little concerned about how the order of plugin hooks is determined, but I hope that won't stop me from trying to do this!

@jheld jheld added the feature:new something does not exist yet, but should label May 8, 2020
@ssbarnea
Copy link
Member

ssbarnea commented Jun 8, 2020

As I faced a related issue where a specific command I run requires network access and may randomly fail. It would have being cool to be able to retry it by using a prefix, similar to how the - works to ignore the result.

Maybe a "?" prefix could mean repeat it 3 times if exit code is not zero (maybe configurable).

@gaborbernat gaborbernat changed the title auto retry failed env Option to retry failed commands Jan 13, 2022
@gaborbernat
Copy link
Member

I don't want to overload the command line even further to make it more cryptic. I'm inclined to add some command_retry option though that would allow users to specify the retry counts per command and then zip the two arrays for command. A PR for that would be welcomed.

@gaborbernat gaborbernat added the help:wanted Issues that have been acknowledged, a solution determined and a PR might likely be accepted. label Jan 13, 2022
@gaborbernat gaborbernat added this to the 4.2 milestone Jan 13, 2022
@mpatnode
Copy link

mpatnode commented Apr 5, 2022

+1 (Not seeing the upvote button.)

@gaborbernat gaborbernat removed this from the P-2 milestone Jun 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature:new something does not exist yet, but should help:wanted Issues that have been acknowledged, a solution determined and a PR might likely be accepted.
Projects
None yet
Development

No branches or pull requests

4 participants