Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Optimize CGrpcServer getters #1284

Merged
merged 13 commits into from
Nov 24, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions src/ansys/dpf/core/result_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -144,9 +144,12 @@
return txt
except Exception as e:
raise e
from ansys.dpf.core.core import _description

return _description(self._internal_obj, self._server)
@property
def _description(self):
from ansys.dpf.core.core import _description

Check warning on line 150 in src/ansys/dpf/core/result_info.py

View check run for this annotation

Codecov / codecov/patch

src/ansys/dpf/core/result_info.py#L150

Added line #L150 was not covered by tests

return _description(self._internal_obj, self._server)

Check warning on line 152 in src/ansys/dpf/core/result_info.py

View check run for this annotation

Codecov / codecov/patch

src/ansys/dpf/core/result_info.py#L152

Added line #L152 was not covered by tests

@property
def _names(self):
Expand Down
25 changes: 15 additions & 10 deletions src/ansys/dpf/core/server_types.py
Original file line number Diff line number Diff line change
Expand Up @@ -678,6 +678,8 @@ def __init__(
self._grpc_client_path = load_api.load_grpc_client(ansys_path=ansys_path)
self._own_process = launch_server
self._local_server = False
self._os = None
self._version = None

address = f"{ip}:{port}"

Expand Down Expand Up @@ -735,21 +737,24 @@ def _check_first_call(self, num_connection_tryouts):

@property
def version(self):
from ansys.dpf.gate import data_processing_capi, integral_types
if not self._version:
from ansys.dpf.gate import data_processing_capi, integral_types

api = data_processing_capi.DataProcessingCAPI
major = integral_types.MutableInt32()
minor = integral_types.MutableInt32()
api.data_processing_get_server_version_on_client(self.client, major, minor)
out = str(int(major)) + "." + str(int(minor))
return out
api = data_processing_capi.DataProcessingCAPI
major = integral_types.MutableInt32()
minor = integral_types.MutableInt32()
api.data_processing_get_server_version_on_client(self.client, major, minor)
self._version = str(int(major)) + "." + str(int(minor))
return self._version

@property
def os(self):
from ansys.dpf.gate import data_processing_capi
if not self._os:
from ansys.dpf.gate import data_processing_capi

api = data_processing_capi.DataProcessingCAPI
return api.data_processing_get_os_on_client(self.client)
api = data_processing_capi.DataProcessingCAPI
self._os = api.data_processing_get_os_on_client(self.client)
return self._os

def _create_shutdown_funcs(self):
from ansys.dpf.gate import data_processing_capi
Expand Down
Loading