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 |
germa89
left a comment
There was a problem hiding this comment.
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_commandwill be implemented, and how. - Many of the methods you implemented should be on
_MapdlCoreclass to avoid code duplicity withMapdlGrpcclass.
| self._backend = backend | ||
| self._cleanup: bool = True | ||
| self._name: str = "MapdlInProcess" | ||
| self._session_id: Optional[str] = None |
There was a problem hiding this comment.
This line should be implemented in _MapdlCore. My fault.
There was a problem hiding this comment.
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.
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.
This should go to _MapdlCore.
| def __repr__(self): | ||
| info = super().__repr__() | ||
| return info |
There was a problem hiding this comment.
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 <pyansys.github.bot@ansys.com>
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_commandas an argument.