ansys / pyensight

Python API for EnSight
http://ensight.docs.pyansys.com
MIT License
6 stars 2 forks source link

Mostieri/parallel runs avoid clash #384

Closed mariostieriansys closed 2 months ago

mariostieriansys commented 2 months ago

In my attempt to run PyEnSight tests in parallel during the ADO builds, I am having several issues on linux where port clashes happen between the different PyEnSight sessions.

There are two clashes happening. I am not sure which of the two, but surely one of these:

1) EnSight is launched without the "-ports" argument with a newly found random port. I believe EnSight internally should try to do the Client/Server connection with ports between 1104 to 1119, but potentially that's an issue 2) This is the most likely. The find_unused_port code in multiple simultaneous runs may find the same free ports before these are being used for an actual connection, like the gRPC connection or the VNC connection

To avoid these issues, I have introduced an internal function which inspects the current processes and their command lines, so to build a list of ports to avoid to be fed into find_unused_ports. Also, I am looking for an additional free port so to be used in the EnSight launch with "-ports" for the client/server connection. Finally, instead of using the pid of the process as starting point, I am using the random module. This workflow is being used only by the locallauncher

I have built the wheel and used it on one of the linux agents, the tests run correctly in parallel

codecov-commenter commented 2 months ago

Codecov Report

Attention: Patch coverage is 82.75862% with 5 lines in your changes missing coverage. Please review.

Project coverage is 96.32%. Comparing base (7071ba6) to head (75cd7f7). Report is 5 commits behind head on main.

Files Patch % Lines
src/ansys/pyensight/core/launcher.py 82.75% 3 Missing and 2 partials :warning:
Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #384 +/- ## ========================================== + Coverage 93.86% 96.32% +2.46% ========================================== Files 18 17 -1 Lines 2690 2615 -75 Branches 321 319 -2 ========================================== - Hits 2525 2519 -6 + Misses 124 52 -72 - Partials 41 44 +3 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.