Skip to content

Commit e081f88

Browse files
adapts the "server types" how to into a licensing tutorial
1 parent df79026 commit e081f88

File tree

2 files changed

+24
-14
lines changed

2 files changed

+24
-14
lines changed

doc/source/user_guide/tutorials/dpf_server/index.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,3 +22,5 @@ This tutorial explains how to manipulate DPF client-server architecture
2222
:maxdepth: 2
2323
:hidden:
2424

25+
server_types.rst
26+

doc/source/user_guide/server_types.rst renamed to doc/source/user_guide/tutorials/dpf_server/server_types.rst

Lines changed: 22 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -29,52 +29,60 @@ using the :class:`InProcess <ansys.dpf.core.server_types.InProcessServer>` class
2929
3030
.. rst-class:: sphx-glr-script-out
3131

32-
.. code-block:: none
33-
34-
<ansys.dpf.core.server_types.InProcessServer object at ...>
32+
.. jupyter-execute::
33+
:hide-code:
34+
35+
from ansys.dpf import core as dpf
36+
local_server = dpf.start_local_server()
37+
local_server
3538

3639
This DPF Server can now be used to instantiate models, operators, and more.
3740

3841
.. code-block::
39-
42+
4043
# instantiate an operator
4144
local_operator = dpf.operators.results.displacement(server=local_server)
42-
45+
4346
# instantiate a model
4447
from ansys.dpf.core import examples
4548
local_model = dpf.Model(examples.find_simple_bar(), server=local_server)
46-
49+
4750
4851
DPF Server through the network using gRPC
4952
-----------------------------------------
5053

5154
The :class:`GrpcServer <ansys.dpf.core.server_types.GrpcServer>` class is used
52-
to enable gRPC communication:
55+
to enable gRPC communication:
5356

5457
.. code-block::
55-
58+
5659
from ansys.dpf import core as dpf
5760
grpc_server_config = dpf.AvailableServerConfigs.GrpcServer
5861
grpc_server = dpf.start_local_server(config=grpc_server_config)
5962
grpc_server
6063
6164
.. rst-class:: sphx-glr-script-out
6265

63-
.. code-block:: none
64-
65-
<ansys.dpf.core.server_types.GrpcServer object at ...>
66+
.. jupyter-execute::
67+
:hide-code:
68+
69+
from ansys.dpf import core as dpf
70+
grpc_server_config = dpf.AvailableServerConfigs.GrpcServer
71+
grpc_server = dpf.start_local_server(config=grpc_server_config)
72+
grpc_server
6673

6774
You can obtain the server port and IP address:
6875

6976
.. code-block::
7077
7178
print(grpc_server)
72-
79+
7380
.. rst-class:: sphx-glr-script-out
7481

75-
.. code-block:: none
82+
.. jupyter-execute::
83+
:hide-code:
7684

77-
DPF Server: {'server_ip': '127.0.0.1', 'server_port': 50052, 'server_process_id': 9999, 'server_version': '6.0', 'os': 'nt'}
85+
print(grpc_server)
7886

7987
From another machine, you can connect remotely to this DPF Server and instantiate models, operators, and more:
8088

0 commit comments

Comments
 (0)