Skip to content

Commit

Permalink
added waitforlicense options to settings (#3732)
Browse files Browse the repository at this point in the history
Co-authored-by: maxcapodi78 <Shark78>
  • Loading branch information
maxcapodi78 authored Oct 10, 2023
1 parent e31f7eb commit dcc57a0
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
4 changes: 4 additions & 0 deletions pyaedt/desktop.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
16 changes: 16 additions & 0 deletions pyaedt/generic/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down

0 comments on commit dcc57a0

Please sign in to comment.