ansys / pydpf-core

Data Processing Framework - Python Core
http://dpf.docs.pyansys.com/
MIT License
67 stars 25 forks source link

StreamsContainer.datasources #1729

Open ansys-akarcher opened 3 weeks ago

ansys-akarcher commented 3 weeks ago

Expose the StreamsContainer.datasources getter property.

Allows notably to retrieve ip after starting grpc server

PProfizi commented 1 week ago

@ansys-akarcher for some reason it does not work on Docker.

ansys-akarcher commented 1 week ago

Pasting here for future reference

=================================== FAILURES ===================================
_______________ test_streams_container_datasources[gRPC CLayer] ________________

server_type = <ansys.dpf.core.server_types.GrpcServer object at 0x7f03de7d24c0>
simple_bar = '/tmp/downloaded_examples/result_files/ASimpleBar.rst'

    def test_streams_container_datasources(server_type, simple_bar):
        ds = dpf.core.DataSources(simple_bar)
>       streams = dpf.core.operators.metadata.streams_provider(data_sources=ds).eval()

tests/test_streams_container.py:74: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/opt/hostedtoolcache/Python/3.9.19/x64/lib/python3.9/site-packages/ansys/dpf/core/dpf_operator.py:765: in eval
    return self.outputs._outputs[0]()
/opt/hostedtoolcache/Python/3.9.19/x64/lib/python3.9/site-packages/ansys/dpf/core/outputs.py:97: in __call__
    return self.get_data()
/opt/hostedtoolcache/Python/3.9.19/x64/lib/python3.9/site-packages/ansys/dpf/core/outputs.py:94: in get_data
    return self._operator.get_output(self._pin, type_output)
/opt/hostedtoolcache/Python/3.9.19/x64/lib/python3.9/site-packages/ansys/dpf/core/dpf_operator.py:572: in get_output
    internal_obj = type_tuple[1](self, pin)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

op = <ansys.dpf.core.operators.metadata.streams_provider.streams_provider object at 0x7f03ddd90790>
iOutput = 0

    @staticmethod
    def operator_getoutput_streams(op, iOutput):
        errorSize = ctypes.c_int(0)
        sError = ctypes.c_wchar_p()
        res = capi.dll.Operator_getoutput_streams(op._internal_obj if op is not None else None, utils.to_int32(iOutput), ctypes.byref(utils.to_int32(errorSize)), ctypes.byref(sError))
        if errorSize.value != 0:
>           raise errors.DPFServerException(sError.value)
E     ansys.dpf.gate.errors.DPFServerException: Invalid API pointer when calling function Operator_getoutput_streams

/opt/hostedtoolcache/Python/3.9.19/x64/lib/python3.9/site-packages/ansys/dpf/gate/generated/operator_capi.py:635: DPFServerException
______________ test_streams_container_datasources[ansys-grpc-dpf] ______________

server_type = <ansys.dpf.core.server_types.LegacyGrpcServer object at 0x7f03de794310>
simple_bar = '/tmp/downloaded_examples/result_files/ASimpleBar.rst'

    def test_streams_container_datasources(server_type, simple_bar):
        ds = dpf.core.DataSources(simple_bar)
>       streams = dpf.core.operators.metadata.streams_provider(data_sources=ds).eval()

tests/test_streams_container.py:74: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/opt/hostedtoolcache/Python/3.9.19/x64/lib/python3.9/site-packages/ansys/dpf/core/dpf_operator.py:765: in eval
    return self.outputs._outputs[0]()
/opt/hostedtoolcache/Python/3.9.19/x64/lib/python3.9/site-packages/ansys/dpf/core/outputs.py:97: in __call__
    return self.get_data()
/opt/hostedtoolcache/Python/3.9.19/x64/lib/python3.9/site-packages/ansys/dpf/core/outputs.py:94: in get_data
    return self._operator.get_output(self._pin, type_output)
/opt/hostedtoolcache/Python/3.9.19/x64/lib/python3.9/site-packages/ansys/dpf/core/dpf_operator.py:572: in get_output
    internal_obj = type_tuple[1](self, pin)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

op = <ansys.dpf.core.operators.metadata.streams_provider.streams_provider object at 0x7f03de195b50>
iOutput = 0

    @staticmethod
    def operator_getoutput_streams(op, iOutput):
        errorSize = ctypes.c_int(0)
        sError = ctypes.c_wchar_p()
        res = capi.dll.Operator_getoutput_streams(op._internal_obj if op is not None else None, utils.to_int32(iOutput), ctypes.byref(utils.to_int32(errorSize)), ctypes.byref(sError))
        if errorSize.value != 0:
>           raise errors.DPFServerException(sError.value)
E     ansys.dpf.gate.errors.DPFServerException: Invalid API pointer when calling function Operator_getoutput_streams

/opt/hostedtoolcache/Python/3.9.19/x64/lib/python3.9/site-packages/ansys/dpf/gate/generated/operator_capi.py:635: DPFServerException