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

In mapdl.input_strings(cmd), if cmd is very long command, it fails with MapdlExitedError #3089

Open
2 tasks done
DeepLineD opened this issue May 14, 2024 · 2 comments
Open
2 tasks done
Labels
BUG Issue, problem or error in PyMAPDL

Comments

@DeepLineD
Copy link

🔍 Before submitting the issue

  • I have searched among the existing issues
  • I am using a Python virtual environment

🐞 Description of the bug

in python, mapdl.input_strings(cmd), cmd is a very long command. If it is not called in the method, it will be executed normally. If it is put in the method, the error "ansys.mapdl.core.errors.MapdlExitedError: MAPDL server connection terminated" will be reported.

📝 Steps to reproduce

1,Define a string containing multiple commands
2,Then mapdl calls input_strings(cmd) to execute

💻 Which operating system are you using?

Windows

📀 Which ANSYS version are you using?

2023R1

🐍 Which Python version are you using?

3.11

📦 Installed packages

ansys
@DeepLineD DeepLineD added the BUG Issue, problem or error in PyMAPDL label May 14, 2024
@RobPasMue
Copy link
Member

Transferring to PyMAPDL repository - pinging @ansys/pymapdl-maintainers

@RobPasMue RobPasMue transferred this issue from ansys/pyansys May 14, 2024
@germa89 germa89 changed the title in python, mapdl.input_strings(cmd), cmd is a very long command. If it is not called in the method, it will be executed normally. If it is put in the method, the error "ansys.mapdl.core.errors.MapdlExitedError: MAPDL server connection terminated" will be reported. In mapdl.input_strings(cmd), if cmd is very long command, it fails with MapdlExitedError May 14, 2024
@germa89
Copy link
Collaborator

germa89 commented May 14, 2024

Hi @DeepLineD

The following code runs a very long sequence of APDL commands using
mapdl.input_strings:

from ansys.mapdl.core import launch_mapdl

mapdl = launch_mapdl(start_instance=False, port=50082)

cmd = ["/prep7"]

for i in range(1000000):
    cmd.append(f"/com hello {i}")

cmd = "\n".join(cmd)

print(len(cmd))
print("Running...")
out = mapdl.input_strings(cmd)
print(out[-400:])

And it does not fail:

(.venv) ➜  pymapdl git:(main) python temp.py
17888896
Running...
 999971
 hello 999972
 hello 999973
 hello 999974
 hello 999975
 hello 999976
 hello 999977
 hello 999978
 hello 999979
 hello 999980
 hello 999981
 hello 999982
 hello 999983
 hello 999984
 hello 999985
 hello 999986
 hello 999987
 hello 999988
 hello 999989
 hello 999990
 hello 999991
 hello 999992
 hello 999993
 hello 999994
 hello 999995
 hello 999996
 hello 999997
 hello 999998
 hello 999999

Using MAPDL v24.2 (docker image) and the following configuration:

Details

-------------------------------------------------------------------------------
PyAnsys Software and Environment Report
-------------------------------------------------------------------------------
  Date: Tue May 14 16:59:17 2024 CEST

                               OS : Darwin
                           CPU(s) : 8
                          Machine : arm64
                     Architecture : 64bit
                              RAM : 16.0 GiB
                      Environment : Python
                      File system : apfs
                       GPU Vendor : Apple
                     GPU Renderer : Apple M2
                      GPU Version : 4.1 Metal - 88

  Python 3.10.11 (v3.10.11:7d4cc5aa85, Apr  4 2023, 19:05:19) [Clang 13.0.0
  (clang-1300.0.29.30)]

                 ansys.mapdl.core : 0.69.dev0
                            numpy : 1.26.1
                     platformdirs : 3.11.0
                            scipy : 1.11.3
                             grpc : 1.59.0
               ansys.api.mapdl.v0 : Version unknown
               ansys.mapdl.reader : 0.53.0
                  google.protobuf : 3.20.3
                       matplotlib : 3.8.3
                          pyvista : 0.43.4
                           pyiges : 0.3.1
                             tqdm : 4.66.1
               ansys_sphinx_theme : 0.12.4
                   ansys.dpf.core : 0.9.0
                   ansys.dpf.post : Module not found
                   ansys.dpf.gate : 0.4.1
                ansys.fluent.core : Module not found
       ansys.fluent.visualization : Module not found
          ansys.fluent.parametric : Module not found
      ansys.grantami.bomanalytics : Module not found
             ansys.openapi.common : Module not found
ansys.platform.instancemanagement : 1.1.2
                   ansys.seascape : Module not found
               ansys.tools.report : 0.6.0
           ansys.tools.versioning : 0.5.0
                           pyaedt : Module not found
                          appdirs : 1.4.4
                          pexpect : 4.8.0
-------------------------------------------------------------------------------
Ansys Environment Report
-------------------------------------------------------------------------------


Ansys Installation
******************
No Ansys installations provided


Ansys Environment Variables
***************************
PYMAPDL_START_INSTANCE         False
PYMAPDL_PORT                   50092
DPF_START_SERVER               false
DPF_PORT                       50056
DPF_DEFAULT_PORT               50056
DPF_DOCKER_IMAGE               ghcr.io/ansys/dpf-core:22.2dev

Can you provide us with the model and code that fails for you?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
BUG Issue, problem or error in PyMAPDL
Projects
None yet
Development

No branches or pull requests

3 participants