Skip to content

Commit 1a134b0

Browse files
authored
Merge branch 'master' into dependabot/pip/requirements/wheel-0.45.1
2 parents 1075d9f + c43e575 commit 1a134b0

File tree

20 files changed

+85
-16
lines changed

20 files changed

+85
-16
lines changed

.ci/run_examples.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,13 +33,13 @@
3333
print(file)
3434
minimum_version_str = get_example_required_minimum_dpf_version(file)
3535
if float(server_version) - float(minimum_version_str) < -0.05:
36-
print(f"Example skipped as it requires DPF {minimum_version_str}.")
36+
print(f"Example skipped as it requires DPF {minimum_version_str}.", flush=True)
3737
continue
3838
try:
3939
out = subprocess.check_output([sys.executable, file])
4040
except subprocess.CalledProcessError as e:
4141
sys.stderr.write(str(e.args))
4242
if e.returncode != 3221225477:
43-
print(out)
43+
print(out, flush=True)
4444
raise e
45-
print("PASS")
45+
print("PASS", flush=True)

.github/ISSUE_TEMPLATE/bug.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ body:
101101
id: installed-packages
102102
attributes:
103103
label: Installed packages
104-
description: Run `python -m pip list` to list installed packages
105-
placeholder: Paste the output of `python -m pip list` here
104+
description: Run `python -m pip freeze` to list installed packages
105+
placeholder: Paste the output of `python -m pip freeze` here
106106
validations:
107107
required: true

.github/workflows/ci_release.yml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,7 @@ jobs:
8888
with:
8989
ANSYS_VERSION: ${{ github.event.inputs.ansys_version || '251' }}
9090
python_versions: '["3.10", "3.11"]'
91+
DOCSTRING: false
9192
wheel: false
9293
wheelhouse: true
9394
standalone_suffix: ${{ github.event.inputs.standalone_branch_suffix || '.pre0' }}
@@ -109,6 +110,7 @@ jobs:
109110
with:
110111
ANSYS_VERSION: ${{ github.event.inputs.ansys_version || '251' }}
111112
python_versions: '["3.10", "3.11"]'
113+
DOCSTRING: false
112114
wheel: false
113115
wheelhouse: false
114116
standalone_suffix: ${{ github.event.inputs.standalone_branch_suffix || '.pre0' }}
@@ -131,6 +133,15 @@ jobs:
131133
standalone_suffix: ${{ github.event.inputs.standalone_branch_suffix || '.pre0' }}
132134
secrets: inherit
133135

136+
retro_242:
137+
name: "retro 242"
138+
uses: ./.github/workflows/tests.yml
139+
with:
140+
ANSYS_VERSION: "242"
141+
python_versions: '["3.9"]'
142+
DOCSTRING: false
143+
secrets: inherit
144+
134145
retro_241:
135146
name: "retro 241"
136147
uses: ./.github/workflows/tests.yml

.github/workflows/examples.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,6 @@ jobs:
132132
shell: bash
133133
working-directory: .ci
134134
run: |
135-
echo on
136135
python run_examples.py
137136
138137
- name: "Kill all servers"

examples/04-advanced/13-manage_licensing.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@
104104
# license increment is used, and for what maximum duration.
105105

106106
# Use the LicenseContextManager to block a specific increment for a limited duration
107-
with dpf.LicenseContextManager(increment_name="preppost", license_timeout_in_seconds=1.0) as lic:
107+
with dpf.LicenseContextManager(increment_name="preppost", license_timeout_in_seconds=5.0) as lic:
108108
# Instantiate the licensed operator
109109
out = op_premium.eval()
110110
print(out)

pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ plotting = [
4444
"matplotlib>=3.2",
4545
# 3D plotting
4646
"pyvista>=0.32.0",
47+
"vtk!=9.4.0",
4748
# Animations
4849
"imageio < 2.28.1",
4950
"imageio-ffmpeg",

requirements/requirements_docs.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,3 +14,4 @@ sphinx-notfound-page==1.0.4
1414
sphinx-reredirects==0.1.3
1515
sphinx_design==0.6.1
1616
sphinxcontrib-napoleon==0.7
17+
vtk==9.3.1

requirements/requirements_test.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,4 @@ pytest-cov==5.0.0
77
pytest-order==1.3.0
88
pytest-rerunfailures==15.0
99
pyvista==0.44.1
10+
vtk==9.3.1

src/ansys/dpf/core/any.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,7 @@ def _type_to_new_from_get_as_method(self, obj):
123123
custom_type_field,
124124
collection,
125125
workflow,
126+
dpf_operator,
126127
)
127128

128129
if issubclass(obj, int):
@@ -196,6 +197,11 @@ def _type_to_new_from_get_as_method(self, obj):
196197
self._api.any_new_from_int_collection,
197198
self._api.any_get_as_int_collection,
198199
)
200+
elif issubclass(obj, dpf_operator.Operator):
201+
return (
202+
self._api.any_new_from_operator,
203+
self._api.any_get_as_operator,
204+
)
199205

200206
@staticmethod
201207
def new_from(obj, server=None):

src/ansys/dpf/core/dpf_operator.py

Lines changed: 21 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ class Operator:
121121
122122
"""
123123

124-
def __init__(self, name, config=None, server=None):
124+
def __init__(self, name=None, config=None, server=None, operator=None):
125125
"""Initialize the operator with its name by connecting to a stub."""
126126
self.name = name
127127
self._internal_obj = None
@@ -136,14 +136,29 @@ def __init__(self, name, config=None, server=None):
136136
# step 2: get api
137137
self._api_instance = None # see _api property
138138

139-
# step3: init environment
139+
# step 3: init environment
140140
self._api.init_operator_environment(self) # creates stub when gRPC
141141

142-
# step4: if object exists: take instance, else create it (server)
143-
if self._server.has_client():
144-
self._internal_obj = self._api.operator_new_on_client(self.name, self._server.client)
142+
# step 4: if object exists, take the instance, else create it
143+
if operator is not None:
144+
if isinstance(operator, Operator):
145+
core_api = self._server.get_api_for_type(
146+
capi=data_processing_capi.DataProcessingCAPI,
147+
grpcapi=data_processing_grpcapi.DataProcessingGRPCAPI,
148+
)
149+
core_api.init_data_processing_environment(self)
150+
self._internal_obj = core_api.data_processing_duplicate_object_reference(operator)
151+
self.name = operator.name
152+
else:
153+
self._internal_obj = operator
154+
self.name = self._api.operator_name(self)
145155
else:
146-
self._internal_obj = self._api.operator_new(self.name)
156+
if self._server.has_client():
157+
self._internal_obj = self._api.operator_new_on_client(
158+
self.name, self._server.client
159+
)
160+
else:
161+
self._internal_obj = self._api.operator_new(self.name)
147162

148163
if self._internal_obj is None:
149164
raise KeyError(

0 commit comments

Comments
 (0)