RuntimeConfig#

class ansys.dpf.core.runtime_config.RuntimeClientConfig(data_tree, server=None)#

Enables to access and set runtime configuration options to gRPC client. Mostly used to configurate gRPC streaming and calls options.

Parameters:
  • data_tree (ctypes.cvoid_p) – DataTree pointer describing the existing parameters configuration of DataprocessingCore.

  • server (BaseServer, optional) – Server with channel connected to the remote or local instance. The default is None, in which case an attempt is made to use the global server.

Notes

Available from 4.0 server version.

Examples

Get runtime configuration for Client.

>>> from ansys.dpf import core as dpf
>>> server = dpf.start_local_server(config=dpf.server_factory.AvailableServerConfigs.GrpcServer
...    , as_global=False)
>>> client_config = dpf.settings.get_runtime_client_config(server=server)
>>> cache_enabled = client_config.cache_enabled
>>> stream_floats_instead_of_doubles = client_config.stream_floats_instead_of_doubles
>>> streaming_buffer_size = client_config.streaming_buffer_size
>>> return_arrays = client_config.return_arrays
>>> client_config.return_arrays = return_arrays # or True/False
>>> client_config.cache_enabled = cache_enabled # or True/False
>>> client_config.stream_floats_instead_of_doubles = stream_floats_instead_of_doubles
... # or True/False
>>> client_config.streaming_buffer_size = streaming_buffer_size # or 10000, 2000 ...
property cache_enabled#

Whether gRPC requests and responses are intercepted to cache them and retrieve them when appropriate.

Return type:

bool

Notes

Can only be used for a gRPC communication.

property streaming_buffer_size#

Sets the chunk size (in bytes) used in gRPC streaming calls.

Return type:

int

Notes

Can only be used for a gRPC communication.

property stream_floats_instead_of_doubles#
Sets whether double values (8 bytes) should be converted and streamed as float values

(4 bytes) in gRPC streaming calls.

Return type:

bool

Notes

Can only be used for a gRPC communication.

property return_arrays#

All methods will return ansys.dpf.core.DPFArray (instead of lists) when possible. Default is True. See for example, ansys.dpf.core.Scoping.ids().

Return type:

bool

class ansys.dpf.core.runtime_config.RuntimeCoreConfig(data_tree, server=None)#

Enables to access and set runtime configuration options to DataProcessingCore.

Parameters:
  • data_tree (ctypes.cvoid_p) – DataTree pointer describing the existing parameters configuration of DataprocessingCore.

  • server (BaseServer, optional) – Server with channel connected to the remote or local instance. The default is None, in which case an attempt is made to use the global server.

Notes

Available from 4.0 server version.

Examples

Get runtime configuration for DataProcessingCore.

>>> from ansys.dpf import core as dpf
>>> server = dpf.start_local_server(config=dpf.server_factory.AvailableServerConfigs.GrpcServer
...    , as_global=False) 
>>> core_config = dpf.settings.get_runtime_core_config(server=server) 
>>> num_threads = core_config.num_threads 
>>> core_config.num_threads = num_threads # or 3, 6, ... 
property num_threads#

Sets the default number of threads to use for all operators, default is omp_get_num_threads.

Return type:

int

property license_timeout_in_seconds#

Sets the default number of threads to use for all operators, default is omp_get_num_threads.

Return type:

float