Skip to content

Commit ec78ec3

Browse files
committed
[OMCProcess*] add docstrings
1 parent 6a17c1a commit ec78ec3

1 file changed

Lines changed: 30 additions & 0 deletions

File tree

OMPython/OMCSession.py

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -740,11 +740,17 @@ def __del__(self):
740740
self._omc_process = None
741741

742742
def get_port(self) -> Optional[str]:
743+
"""
744+
Get the port to connect to the OMC process.
745+
"""
743746
if not isinstance(self._omc_port, str):
744747
raise OMCSessionException(f"Invalid port to connect to OMC process: {self._omc_port}")
745748
return self._omc_port
746749

747750
def get_log(self) -> str:
751+
"""
752+
Get the log file content of the OMC session.
753+
"""
748754
if self._omc_loghandle is None:
749755
raise OMCSessionException("Log file not available!")
750756

@@ -775,6 +781,9 @@ def omc_run_data_update(self, omc_run_data: OMCSessionRunData, session: OMCSessi
775781

776782

777783
class OMCProcessPort(OMCProcess):
784+
"""
785+
OMCProcess implementation which uses a port to connect to an already running OMC server.
786+
"""
778787

779788
def __init__(
780789
self,
@@ -788,6 +797,9 @@ def omc_run_data_update(self, omc_run_data: OMCSessionRunData, session: OMCSessi
788797

789798

790799
class OMCProcessLocal(OMCProcess):
800+
"""
801+
OMCProcess implementation which runs the OMC server locally on the machine (Linux / Windows).
802+
"""
791803

792804
def __init__(
793805
self,
@@ -904,6 +916,9 @@ def omc_run_data_update(self, omc_run_data: OMCSessionRunData, session: OMCSessi
904916

905917

906918
class OMCProcessDockerHelper(OMCProcess):
919+
"""
920+
Base class for OMCProcess implementations which run the OMC server in a Docker container.
921+
"""
907922

908923
def __init__(
909924
self,
@@ -996,13 +1011,19 @@ def _omc_port_get(self) -> str:
9961011
return port
9971012

9981013
def get_server_address(self) -> Optional[str]:
1014+
"""
1015+
Get the server address of the OMC server running in a Docker container.
1016+
"""
9991017
if self._dockerNetwork == "separate" and isinstance(self._dockerCid, str):
10001018
output = subprocess.check_output(["docker", "inspect", self._dockerCid]).decode().strip()
10011019
return json.loads(output)[0]["NetworkSettings"]["IPAddress"]
10021020

10031021
return None
10041022

10051023
def get_docker_container_id(self) -> str:
1024+
"""
1025+
Get the Docker container ID of the Docker container with the OMC server.
1026+
"""
10061027
if not isinstance(self._dockerCid, str):
10071028
raise OMCSessionException(f"Invalid docker container ID: {self._dockerCid}!")
10081029

@@ -1034,6 +1055,9 @@ def omc_run_data_update(self, omc_run_data: OMCSessionRunData, session: OMCSessi
10341055

10351056

10361057
class OMCProcessDocker(OMCProcessDockerHelper):
1058+
"""
1059+
OMC process running in a Docker container.
1060+
"""
10371061

10381062
def __init__(
10391063
self,
@@ -1175,6 +1199,9 @@ def _docker_omc_start(self) -> Tuple[subprocess.Popen, DummyPopen, str]:
11751199

11761200

11771201
class OMCProcessDockerContainer(OMCProcessDockerHelper):
1202+
"""
1203+
OMC process running in a Docker container (by container ID).
1204+
"""
11781205

11791206
def __init__(
11801207
self,
@@ -1264,6 +1291,9 @@ def _docker_omc_start(self) -> Tuple[subprocess.Popen, DummyPopen]:
12641291

12651292

12661293
class OMCProcessWSL(OMCProcess):
1294+
"""
1295+
OMC process running in Windows Subsystem for Linux (WSL).
1296+
"""
12671297

12681298
def __init__(
12691299
self,

0 commit comments

Comments
 (0)