server:grpc start server
Last update: 31.07.2026Version: 0.0.0
Description
Starts a dpf's grpc server (if local) or connect to one and keep it waiting for requests in a streams.
Inputs
This table lists the input pins for this operator. Input pins define the data that the operator requires to perform its operation. Some inputs are required, while others are optional and provide additional configuration. Each parameter is detailed in the sections that follow the table.
| Pin number | Name | Status | Expected type(s) |
|---|---|---|---|
| 0 | ip | string |
|
| 1 | port | string, int32 |
|
| 2 | starting_option | int32 |
|
| 3 | should_start_server | bool |
|
| 4 | data_sources | data_sources |
|
| 5 | dpf_context | string, int32 |
|
| 6 | transport_mode | int32 |
|
| 7 | tls_certificates_dir | string |
ip (Pin 0)
- Required: No
- Expected type(s):
string
If no ip address is put, the local ip address is taken
port (Pin 1)
If no port is put, port 50052 is taken
starting_option (Pin 2)
- Required: No
- Expected type(s):
int32
default is 1 that starts server in new thread. With 0, this thread will be waiting for grpc calls and will not be usable for anything else. With 2, it the server will be started in a new process.
should_start_server (Pin 3)
- Required: No
- Expected type(s):
bool
If true, the server is assumed to be local and is started. If false, only a client (able to send grpc calls) will be started
data_sources (Pin 4)
- Required: No
- Expected type(s):
data_sources
A data source with result key 'grpc' and file path 'port:ip' can be used instead of the input port and IP.
dpf_context (Pin 5)
This pin is associated with pin(2) = 2 (server started in a new process). User can enter the integer associated with a DPF context (1: Standalone Context - DpfCoreStandalone.xml, 3: Custom - DpfCustomDefined.xml) or a string with the path of the XML specifying the context.
transport_mode (Pin 6)
- Required: No
- Expected type(s):
int32
Transport Mode.
- 0: Insecure (default, localhost as default)
- 1: Insecure Legacy (Legacy logic to find non localhost interface)* 2: mTLS (ANSYS_GRPC_CERTIFICATES must point on certificates folder, containing server.crt, server.key and ca.crt)
tls_certificates_dir (Pin 7)
- Required: No
- Expected type(s):
string
Path to certificates directory when mTLS mode is enabled.
Outputs
This table lists the output pins for this operator. Output pins provide the results of the operator's computation and can be connected to inputs of other operators or retrieved for further processing. Each output is detailed in the sections that follow the table.
| Pin number | Name | Expected type(s) |
|---|---|---|
| 0 | grpc_streams | streams_container |
grpc_streams (Pin 0)
- Expected type(s):
streams_container
dpf streams handling the server, if the server is started in this thread, then nothing is added in output
Configurations
This operator supports configuration options that modify its behavior.
mutex
- Expected type(s):
bool - Default value: false
If this option is set to true, the shared memory is prevented from being simultaneously accessed by multiple threads.
Scripting
This operator can be accessed through scripting interfaces using these identifiers.
Category: server
Plugin: grpc
Scripting name: grpc_start_server
Full name: server.grpc_start_server
Internal name: grpc::stream_provider
License: None
Examples
These examples demonstrate how to use this operator in different programming environments. Each example shows how to instantiate the operator, connect the required inputs, and retrieve the output.
C++
#include "dpf_api.h"
ansys::dpf::Operator op("grpc::stream_provider"); // operator instantiation
op.connect(0, my_ip);
op.connect(1, my_port);
op.connect(2, my_starting_option);
op.connect(3, my_should_start_server);
op.connect(4, my_data_sources);
op.connect(5, my_dpf_context);
op.connect(6, my_transport_mode);
op.connect(7, my_tls_certificates_dir);
ansys::dpf::Streams my_grpc_streams = op.getOutput<ansys::dpf::Streams>(0);
CPython
import ansys.dpf.core as dpf
op = dpf.operators.server.grpc_start_server() # operator instantiation
op.inputs.ip.connect(my_ip)
op.inputs.port.connect(my_port)
op.inputs.starting_option.connect(my_starting_option)
op.inputs.should_start_server.connect(my_should_start_server)
op.inputs.data_sources.connect(my_data_sources)
op.inputs.dpf_context.connect(my_dpf_context)
op.inputs.transport_mode.connect(my_transport_mode)
op.inputs.tls_certificates_dir.connect(my_tls_certificates_dir)
my_grpc_streams = op.outputs.grpc_streams()
IPython
import mech_dpf
import Ans.DataProcessing as dpf
op = dpf.operators.server.grpc_start_server() # operator instantiation
op.inputs.ip.Connect(my_ip)
op.inputs.port.Connect(my_port)
op.inputs.starting_option.Connect(my_starting_option)
op.inputs.should_start_server.Connect(my_should_start_server)
op.inputs.data_sources.Connect(my_data_sources)
op.inputs.dpf_context.Connect(my_dpf_context)
op.inputs.transport_mode.Connect(my_transport_mode)
op.inputs.tls_certificates_dir.Connect(my_tls_certificates_dir)
my_grpc_streams = op.outputs.grpc_streams.GetData()
Changelog
- Version 0.0.0: Initial release.