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

Catching MAPDL process output #1746

Merged
merged 8 commits into from
Jan 11, 2023
Merged

Catching MAPDL process output #1746

merged 8 commits into from
Jan 11, 2023

Conversation

germa89
Copy link
Collaborator

@germa89 germa89 commented Dec 30, 2022

New features

Several things are done in this PR:

  • Added mapdl.launched property. This is True if we have started the mapdl process. It is similar to mapdl.local. However you can have mapdl.local equal to True (mapdl instance running on the same machine) but mapdl.launched equals False because you manually launched. Another PR should follow up to clarify/unify mapdl.local usage.

  • Adding support for process checking. Now if we fail to connect to MAPDL, we automatically check the process (subprocess.Popen) output and we raise any error, warning or fatal erros we find.

  try:
      self._multi_connect(timeout=timeout, set_no_abort=set_no_abort)
  except MapdlConnectionError as err:
      self._post_mortem_checks()
      raise err  # Raise original error if we couldn't catch it in post-mortem analysis
  else:
      self._log.debug("Connection established")
  • The mapdl process (subprocess.Popen) is now accessible on mapdl._mapdl_process in grpc and corba modes.
  • We dont do any checks on corba mode.
  • I have also started to deprecate verbose argument in corba and grpc classes.
  • Adding unit tests and docs.

Caveats

  • The processes are directed to a subprocess.PIPE object. It should have no effect on the normal MAPDL work mode because of the arguments -o supplied (in Windows). Because of this redirection, verbose needs to be deprecated (verbose redirect the output to screen?)
  • I'm considering if we should return an object after failing to connect. This object could be either an MAPDL class with some attributes with the error output (for debugging purposes) or an object with this error information

@germa89 germa89 added Enhancement Improve any current implemented feature New Feature Request or proposal for a new feature labels Dec 30, 2022
@germa89 germa89 self-assigned this Dec 30, 2022
@github-actions github-actions bot added the Documentation Documentation related (improving, adding, etc) label Dec 30, 2022
@codecov
Copy link

codecov bot commented Dec 30, 2022

Codecov Report

Merging #1746 (d7c5f7f) into main (9eb459a) will decrease coverage by 4.08%.
The diff coverage is 86.25%.

@@            Coverage Diff             @@
##             main    #1746      +/-   ##
==========================================
- Coverage   85.60%   81.51%   -4.09%     
==========================================
  Files          45       45              
  Lines        7667     7743      +76     
==========================================
- Hits         6563     6312     -251     
- Misses       1104     1431     +327     

Copy link
Contributor

@koubaa koubaa left a comment

Choose a reason for hiding this comment

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

lgtm

@germa89
Copy link
Collaborator Author

germa89 commented Dec 30, 2022

@clatapie please have a look at this PR. I think it is an interesting one!

@germa89
Copy link
Collaborator Author

germa89 commented Jan 5, 2023

The ubuntu local test keeps getting stuck on the test_krylov_with_pressure_load test. See #1755

Inteeeresttinggggg...

@germa89
Copy link
Collaborator Author

germa89 commented Jan 5, 2023

Last commit just to check if a newly created run fixes the test. Of course it should not... but who knows.

@germa89 germa89 merged commit 127c8b9 into main Jan 11, 2023
@germa89 germa89 deleted the feat/used-port-error branch January 11, 2023 20:32
@germa89 germa89 restored the feat/used-port-error branch January 24, 2023 16:19
germa89 added a commit that referenced this pull request Jan 24, 2023
@germa89 germa89 deleted the feat/used-port-error branch March 14, 2023 13:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Documentation Documentation related (improving, adding, etc) Enhancement Improve any current implemented feature New Feature Request or proposal for a new feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants