Reduce load on drain integration test to reduce race-condition failures #3640
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.
This PR reduces the load places on the interchange and on the whole test environment caused by repeatedly querying the interchange for connected managers. It does this by increasing the period between such requests, from the default, every 20ms, to every 100ms.
In the last few days, test_drain.py began failing often. I have seen it occasionally fail before. This was initially a problem in PR #3639 which is unrelated, but I recreated the problem in CI against master as of #3627.
I investigated and found this behaviour causing the failure:
Looking at the CI logs for a failing case, I saw direct evidence that the worker pool takes more than 1 second to start up in
manager.log
:There's more than a second delay between "... connected to interchange" and the subsequent message "Will request drain". There's not a huge amount of stuff happening between these lines but there are things like multiprocessing initialization which starts a new process.
It looks like this bit of code is slow even in the successful case: rerunning until success, I see this timing in CI:
which is still a large fraction of a second (but sufficiently less than a second for the test to pass).
I haven't investigated what is taking that time. I haven't investigated if I also see that on my laptop.
I hypothesised that a lot of these test failures come from the test environment being quite loaded. I'm especially suspicious of using
try_assert
with its default timings which are very tight (20ms) - the connected managers RPC here would be expected to run much less frequently, more like every 5 seconds in regular Parsl use.So I lengthed the period of the try_asserts in this test, to try to reduce load caused there.
That makes the test pass repeatedly again.
Things not investigated/debugged: