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

fix: avoid verbose grpc interface when solving #3608

Merged
merged 11 commits into from
Dec 10, 2024

Conversation

germa89
Copy link
Collaborator

@germa89 germa89 commented Dec 10, 2024

Description

This PR solves #3591 issue. This issue covers the instability/bug seen where MAPDL gets stuck while running some commands, very frequently, the /SOLVE command.

The reason for this is that some MAPDL printouts was making MAPDL to wait infinitely for the next line.
These specific prints in MAPDL terminal were coming from a debug messenger (_MsgDbg1), an object which prints more output (sometimes for debugging purposes) if it is activated.
It seems this debug messenger is activated by default, but deactivated if we issue /VERIFY.
Additionally, the debugger can be also activated if we activate the gRPC debug messenger (mapdl._ctrl("set_verb", 5)) since these kind of messengers are singleton objects (unique in the whole program).

MAPDL was getting stuck because for reading the anstmp file, it uses std:getline (only!), hence if the line is empty, the getline waits forever. See https://stackoverflow.com/a/39905660/6650211

Until now, we did not realise because the first test running solve:

def test_bclist(mapdl, beam_solve, func):
func_ = getattr(mapdl, func)
out = func_()
out_list = out.to_list()
assert isinstance(out, BoundaryConditionsListingOutput)
assert isinstance(out_list, list) and out_list
with pytest.raises(ValueError):
out.to_array()
if has_dependency("pandas"):
out_df = out.to_dataframe()
assert isinstance(out_df, pd.DataFrame) and not out_df.empty

was using this fixture:

def beam_solve(mapdl, cleared):
mapdl.mute = True
mapdl.input(vmfiles["vm10"])
mapdl.post1()
mapdl.set(1, 2)
mapdl.mute = False

Which a verification manual example, which uses /VERIFY.
The command /VERIFY avoid printing these extra debug printouts.

Clearly this is a server side bug which should be fixed in the future versions. But for the moment, I am going to force MAPDL to run /VERIFY when we instantiate the object.

Issue linked

Related to #3591

Checklist

@germa89 germa89 requested a review from a team as a code owner December 10, 2024 14:37
@germa89 germa89 self-assigned this Dec 10, 2024
@ansys-reviewer-bot
Copy link
Contributor

Thanks for opening a Pull Request. If you want to perform a review write a comment saying:

@ansys-reviewer-bot review

@github-actions github-actions bot added the bug Issue, problem or error in PyMAPDL label Dec 10, 2024
@germa89 germa89 changed the title Fix/avoid-verbose-grpc-interface-when-solving fix: avoid verbose grpc interface when solving Dec 10, 2024
Copy link

codecov bot commented Dec 10, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 86.99%. Comparing base (afad43e) to head (1d63ba0).
Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3608      +/-   ##
==========================================
+ Coverage   86.97%   86.99%   +0.01%     
==========================================
  Files         187      187              
  Lines       14623    14628       +5     
==========================================
+ Hits        12719    12725       +6     
+ Misses       1904     1903       -1     

@germa89 germa89 enabled auto-merge (squash) December 10, 2024 16:46
@germa89
Copy link
Collaborator Author

germa89 commented Dec 10, 2024

@pyansys-ci-bot LGTM.

Copy link
Contributor

@pyansys-ci-bot pyansys-ci-bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Approving this PR because germa89 said so in here 😬

LGTM

@germa89 germa89 disabled auto-merge December 10, 2024 19:01
@germa89 germa89 merged commit 27c6ec9 into main Dec 10, 2024
50 of 51 checks passed
@germa89 germa89 deleted the fix/avoid-verbose-grpc-interface-when-solving branch December 10, 2024 19:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Issue, problem or error in PyMAPDL
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants