diff --git a/doc/source/user_guide/tutorials/dpf_server/index.rst b/doc/source/user_guide/tutorials/dpf_server/index.rst index efc4e1bfdb..8031a9a19e 100644 --- a/doc/source/user_guide/tutorials/dpf_server/index.rst +++ b/doc/source/user_guide/tutorials/dpf_server/index.rst @@ -12,13 +12,15 @@ This tutorial explains how to manipulate DPF client-server architecture :margin: 2 .. grid-item-card:: Switch between local and remote server - :link: ref_tutorials + :link: user_guide_server_types :link-type: ref :text-align: center - This tutorial + explains how to manipulate DPF client-server architecture .. toctree:: :maxdepth: 2 :hidden: + server_types.rst + diff --git a/doc/source/user_guide/server_types.rst b/doc/source/user_guide/tutorials/dpf_server/server_types.rst similarity index 90% rename from doc/source/user_guide/server_types.rst rename to doc/source/user_guide/tutorials/dpf_server/server_types.rst index 8ee493a7bd..8e1ebdc0b1 100644 --- a/doc/source/user_guide/server_types.rst +++ b/doc/source/user_guide/tutorials/dpf_server/server_types.rst @@ -25,56 +25,64 @@ using the :class:`InProcess ` class from ansys.dpf import core as dpf local_server = dpf.start_local_server() - local_server + print(local_server) .. rst-class:: sphx-glr-script-out - .. code-block:: none - - + .. jupyter-execute:: + :hide-code: + + from ansys.dpf import core as dpf + local_server = dpf.start_local_server() + print(local_server) This DPF Server can now be used to instantiate models, operators, and more. .. code-block:: - + # instantiate an operator local_operator = dpf.operators.results.displacement(server=local_server) - + # instantiate a model from ansys.dpf.core import examples local_model = dpf.Model(examples.find_simple_bar(), server=local_server) - + DPF Server through the network using gRPC ----------------------------------------- The :class:`GrpcServer ` class is used -to enable gRPC communication: +to enable gRPC communication: .. code-block:: - + from ansys.dpf import core as dpf grpc_server_config = dpf.AvailableServerConfigs.GrpcServer grpc_server = dpf.start_local_server(config=grpc_server_config) - grpc_server + print(grpc_server) .. rst-class:: sphx-glr-script-out - .. code-block:: none - - + .. jupyter-execute:: + :hide-code: + + from ansys.dpf import core as dpf + grpc_server_config = dpf.AvailableServerConfigs.GrpcServer + grpc_server = dpf.start_local_server(config=grpc_server_config) + print(grpc_server) You can obtain the server port and IP address: .. code-block:: print(grpc_server) - + .. rst-class:: sphx-glr-script-out - .. code-block:: none + .. jupyter-execute:: + :hide-code: - DPF Server: {'server_ip': '127.0.0.1', 'server_port': 50052, 'server_process_id': 9999, 'server_version': '6.0', 'os': 'nt'} + print(grpc_server) From another machine, you can connect remotely to this DPF Server and instantiate models, operators, and more: