Skip to content

Commit 2971b14

Browse files
committed
Merge branch 'OMCProcess_docstrings' into small_updates
2 parents d5096f6 + 18592f7 commit 2971b14

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
@@ -486,11 +486,17 @@ def __del__(self):
486486
self._omc_process = None
487487

488488
def get_port(self) -> Optional[str]:
489+
"""
490+
Get the port to connect to the OMC process.
491+
"""
489492
if not isinstance(self._omc_port, str):
490493
raise OMCSessionException(f"Invalid port to connect to OMC process: {self._omc_port}")
491494
return self._omc_port
492495

493496
def get_log(self) -> str:
497+
"""
498+
Get the log file content of the OMC session.
499+
"""
494500
if self._omc_loghandle is None:
495501
raise OMCSessionException("Log file not available!")
496502

@@ -512,6 +518,9 @@ def _get_portfile_path(self) -> Optional[pathlib.Path]:
512518

513519

514520
class OMCProcessPort(OMCProcess):
521+
"""
522+
OMCProcess implementation which uses a port to connect to an already running OMC server.
523+
"""
515524

516525
def __init__(
517526
self,
@@ -522,6 +531,9 @@ def __init__(
522531

523532

524533
class OMCProcessLocal(OMCProcess):
534+
"""
535+
OMCProcess implementation which runs the OMC server locally on the machine (Linux / Windows).
536+
"""
525537

526538
def __init__(
527539
self,
@@ -603,6 +615,9 @@ def _omc_port_get(self) -> str:
603615

604616

605617
class OMCProcessDockerHelper(OMCProcess):
618+
"""
619+
Base class for OMCProcess implementations which run the OMC server in a Docker container.
620+
"""
606621

607622
def __init__(
608623
self,
@@ -695,20 +710,29 @@ def _omc_port_get(self) -> str:
695710
return port
696711

697712
def get_server_address(self) -> Optional[str]:
713+
"""
714+
Get the server address of the OMC server running in a Docker container.
715+
"""
698716
if self._dockerNetwork == "separate" and isinstance(self._dockerCid, str):
699717
output = subprocess.check_output(["docker", "inspect", self._dockerCid]).decode().strip()
700718
return json.loads(output)[0]["NetworkSettings"]["IPAddress"]
701719

702720
return None
703721

704722
def get_docker_container_id(self) -> str:
723+
"""
724+
Get the Docker container ID of the Docker container with the OMC server.
725+
"""
705726
if not isinstance(self._dockerCid, str):
706727
raise OMCSessionException(f"Invalid docker container ID: {self._dockerCid}!")
707728

708729
return self._dockerCid
709730

710731

711732
class OMCProcessDocker(OMCProcessDockerHelper):
733+
"""
734+
OMC process running in a Docker container.
735+
"""
712736

713737
def __init__(
714738
self,
@@ -849,6 +873,9 @@ def _docker_omc_start(self) -> Tuple[subprocess.Popen, DummyPopen, str]:
849873

850874

851875
class OMCProcessDockerContainer(OMCProcessDockerHelper):
876+
"""
877+
OMC process running in a Docker container (by container ID).
878+
"""
852879

853880
def __init__(
854881
self,
@@ -939,6 +966,9 @@ def _docker_omc_start(self) -> Tuple[subprocess.Popen, DummyPopen]:
939966

940967

941968
class OMCProcessWSL(OMCProcess):
969+
"""
970+
OMC process running in Windows Subsystem for Linux (WSL).
971+
"""
942972

943973
def __init__(
944974
self,

0 commit comments

Comments
 (0)