rework container.execute to use multiprocessing as watchdog #50
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I'm going to ask for some of the other behave test users I know of to try this out since it's quite a significant change. But it seems to be critical in getting GitHub Actions CI working again for our images: an individual test that blocks will now fail without causing the whole test run to be aborted.
I've pushed this to my fork's
v1
branch too, to make it easier to try out.(commit message follows)
Workaround
docker.APIClient.exec_start
sometimes blocking indefinitely by running in a sub-process and throwing an exception if the sub-process does not complete within a given timeout.Remove the existing post-exec code which polled the value of
docker.APIClient.exec_inspect
for 15 seconds to determine if the command had completed. This is effectively performed by the new sub-process waiting. I've set the timeout to 30 seconds, up from 15, which (from experimentation) seems to be necessary to account for the extra time it takes to invokeexec_start
within the timeout period.A future change should make this timeout configurable.
This general pattern (of watchdogging the docker library code) might be useful elsewhere, in particular for any future efforts to support parallel test execution.