Skip to content

upload_file_in_tmp_folder doesn't seem to work on docker image #466

Closed
@germa89

Description

@germa89

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

It seems that the method upload_file_in_tmp_folder does not work.

I keep getting an error on the script detailed below.

Steps To Reproduce

First start the docker image using:

docker run --name dpfserver --restart always -v `pwd`:/dpf -p 50058:50054 ghcr.io/pyansys/dpf-core/dpf:v2021.1 > logdpf.txt

Copy the following RST to your working directory:

file.zip

Then run the following script:

import os

from ansys.dpf import core as dpf


rst_path = os.path.join(os.getcwd(), "file.rst")
dpf.connect_to_server(port=50058)

server_file_path = dpf.upload_file_in_tmp_folder(rst_path)
model = dpf.Model(server_file_path)
print(model)

The error should be:

>>> import os
>>> from ansys.dpf import core as dpf
>>> rst_path = os.path.join(os.getcwd(), "file.rst")
>>> dpf.connect_to_server(port=50058)
>>> server_file_path = dpf.upload_file_in_tmp_folder(rst_path)
>>> model = dpf.Model(server_file_path)
>>> print(model)
---------------------------------------------------------------------------
DPFServerException                        Traceback (most recent call last)
Input In [2], in <cell line: 11>()
      9 server_file_path = dpf.upload_file_in_tmp_folder(rst_path)
     10 model = dpf.Model(server_file_path)
---> 11 print(model)

File C:\ProgramData\Miniconda3\envs\dpfcorereleased\lib\site-packages\ansys\dpf\core\model.py:199, in Model.__str__(self)
    197 txt = "DPF Model\n"
    198 txt += "-" * 30 + "\n"
--> 199 txt += str(self.results)
    200 txt += "-" * 30 + "\n"
    201 txt += str(self.metadata.meshed_region)

File C:\ProgramData\Miniconda3\envs\dpfcorereleased\lib\site-packages\ansys\dpf\core\model.py:155, in Model.results(self)
    111 """Available results of the model.
    112
    113 Organizes the results from DPF into accessible methods. All the available
   (...)
    152
    153 """
    154 if not self._results:
--> 155     args = [self.metadata._build_connector(), self.metadata.result_info,
    156             self.mesh_by_default, self._server]
    157     if misc.DYNAMIC_RESULTS:
    158         try:

File C:\ProgramData\Miniconda3\envs\dpfcorereleased\lib\site-packages\ansys\dpf\core\model.py:106, in Model.metadata(self)
     60 """Model metadata.
     61
     62 Includes:
   (...)
    103
    104 """
    105 if not self._metadata:
--> 106     self._metadata = Metadata(self._data_sources, self._server)
    107 return self._metadata

File C:\ProgramData\Miniconda3\envs\dpfcorereleased\lib\site-packages\ansys\dpf\core\model.py:263, in Metadata.__init__(self, data_sources, server)
    261 def __init__(self, data_sources, server):
    262     self._server = server
--> 263     self._set_data_sources(data_sources)
    264     self._meshed_region = None
    265     self._meshes_container = None

File C:\ProgramData\Miniconda3\envs\dpfcorereleased\lib\site-packages\ansys\dpf\core\model.py:402, in Metadata._set_data_sources(self, var_inp)
    400 else:
    401     self._data_sources = DataSources(server=self._server)
--> 402 self._cache_streams_provider()

File C:\ProgramData\Miniconda3\envs\dpfcorereleased\lib\site-packages\ansys\dpf\core\model.py:289, in Metadata._cache_streams_provider(self)
    285     self._stream_provider = operators.metadata.streams_provider(
    286         data_sources=self._data_sources, server=self._server
    287     )
    288 else:
--> 289     self._stream_provider = Operator("stream_provider", server=self._server)
    290     self._stream_provider.inputs.connect(self._data_sources)
    291 try:

File C:\ProgramData\Miniconda3\envs\dpfcorereleased\lib\site-packages\ansys\dpf\core\dpf_operator.py:113, in Operator.__init__(self, name, config, server)
    110 if self._internal_obj is None:
    111     raise KeyError(f"The operator {self.name} doesn't exist in the registry")
--> 113 self._spec = Specification(operator_name=self.name, server=self._server)
    114 # add dynamic inputs
    115 if len(self._spec.inputs) > 0 and self._inputs is None:

File C:\ProgramData\Miniconda3\envs\dpfcorereleased\lib\site-packages\ansys\dpf\core\operator_specification.py:235, in Specification.__init__(self, operator_name, specification, server)
    233 if operator_name:
    234     if self._server.has_client():
--> 235         self._internal_obj = self._api.operator_specification_new_on_client(
    236             self._server.client, operator_name)
    237     else:
    238         self._internal_obj = self._api.operator_specification_new(operator_name)

File C:\ProgramData\Miniconda3\envs\dpfcorereleased\lib\site-packages\ansys\dpf\gate\generated\operator_specification_capi.py:281, in OperatorSpecificationCAPI.operator_specification_new_on_client(client, op)
    279 res = capi.dll.Operator_specification_new_on_client(client._internal_obj, utils.to_char_ptr(op), ctypes.byref(utils.to_int32(errorSize)), ctypes.byref(sError))
    280 if errorSize.value != 0:
--> 281         raise errors.DPFServerException(sError.value)
    282 return res

DPFServerException: a unimplemented error ocurred:

Furthermore, the server_file_path = dpf.upload_file_in_tmp_folder(rst_path) returns an empty string:

>>> server_file_path = dpf.upload_file_in_tmp_folder(rst_path)
>>> server_file_path
''

Which Operating System are you using?

Windows

Which Python version are you using?

3.9

Installed packages

Show me
aiohttp==3.8.1
aiosignal==1.2.0
ansys-api-mapdl==0.5.1
ansys-api-platform-instancemanagement==1.0.0b3
ansys-dpf-core==0.6.0
ansys-dpf-gate==0.2.1
ansys-dpf-gatebin==0.2.1
ansys-grpc-dpf==0.6.0
ansys-mapdl-core==0.63.2
ansys-mapdl-reader==0.52.0
ansys-platform-instancemanagement==1.0.2
appdirs==1.4.4
argcomplete==2.0.0
argon2-cffi==21.3.0
argon2-cffi-bindings==21.2.0
asttokens==2.0.8
async-timeout==4.0.2
attrs==22.1.0
backcall==0.2.0
beautifulsoup4==4.11.1
bleach==4.1.0
cachetools==5.2.0
certifi @ file:///C:/Windows/TEMP/abs_e9b7158a-aa56-4a5b-87b6-c00d295b01fanefpc8_o/croots/recipe/certifi_1655968940823/work/certifi
cffi==1.15.0
charset-normalizer==2.1.1
colorama==0.4.5
cycler==0.11.0
debugpy==1.5.1
decorator==5.1.1
defusedxml==0.7.1
entrypoints==0.3
executing==1.0.0
fonttools==4.37.1
frozenlist==1.3.1
geomdl==5.3.1
google==3.0.0
google-api-core==2.10.0
google-api-python-client==2.58.0
google-auth==2.11.0
google-auth-httplib2==0.1.0
googleapis-common-protos==1.56.4
grpcio==1.48.1
httplib2==0.20.4
idna==3.3
imageio==2.21.2
importlib-metadata==4.12.0
ipython==8.4.0
ipython-genutils==0.2.0
ipywidgets==7.6.5
jedi==0.18.1
jsonschema==4.4.0
jupyter==1.0.0
jupyter-client==7.1.1
jupyter-console==6.4.0
jupyter-core==4.9.1
jupyterlab-pygments==0.1.2
jupyterlab-widgets==1.0.2
kiwisolver==1.4.4
mapdl @ file:///C:/Program%20Files/ANSYS%20Inc/v212/ANSYS/syslib/ansGRPC/User/mapdl-pyupf.tar.gz
MarkupSafe==2.0.1
matplotlib==3.5.3
matplotlib-inline==0.1.6
mpmath==1.2.1
multidict==6.0.2
nbclient==0.5.10
nest-asyncio==1.5.4
nose==1.3.7
notebook==6.4.7
numpy==1.23.2
packaging==21.3
pandocfilters==1.5.0
parso==0.8.3
pickleshare==0.7.5
Pillow==9.2.0
pipx==1.0.0
prometheus-client==0.12.0
prompt-toolkit==3.0.31
protobuf==3.20.1
protoc-gen-swagger==0.1.0
psutil==5.9.1
pure-eval==0.2.2
pyasn1==0.4.8
pyasn1-modules==0.2.8
pycparser==2.21
Pygments==2.13.0
pyiges==0.2.1
pyparsing==3.0.9
pyrsistent==0.18.1
pytest-cov==3.0.0
python-dateutil==2.8.2
pytz==2021.3
pyvista==0.36.1
pywin32==303
pywinpty==1.1.6
pyzmq==22.3.0
qtconsole==5.2.2
QtPy==2.0.0
requests==2.28.1
rsa==4.9
scipy==1.9.1
scooby==0.6.0
Send2Trash==1.8.0
six==1.16.0
soupsieve==2.3.2.post1
stack-data==0.5.0
sympy==1.9
terminado==0.12.1
testpath==0.5.0
tornado==6.1
tqdm==4.64.1
traitlets==5.3.0
uritemplate==4.1.1
urllib3==1.26.12
userpath==1.8.0
vtk==9.1.0
wcwidth==0.2.5
webencodings==0.5.1
widgetsnbextension==3.5.2
wincertstore==0.2
wslink==1.8.2
yarl==1.8.1
zipp==3.8.1

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions