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

Exit MAPDL at the end of each example #919

Merged
merged 6 commits into from
Feb 23, 2022
Merged

Exit MAPDL at the end of each example #919

merged 6 commits into from
Feb 23, 2022

Conversation

mgalloue
Copy link
Contributor

All examples starts launching MAPDL using launch_mapdl() method and should stop it properly at the end using mapdl.exit() method.
On our side, when we are running this examples inside jupyter lab, mapdl instances are created and never deleted.

@codecov
Copy link

codecov bot commented Feb 22, 2022

Codecov Report

Merging #919 (3ea00ae) into main (5954e3f) will increase coverage by 0.29%.
The diff coverage is n/a.

@@            Coverage Diff             @@
##             main     #919      +/-   ##
==========================================
+ Coverage   72.49%   72.78%   +0.29%     
==========================================
  Files          39       39              
  Lines        5682     5681       -1     
==========================================
+ Hits         4119     4135      +16     
+ Misses       1563     1546      -17     

@akaszynski
Copy link
Collaborator

While I'm not fundamentally opposed to this, you may consider using our testing configuration that overrides launch_mapdl to simply use an existing instance. See:
https://mapdldocs.pyansys.com/contributing.html#testing

export PYMAPDL_START_INSTANCE=False
export PYMAPDL_PORT=<MAPDL Port> (default 50052)
export PYMAPDL_IP=<MAPDL IP> (default 127.0.0.1)

This way you can run through all examples using one instance of mapdl, rather than starting and stopping MAPDL for each test.

Let me know if this testing configuration works.


If you're still in favor of us including this, please include new lines at the end of each file. See: https://www.flake8rules.com/rules/W391.html

@cdan6
Copy link

cdan6 commented Feb 22, 2022

@akaszynski One of the goals of our testing sessions is precisely to use separate mapdl pods for users. So using a single instance for all notebooks is definitely not appropriate.
Moreover, since each file calls launch_mapdl(), it must call mapdl.exit() to be consistent.
If you do not want to kill mapdl when running a test, then I believe you'll have to hack mapdl.exit() the same way you hacked launch_mapdl().

@akaszynski
Copy link
Collaborator

Sounds fair @cdan6, and this is better than patching all the files when copying the examples.

Thanks for adding this and fixing the line endings!

@akaszynski akaszynski enabled auto-merge (squash) February 22, 2022 22:39
akaszynski
akaszynski previously approved these changes Feb 22, 2022
@akaszynski akaszynski self-requested a review February 23, 2022 09:45
@akaszynski akaszynski dismissed their stale review February 23, 2022 09:45

local doc builds fail

@akaszynski
Copy link
Collaborator

Local docbuilds fail. I'm looking into this.

@akaszynski akaszynski changed the title Exit MAPDL at the end of each test Exit MAPDL at the end of each example Feb 23, 2022
@akaszynski akaszynski merged commit 4179a06 into main Feb 23, 2022
@akaszynski akaszynski deleted the mgalloue/exit_mapdl branch February 23, 2022 12:15
@cdan6
Copy link

cdan6 commented Feb 23, 2022

Thanks for taking care of this, @akaszynski.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants