ansys / pymapdl

Pythonic interface to MAPDL
https://mapdl.docs.pyansys.com
MIT License
433 stars 121 forks source link

ansys\mapdl\core\mapdl_grpc.py MapdlGrpc._multi_connect function timeout not influenced by launch_mapdl(start_timeout) #1188

Closed AR-Philip closed 2 years ago

AR-Philip commented 2 years ago

Before submitting the issue

Description of the bug

I recently tried to work with pyMapdl remotely, connect to the license server via VPN. As the VPN connection tends to be a bit slower than a direct connection to the license server, when launching mapdl via the launch_mapdl function, an error would occur that read: OSError: Unable to connect to MAPDL gRPC instance at 127.0.0.1:50052

The input argument start_timeout does not seem to take any effect on this connection error, but as I looked for the issue, I saw that the method MapdlGrpc._multi_connect is called without passing a timeout argument, so that it always defaults to a total timeout of 15 seconds for this specific call. This seemed too short for my VPN, and as I changed the default to 45 seconds in my venv, launching mapdl worked again.

I would suggest calling the method MapdlGrpc._multi_connect with a timeout derived from the start_timeout argument in the launch_mapdl function.

Steps To Reproduce

connect via VPN to your license server

try to launch mapdl via launch_mapdl

see if the error occurs for you

Which Operating System are you using?

Windows

Which Python version are you using?

3.9

Installed packages

aiohttp==3.8.1 aiosignal==1.2.0
amqp==5.1.1
ansys-api-mapdl==0.5.1
ansys-api-mapdl-v0==0.4.1
ansys-api-platform-instancemanagement==1.0.0b3 ansys-corba==0.1.0
ansys-mapdl-core==0.62.1 ansys-mapdl-reader==0.51.11 ansys-platform-instancemanagement==1.0.2 appdirs==1.4.4 APScheduler==3.9.1 argon2-cffi==21.3.0 argon2-cffi-bindings==21.2.0 asgiref==3.5.0 async-timeout==4.0.2 attrs==21.4.0 bcrypt==3.2.0 billiard==3.6.4.0 boto3==1.21.9 botocore==1.24.43 Brotli==1.0.9 bugsnag==4.2.0 cachetools==5.0.0 celery==5.2.3 certifi==2021.10.8 cffi==1.15.0 chardet==4.0.0 charset-normalizer==2.0.12 click==8.1.2 click-didyoumean==0.3.0 click-plugins==1.1.1 click-repl==0.2.0 Collectfast==2.2.0 colorama==0.4.4 cryptography==36.0.2 cssselect2==0.6.0 cycler==0.11.0 Cython==0.29.27 defusedxml==0.7.1 Deprecated==1.2.13 distlib==0.3.4 dj-database-url==0.5.0 Django==4.0.3 django-appconf==1.0.5 django-cookie-consent==0.3.1 django-heroku==0.3.1 django-json-widget==1.1.1 django-memoize==2.3.1 django-object-actions==3.1.0 django-redis==5.2.0 django-redis-sessions==0.6.2 django-storages==1.12.3 django-tables2==2.4.1 ecdsa==0.17.0 et-xmlfile==1.1.0 factory-boy==3.2.1 Faker==13.3.4 filelock==3.6.0 fonttools==4.32.0 frozenlist==1.3.0 future==0.18.2 geomdl==5.3.1 google-api-core==2.7.2 google-api-python-client==2.45.0 google-auth==2.6.5 google-auth-httplib2==0.1.0 googleapis-common-protos==1.56.0 grpcio==1.44.0 gunicorn==20.1.0 html5lib==1.1 httplib2==0.20.4 idna==3.3 imageio==2.17.0 importlib-metadata==4.11.3 jmespath==0.10.0 kaleido==0.1.0 kiwisolver==1.4.2 kombu==5.2.4 matplotlib==3.5.1 multidict==6.0.2 newrelic==7.10.0.175 numpy==1.22.3 oauthlib==3.1.1 opencv-python-headless==4.5.5.64 openpyxl==3.0.9 packaging==21.3 pandas==1.4.1 Pillow==9.1.0 pip-licenses==3.5.4 pipenv==2022.3.28 platformdirs==2.5.2 plotly==5.6.0 prompt-toolkit==3.0.29 protobuf==3.20.0 protoc-gen-swagger==0.1.0 psycopg2==2.9.3 PTable==0.9.2 pyasn1==0.4.8 pyasn1-modules==0.2.8 pycparser==2.21 pydantic==1.9.0 pydyf==0.1.2 pyiges==0.2.1 PyJWT==2.3.0 pyparsing==3.0.7 pyphen==0.12.0 python-dateutil==2.8.2 python-dotenv==0.19.2 python-jose==3.3.0 python3-openid==3.2.0 pytz==2022.1 pytz-deprecation-shim==0.1.0.post0 pyvista==0.34.1 qrcode==7.3.1 redis==4.1.4 regex==2022.3.15 requests==2.27.1 requests-oauthlib==1.3.1 rsa==4.8 s3transfer==0.5.2 scipy==1.7.3 scooby==0.5.12 seaborn==0.11.2 six==1.16.0 social-auth-app-django==5.0.0 social-auth-core==4.2.0 sqlparse==0.4.2 stripe==2.67.0 tenacity==8.0.1 text-unidecode==1.3 tinycss2==1.1.1 tqdm==4.64.0 types-requests==2.27.25 types-urllib3==1.26.14 typing-extensions==4.2.0 tzdata==2022.1 tzlocal==4.2 uritemplate==4.1.1 urllib3==1.26.9 vine==5.0.0 virtualenv==20.13.3 virtualenv-clone==0.5.7 vtk==9.1.0 vue4j==0.1 wcwidth==0.2.5 weasyprint==54.2 webencodings==0.5.1 WebOb==1.8.7 whitenoise==6.0.0 wrapt==1.14.0 wslink==1.5.3 xlrd==2.0.1 yarl==1.7.2 zipp==3.7.0 zopfli==0.2.1

germa89 commented 2 years ago

Hi @AR-Philip

Thank you very much for opening this issue. You are right! timeout variable is not being passed. I'm going to fix it now.

Kind regards,