Skip to content

Unknown error occurred while uploading file #2254

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

Open
3 tasks done
germa89 opened this issue May 5, 2025 · 6 comments
Open
3 tasks done

Unknown error occurred while uploading file #2254

germa89 opened this issue May 5, 2025 · 6 comments
Labels
bug Something isn't working

Comments

@germa89
Copy link
Contributor

germa89 commented May 5, 2025

Before submitting the issue

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

Description of the bug

So I did created a DPF-standalone image and I am now trying to use it in PyMAPDL CICD.

However I am getting the following error:

    @pytest.fixture()
    def model(dpf_server, mapdl, solved_box, tmpdir):
        # Download RST file
        rst_path = mapdl.download_result(str(tmpdir.mkdir("tmpdir")))
    
        # Upload RST
        if not dpf_server.local_server:
>           rst_path = dpf.upload_file_in_tmp_folder(rst_path, server=dpf_server)

tests/test_dpf.py:67: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
.venv_312/lib/python3.12/site-packages/ansys/dpf/core/core.py:106: in upload_file_in_tmp_folder
    return base.upload_file_in_tmp_folder(file_path, new_file_name)
.venv_312/lib/python3.12/site-packages/ansys/dpf/core/core.py:834: in upload_file_in_tmp_folder
    return self._api.data_processing_upload_file(
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

args = ()
kwargs = {'client': <ansys.dpf.core.server_types.LegacyGrpcServer object at 0x14b937bc0>, 'file_path': '/private/var/folders/m7/qsr6z1m57rx8z_8xj8f3nm9r0000gp/T/pytest-of-german.ayuso/pytest-5/test_metadata_meshed_region0/tmpdir/file.rst', 'to_server_file_path': 'file.rst', 'use_tmp_dir': True}
_InactiveRpcError = <class 'grpc._channel._InactiveRpcError'>, _MultiThreadedRendezvous = <class 'grpc._channel._MultiThreadedRendezvous'>
details = 'unknown error occurred while uploading file'

    @wraps(func)
    def wrapper(*args, **kwargs):
        """Capture gRPC exceptions."""
        from grpc._channel import _InactiveRpcError, _MultiThreadedRendezvous
        try:
            out = func(*args, **kwargs)
        except (_InactiveRpcError, _MultiThreadedRendezvous) as error:
            details = error.details()
            if "object is null in the dataBase" in details:
                raise DPFServerNullObject(details) from None
            elif "Unable to open the following file" in details:
                raise DPFServerException(
                    "The result file could not be found or could not be opened, the server raised an error message: \n" + details) from None
>           raise DPFServerException(details) from None
E           ansys.dpf.gate.errors.DPFServerException: unknown error occurred while uploading file

.venv_312/lib/python3.12/site-packages/ansys/dpf/gate/errors.py:46: DPFServerException

DPF debug

root@24f60efe4feb:/home# ls
2025_05_05-09-36-57  TrackDump.log
root@24f60efe4feb:/home# cat TrackDump.log 
DPF:operator:grpc::stream_provider
root@24f60efe4feb:/home# cat TrackDump.log 
DPF:operator:grpc::stream_provider
root@24f60efe4feb:/home# cat 2025_05_05-09-36-57/init.log 
entering grpc::stream_provider:Id0
|  INPUTS 
|  |  -> in(prov) 0:     <string> 
|  |  -> in(prov) 1:     <string> 50052
|  |  -> in(prov) 2:     <int32> 0
|  |  -> in(prov) 3:     <bool> true
|  |  -> in(prov) 4:     <data_sources> n_result_file=1; result_files=[]; n_file=1; files=[; ]; 
|   
root@24f60efe4feb:/home# 

Steps To Reproduce

Code to replicate

# Setting docker
docker pull ghcr.io/ansys/mapdl:v25.2-ubuntu-dpf-standalone
docker pull ghcr.io/ansys/mapdl:v25.2.4-ubuntu-standard

# Running docker
docker run -d --name MAPDL_INT_v25.2.4-ubuntu-standard --restart always --env [email protected] --env ANSYS_LOCK='OFF' --publish 50052:50052 --publish 50055:50055 -w /local/simulation --cpus 4 --oom-kill-disable --memory=8GB --memory-swap=8GB --shm-size=4GB -u 0:0 --cap-add syslog ghcr.io/ansys/mapdl:v25.2.4-ubuntu-standard -np 4 -m 8192 -db 4096 -meba
docker run -d --name dpfserver -p 50058:50052 -e DATAPROCESSING_DEBUG=/home/ ghcr.io/ansys/mapdl:v25.2-ubuntu-dpf-standalone

# Clonning pymapdl
git clone https://github.com/ansys/pymapdl.git
cd pymapdl

# Setting up the environment
python3 -m venv .venv
source .venv/bin/activate
pip install -e '.[test]'

export PYMAPDL_START_INSTANCE=false
export PYMAPDL_PORT=50052
export DPF_PORT=50058
export HAS_DPF=TRUE
export DPF_START_SERVER=false
pytest -k dpf

Which Operating System causes the issue?

MacOS

Which DPF/Ansys version are you using?

DPF Server 2025.2.pre0

Which Python version causes the issue?

3.12

Installed packages

accessible-pygments==0.0.5
aiohappyeyeballs==2.4.6
aiohttp==3.11.13
aiosignal==1.3.2
alabaster==1.0.0
ansys-api-mapdl==0.5.2
ansys-api-platform-instancemanagement==1.1.2
ansys-dpf-core==0.13.6
-e git+https://github.com/ansys/pymapdl.git@1068dceb79f177260ab195b8b733e0bd5a8be192#egg=ansys_mapdl_core
ansys-mapdl-reader==0.54.2
ansys-math-core==0.2.2
ansys-platform-instancemanagement==1.1.2
ansys-sphinx-theme @ git+https://github.com/ansys/ansys-sphinx-theme.git@07641597268ba45bc63dbe80271e4eaebc506b9a
ansys-tools-path==0.7.1
ansys-tools-visualization-interface==0.9.1
anyio==4.8.0
appdirs==1.4.4
appnope==0.1.4
argon2-cffi==23.1.0
argon2-cffi-bindings==21.2.0
arrow==1.3.0
asttokens==3.0.0
async-lru==2.0.4
attrs==24.2.0
autopep8==2.3.2
babel==2.17.0
beautifulsoup4==4.13.3
bleach==6.2.0
cachetools==5.5.2
certifi==2025.1.31
cffi==1.17.1
cfgv==3.4.0
charset-normalizer==3.4.1
click==8.1.8
colorama==0.4.6
comm==0.2.2
contourpy==1.3.1
coverage==7.6.12
cycler==0.12.1
debugpy==1.8.12
decorator==5.2.1
defusedxml==0.7.1
distlib==0.3.9
docutils==0.21.2
executing==2.2.0
fastjsonschema==2.21.1
filelock==3.18.0
fonttools==4.56.0
fqdn==1.5.1
frozenlist==1.5.0
geomdl==5.3.1
google-api-core==2.24.1
google-api-python-client==2.162.0
google-auth==2.38.0
google-auth-httplib2==0.2.0
googleapis-common-protos==1.68.0
gprof2dot==2024.6.6
grpcio==1.70.0
h11==0.14.0
httpcore==1.0.7
httplib2==0.22.0
httpx==0.28.1
identify==2.6.9
idna==3.10
imageio==2.37.0
imageio-ffmpeg==0.6.0
imagesize==1.4.1
importlib_metadata==8.6.1
iniconfig==2.0.0
ipydatawidgets==4.3.5
ipykernel==6.29.5
ipython==8.32.0
ipywidgets==8.1.5
isoduration==20.11.0
jedi==0.19.2
Jinja2==3.1.5
json5==0.10.0
jsonpointer==3.0.0
jsonschema==4.23.0
jsonschema-specifications==2024.10.1
jupyter==1.1.1
jupyter-console==6.6.3
jupyter-events==0.12.0
jupyter-lsp==2.2.5
jupyter-sphinx==0.5.3
jupyter_client==8.6.3
jupyter_core==5.7.2
jupyter_server==2.15.0
jupyter_server_terminals==0.5.3
jupyterlab==4.3.5
jupyterlab_pygments==0.3.0
jupyterlab_server==2.27.3
jupyterlab_widgets==3.0.13
kiwisolver==1.4.8
MarkupSafe==3.0.2
matplotlib==3.10.1
matplotlib-inline==0.1.7
mistune==3.1.2
more-itertools==10.6.0
msgpack==1.1.0
multidict==6.1.0
narwhals==1.28.0
nbclient==0.10.2
nbconvert==7.16.6
nbformat==5.10.4
nest-asyncio==1.6.0
nodeenv==1.9.1
notebook==7.3.2
notebook_shim==0.2.4
numpy==2.2.3
numpydoc==1.8.0
overrides==7.7.0
packaging==24.2
pandas==2.2.3
pandocfilters==1.5.1
parso==0.8.4
pdf2image==1.17.0
pexpect==4.9.0
pillow==11.1.0
platformdirs==4.3.6
plotly==6.0.0
pluggy==1.5.0
pooch==1.8.2
pre_commit==4.2.0
prometheus_client==0.21.1
prompt_toolkit==3.0.50
propcache==0.3.0
proto-plus==1.26.0
protobuf==4.25.6
psutil==7.0.0
ptyprocess==0.7.0
pure_eval==0.2.3
pyansys-tools-report==0.8.2
pyansys-tools-versioning==0.6.0
pyasn1==0.6.1
pyasn1_modules==0.4.1
pycodestyle==2.12.1
pycparser==2.22
pydata-sphinx-theme==0.16.1
pyfakefs==5.8.0
Pygments==2.19.1
pyiges==0.3.1
pypandoc==1.15
pyparsing==3.2.1
pytest==8.3.5
pytest-cov==6.1.1
pytest-profiling==1.8.1
pytest-random-order==1.1.1
pytest-reportlog==0.4.0
pytest-rerunfailures==15.0
pytest-sphinx==0.6.3
pytest-timeout==2.3.1
pytest_pyvista==0.1.9
python-dateutil==2.9.0.post0
python-json-logger==3.2.1
pythreejs==2.4.2
pytz==2025.1
pyvista==0.44.1
PyYAML==6.0.2
pyzmq==26.2.1
referencing==0.36.2
requests==2.32.3
rfc3339-validator==0.1.4
rfc3986-validator==0.1.1
roman-numerals-py==3.1.0
rpds-py==0.23.1
rsa==4.9
scipy==1.15.2
scooby==0.10.0
Send2Trash==1.8.3
setuptools==75.8.1
six==1.17.0
sniffio==1.3.1
snowballstemmer==2.2.0
soupsieve==2.6
Sphinx==8.2.1
sphinx-autobuild==2024.10.3
sphinx-autodoc-typehints==3.1.0
sphinx-copybutton==0.5.2
sphinx-gallery==0.19.0
sphinx-jinja==2.0.2
sphinx-notfound-page==1.1.0
sphinx_design==0.6.1
sphinxcontrib-applehelp==2.0.0
sphinxcontrib-devhelp==2.0.0
sphinxcontrib-htmlhelp==2.1.0
sphinxcontrib-jsmath==1.0.1
sphinxcontrib-qthelp==2.0.0
sphinxcontrib-serializinghtml==2.0.0
sphinxcontrib-websupport==2.0.0
sphinxemoji==0.3.1
stack-data==0.6.3
starlette==0.46.0
tabulate==0.9.0
terminado==0.18.1
tinycss2==1.4.0
tornado==6.4.2
tqdm==4.67.1
traitlets==5.14.3
traittypes==0.2.1
trame==3.8.0
trame-client==3.5.2
trame-server==3.3.0
trame-vtk==2.8.15
trame-vuetify==2.8.1
types-python-dateutil==2.9.0.20241206
typing_extensions==4.12.2
tzdata==2025.1
uri-template==1.3.0
uritemplate==4.1.1
urllib3==2.3.0
uvicorn==0.34.0
virtualenv==20.29.3
vtk==9.3.1
watchfiles==1.0.4
wcwidth==0.2.13
webcolors==24.11.1
webencodings==0.5.1
websocket-client==1.8.0
websockets==15.0
widgetsnbextension==4.0.13
wslink==2.3.2
yarl==1.18.3
zipp==3.21.0
@germa89 germa89 added the bug Something isn't working label May 5, 2025
@germa89
Copy link
Contributor Author

germa89 commented May 5, 2025

Alternatively, this is the code to run the same PyMAPDL code:

from ansys.mapdl.core import launch_mapdl

mapdl = launch_mapdl(port=50052)
mapdl.prep7()
mapdl.et(1, "SOLID5")
mapdl.block(0, 10, 0, 20, 0, 30)
mapdl.esize(10)
mapdl.vmesh("ALL")
mapdl.units("SI")  # SI - International system (m, kg, s, K).
# Define a material (nominal steel in SI)
mapdl.mp("EX", 1, 210e9)  # Elastic moduli in Pa (kg/(m*s**2))
mapdl.mp("DENS", 1, 7800)  # Density in kg/m3
mapdl.mp("PRXY", 1, 0.3)  # Poisson's Ratio
# Fix the left-hand side.
mapdl.nsel("S", "LOC", "Z", 0)
mapdl.d("ALL", "UX")
mapdl.d("ALL", "UY")
mapdl.d("ALL", "UZ")

mapdl.nsel("S", "LOC", "Z", 30)
mapdl.f("ALL", "FX", 1000)
mapdl.run("/SOLU")
mapdl.antype("STATIC")
mapdl.solve()
mapdl.finish()

rst_path = mapdl.download_result()

from ansys.dpf import core as dpf
DPF_PORT=50058

dpf_server = dpf.connect_to_server(port=DPF_PORT)

# Upload RST
if not dpf_server.local_server:
    rst_path = dpf.upload_file_in_tmp_folder(rst_path, server=dpf_server) # it fails here

model = dpf.Model(rst_path)

@germa89
Copy link
Contributor Author

germa89 commented May 5, 2025

Using the old DPF docker container fix it... but of course, this is 22.2. I would love some guidance regarding how to make sure we are running DPF properly on the server side on a container.

docker run -d --name dpfserver222 -p 50058:50052 -e DATAPROCESSING_DEBUG=/home/ ghcr.io/ansys/dpf-core:22.2dev

@germa89
Copy link
Contributor Author

germa89 commented May 5, 2025

@germa89
Copy link
Contributor Author

germa89 commented May 5, 2025

I realise that on MacOS, I am forced to use the LegacyGrpcServer (dpf.core.AvailableServerConfigs.LegacyGrpcServer).

Probably that is creating the problem? Since it seems the problem comes from the gRPC configuration.

@germa89
Copy link
Contributor Author

germa89 commented May 13, 2025

I believe the problem is related to ubuntu.. since similar procedure works with Rocky. Do you have any instructions to build DPF docker images based on ubuntu?

@germa89
Copy link
Contributor Author

germa89 commented May 14, 2025

Ok the problem seems to be in the gRPC interface when running DPF in an Ubuntu container. The pydpf client on the host fails to upload the file to the container.

Reference for building the docker image: https://github.com/ansys-dpf/dpf-standalone/blob/linux_release-25.2/Dockerfile

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant