Closed germa89 closed 6 months ago
I need to have a look at this and see the implications. I'm creating this issue to raise visibility.
Hi, I think I have this issue. It seems that when I start an analysis in one instance of APDL and want to work on a second analysis in the meantime both crash and I have some error message saying that I can't use some functions (from the second analysis) in the /SOLU menu (the one where is running the first analysis).
Do you have any idea on how to bypass this issue?
Thanks
Hi @NFougeron
Can you try specifying the ports for each instance??
from ansys.mapdl.core import launch_mapdl
mapdl = launch_mapdl(port=50052, run_location="C:\temp\temp1")
from ansys.mapdl.core import launch_mapdl
mapdl = launch_mapdl(port=50053, run_location="C:\temp\temp2")
Thanks it seems to work !
Nolwenn Fougeron, Docteur en Biomécanique Chercheur en post-doctorat au laboratoire TIMC - Équipe Biomeca-TIMC
Univ. Grenoble Alpes - CNRS UMR 5525 - Pavillon Taillefer
Faculté de Médecine - 38706 La Tronche cedex - France
De : German @.> Envoyé : vendredi 18 novembre 2022 11:24 À : pyansys/pymapdl @.> Cc : NFougeron @.>; Mention @.> Objet : Re: [pyansys/pymapdl] PyMAPDL connect to existing instance instead of creating a new one (Issue #1113)
Hi @NFougeronhttps://github.com/NFougeron
Can you try specifying the ports for each instance??
from ansys.mapdl.core import launch_mapdl mapdl = launch_mapdl(port=50052, run_location="C:\temp\temp1")
from ansys.mapdl.core import launch_mapdl mapdl = launch_mapdl(port=50053, run_location="C:\temp\temp2")
— Reply to this email directly, view it on GitHubhttps://github.com/pyansys/pymapdl/issues/1113#issuecomment-1319809346, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AHEOASRK7IVHRDZ3Z3QMRFTWI5KMFANCNFSM5VRUOJTQ. You are receiving this because you were mentioned.Message ID: @.***>
We should probably consider implementing a logic that checks if an MAPDL instance is running already at the given port. If start_instance
is equal to True
, we should launch another instance in another port.
This might require some rewriting on the launcher
module which might be difficult. Also we will need to list the instances (e.g. posix
with ps aux
).
@germa89 Kind of stupid question, in windows system, how to know which port the 'mapdl' is using? And what should be a valid port number? Is it just a random number?
@germa89 Kind of stupid question, in windows system, how to know which port the 'mapdl' is using? And what should be a valid port number? Is it just a random number?
Hi @SerinaAnsys
By default the port is 50052. If the instance is already launched you can check mapdl.port
in any OS.
>>> from ansys.mapdl.core import launch_mapdl
>>> mapdl = launch_mapdl()
>>> mapdl.port
50052
Ideally a number above 50052. I tend to use any number between 50060-5080.
@germa89
AttributeError Traceback (most recent call last) Cell In[10], line 1 ----> 1 mapdl.port
AttributeError: 'MapdlGrpc' object has no attribute 'port'
It seems doesn't work. Do you know why?
Are we able to do that now? Suppose the mapdl is already exited, how can I check that and load a new one? Is there a command?
I tried to check ''mapdl' in locals()' and I see it's there. However, I tried to type 'mapdl', it says, 'MAPDL exited'.
We should probably consider implementing a logic that checks if an MAPDL instance is running already at the given port. If
start_instance
is equal toTrue
, we should launch another instance in another port.
Sorry... I meant mapdl._port
.
You can know if the session exited by doing:
>>> mapdl._exited
True # if exited.
Most of the issues raised in this issue were fixed in:
mapdl.port
and mapdl.exited
in https://github.com/ansys/pymapdl/pull/2246start_instance=False
https://github.com/ansys/pymapdl/pull/2603 and https://github.com/ansys/pymapdl/pull/2616
=== From internal feedback DK ===
If you have a PyMAPDL session running:
and run another session:
the later will connect into the former, which is not desirable.