Skip to content

Commit d46117b

Browse files
iboyd-ansysCopilot
andauthored
feat: implement grpc security options consistent with service pack releases (#555)
* implement grpc security options consistent with service pack releases * disable older versions in ci workflow for now * use sp versions of containers * use sp versions of containers (2) * try freeing space before docker pull * use sp image for doc build; temp disable lib vuln job * fix sp name for doc * try reinstate older versions * make default uds dir consistent * Update src/ansys/systemcoupling/core/client/grpc_transport.py Co-authored-by: Copilot <[email protected]> * Update src/ansys/systemcoupling/core/client/grpc_client.py Co-authored-by: Copilot <[email protected]> * Apply suggestions from code review Co-authored-by: Copilot <[email protected]> * Force reformat. * some prints->LOGs ; extend process died check slightly * add comment to explain process starter * doc fixes --------- Co-authored-by: Copilot <[email protected]>
1 parent d586100 commit d46117b

File tree

13 files changed

+854
-147
lines changed

13 files changed

+854
-147
lines changed

.github/actions/generate-api/action.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,13 @@ inputs:
1111
runs:
1212
using: "composite"
1313
steps:
14+
- name: Free up disk space
15+
run: |
16+
echo "Cleaning up disk space"
17+
sudo apt-get clean
18+
docker system prune --all --volumes --force
19+
shell: bash
20+
1421
- name: Pull docker image
1522
run: make docker-pull
1623
shell: bash

.github/workflows/ci.yml

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ env:
1616
DOCUMENTATION_CNAME: "systemcoupling.docs.pyansys.com"
1717
DOC_BUILD_SYC_VERSION: 25_2
1818
FLUENT_IMAGE_VERSION: "v25.2.0"
19-
SYC_IMAGE_VERSION: "v25.2.0"
19+
SYC_IMAGE_VERSION: "v25.2.0-sp03"
2020
MAPDL_IMAGE_VERSION: "v25.2-ubuntu-cicd"
2121

2222
permissions: {} # Zero permissions can be granted at the workflow level if not all jobs require permissions.
@@ -131,20 +131,20 @@ jobs:
131131
with:
132132
image-tag: v24.1.0
133133

134-
- name: Generate API for v242
134+
- name: Generate API for v242 (SP5)
135135
uses: ./.github/actions/generate-api
136136
with:
137-
image-tag: v24.2.0
137+
image-tag: v24.2.0-sp05
138138

139-
- name: Generate API for v251
139+
- name: Generate API for v251 (SP4)
140140
uses: ./.github/actions/generate-api
141141
with:
142-
image-tag: v25.1.0
142+
image-tag: v25.1.0-sp04
143143

144-
- name: Generate API for v252
144+
- name: Generate API for v252 (SP3)
145145
uses: ./.github/actions/generate-api
146146
with:
147-
image-tag: v25.2.0
147+
image-tag: v25.2.0-sp03
148148

149149
#- name: Generate API for latest
150150
# uses: ./.github/actions/generate-api
@@ -216,24 +216,24 @@ jobs:
216216
image-tag: v24.1.0
217217
upload-coverage: false
218218

219-
- name: Unit Test v24.2.0
219+
- name: Unit Test v24.2.0 (SP5)
220220
uses: ./.github/actions/unit-test
221221
with:
222-
image-tag: v24.2.0
222+
image-tag: v24.2.0-sp05
223223
upload-coverage: false
224224

225-
- name: Unit Test v25.1.0
225+
- name: Unit Test v25.1.0 (SP4)
226226
uses: ./.github/actions/unit-test
227227
with:
228-
image-tag: v25.1.0
228+
image-tag: v25.1.0-sp04
229229
upload-coverage: false
230230
env:
231231
ANSYSLMD_LICENSE_FILE: "1055@${{ secrets.LICENSE_SERVER }}"
232232

233-
- name: Unit Test v25.2.0
233+
- name: Unit Test v25.2.0 (SP3)
234234
uses: ./.github/actions/unit-test
235235
with:
236-
image-tag: v25.2.0
236+
image-tag: v25.2.0-sp03
237237
upload-coverage: true
238238
env:
239239
ANSYSLMD_LICENSE_FILE: "1055@${{ secrets.LICENSE_SERVER }}"

doc/source/api/core/launching.rst

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,12 @@ of System Coupling.
1212
:toctree: _autosummary
1313

1414
launch
15-
connect
15+
connect
16+
17+
Connection types
18+
================
19+
20+
.. autosummary::
21+
:toctree: _autosummary
22+
23+
ConnectionType

src/ansys/systemcoupling/core/__init__.py

Lines changed: 25 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525

2626
import appdirs
2727

28-
from ansys.systemcoupling.core.client.grpc_client import SycGrpc
28+
from ansys.systemcoupling.core.client.grpc_client import SycGrpc, ConnectionType
2929
from ansys.systemcoupling.core.session import Session
3030
from ansys.systemcoupling.core.util.logging import LOG
3131

@@ -41,6 +41,7 @@
4141

4242
def launch(
4343
*,
44+
connection_type: ConnectionType = ConnectionType.SECURE_LOCAL,
4445
port: int = None,
4546
working_dir: str = None,
4647
nprocs: int = None,
@@ -53,6 +54,12 @@ def launch(
5354
5455
Parameters
5556
----------
57+
connection_type: ConnectionType, optional
58+
Specifies the type of connection to make with the launched server.
59+
See :class:`ConnectionType` for available options.
60+
Not all options are currently supported. The default is a secure
61+
local connection. This will not work with some older versions or
62+
older versions that have not been updated with service pack releases.
5663
port : int, optional
5764
Port on which to connect to System Coupling. The default is
5865
``None``, in which case an available port is found and used.
@@ -73,8 +80,10 @@ def launch(
7380
The version will be sought in the standard installation location. The
7481
default is ``None``, which is equivalent to specifying
7582
``"252"`` ("2025 R2" release), unless either of the environment
76-
variables ``SYSC_ROOT`` or ``AWP_ROOT`` has been set. It is considered
77-
to be an error if either these is set *and* ``version`` is provided.
83+
variables ``SYSC_ROOT`` or ``AWP_ROOT`` has been set. In that case,
84+
the environment variable will be used to locate System Coupling.
85+
If ``version`` is also provided, it will not be used to locate System
86+
Coupling but it might still be used to infer some information about it.
7887
start_output: bool, optional
7988
Boolean to specify if the user wants to stream system coupling output.
8089
The default is ``False``, in which case the output stream is kept hidden.
@@ -102,6 +111,7 @@ def launch(
102111
rpc.start_pim_and_connect(version, start_output)
103112
else:
104113
rpc.start_and_connect(
114+
connection_type=connection_type,
105115
port=port,
106116
working_dir=working_dir,
107117
nprocs=nprocs,
@@ -163,7 +173,9 @@ def launch_remote(
163173
return Session(rpc)
164174

165175

166-
def connect(host: str, port: int) -> Session: # pragma: no cover
176+
def connect(
177+
host: str, port: int, connection_type: ConnectionType = ConnectionType.SECURE_LOCAL
178+
) -> Session: # pragma: no cover
167179
"""Connect to an instance of System Coupling already running in server mode.
168180
169181
Parameters
@@ -172,6 +184,14 @@ def connect(host: str, port: int) -> Session: # pragma: no cover
172184
IP address of the system running the System Coupling instance.
173185
port : int
174186
Port on which to connect to System Coupling.
187+
connection_type: ConnectionType, optional
188+
Specifies the type of connection to make with System Coupling.
189+
See :class:`ConnectionType` for available options.
190+
This must be compatible with the mode in which the server was
191+
started. The default is a secure local connection. This will
192+
not work with some older versions of System Coupling or versions
193+
that have not been updated with service pack releases. In these
194+
cases, an insecure connection type must be specified.
175195
176196
Returns
177197
-------
@@ -180,7 +200,7 @@ def connect(host: str, port: int) -> Session: # pragma: no cover
180200
remote System Coupling instance.
181201
"""
182202
rpc = SycGrpc()
183-
rpc.connect(host, port)
203+
rpc.connect(host, port, connection_type)
184204
syc = Session(rpc)
185205
return syc
186206

0 commit comments

Comments
 (0)