From dcc57a06f1e67274b78da5f54140b49a3dbd646d Mon Sep 17 00:00:00 2001 From: Massimo Capodiferro <77293250+maxcapodi78@users.noreply.github.com> Date: Tue, 10 Oct 2023 15:39:43 +0200 Subject: [PATCH] added waitforlicense options to settings (#3732) Co-authored-by: maxcapodi78 --- pyaedt/desktop.py | 4 ++++ pyaedt/generic/settings.py | 16 ++++++++++++++++ 2 files changed, 20 insertions(+) diff --git a/pyaedt/desktop.py b/pyaedt/desktop.py index b33bd4f293a..93b9bd14c82 100644 --- a/pyaedt/desktop.py +++ b/pyaedt/desktop.py @@ -66,6 +66,8 @@ def launch_desktop_on_port(): command = [full_path, "-grpcsrv", str(port)] if non_graphical: command.append("-ng") + if settings.wait_for_license: + command.append("-waitforlicense") my_env = os.environ.copy() for env, val in settings.aedt_environment_variables.items(): my_env[env] = val @@ -131,6 +133,8 @@ def launch_aedt_in_lsf(non_graphical, port): # pragma: no cover ] if non_graphical: command.append("-ng") + if settings.wait_for_license: + command.append("-waitforlicense") print(command) p = subprocess.Popen(command, stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL) timeout = settings.lsf_timeout diff --git a/pyaedt/generic/settings.py b/pyaedt/generic/settings.py index f970d20601d..4cf34adcb04 100644 --- a/pyaedt/generic/settings.py +++ b/pyaedt/generic/settings.py @@ -65,6 +65,22 @@ def __init__(self): self._desktop_launch_timeout = 90 self._number_of_grpc_api_retries = 6 self._retry_n_times_time_interval = 0.1 + self._wait_for_license = False + + @property + def wait_for_license(self): + """Whether if Electronics Desktop has to be launched with ``-waitforlicense`` flag enabled or not. + Default is ``False``. + + Returns + ------- + bool + """ + return self._wait_for_license + + @wait_for_license.setter + def wait_for_license(self, value): + self._wait_for_license = value @property def retry_n_times_time_interval(self):