-
Notifications
You must be signed in to change notification settings - Fork 124
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
feat: Add an inprocess backend to pymapdl #3198
Conversation
Thanks for opening a Pull Request. If you want to perform a review write a comment saying: @ansys-reviewer-bot review |
for more information, see https://pre-commit.ci
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #3198 +/- ##
==========================================
- Coverage 86.63% 84.21% -2.43%
==========================================
Files 52 53 +1
Lines 9550 9625 +75
==========================================
- Hits 8274 8106 -168
- Misses 1276 1519 +243 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you Jamil for this PR.
I have some concerns.
- There is no testing. There already docker images v25.1 so if that image has the backend changes you want, you could use it.
- It is not clear to me where
run_command
will be implemented, and how. - Many of the methods you implemented should be on
_MapdlCore
class to avoid code duplicity withMapdlGrpc
class.
self._backend = backend | ||
self._cleanup: bool = True | ||
self._name: str = "MapdlInProcess" | ||
self._session_id: Optional[str] = None |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This line should be implemented in _MapdlCore
. My fault.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems to be something specific to the grpc backend.
We can try to move it to mapdl_grpc instead and replace these lines by a _before_run()
command implemented in the children.
@koubaa
self._cleanup: bool = True | ||
self._name: str = "MapdlInProcess" | ||
self._session_id: Optional[str] = None | ||
self._mute: bool = False |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Probably this one could be also implemented in _MapdlCore
.
@property | ||
def name(self) -> str: | ||
return self._name | ||
|
||
@name.setter | ||
def name(self, name) -> None: | ||
self._name = name | ||
|
||
def _check_session_id(self) -> None: | ||
pass |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should go to _MapdlCore
.
def __repr__(self): | ||
info = super().__repr__() | ||
return info |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We are not changing anything from super()
I guess it should be implemented (again) in _MapdlCore
class.
* add an inprocess backend to pymapdl --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: pyansys-ci-bot <[email protected]>
Description
This PR add a new backend that will be used by MAPDL when exposing a python interpreter with PyMapdl.
It takes a module containing the function
run_command
as an argument.