Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FEAT: Check pre/post license during AEDT launch #5730

Merged
merged 5 commits into from
Feb 4, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions src/ansys/aedt/core/desktop.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@
from ansys.aedt.core.generic.desktop_sessions import _desktop_sessions
from ansys.aedt.core.generic.desktop_sessions import _edb_sessions
from ansys.aedt.core.generic.general_methods import active_sessions
from ansys.aedt.core.generic.general_methods import available_license_feature
from ansys.aedt.core.generic.general_methods import com_active_sessions
from ansys.aedt.core.generic.general_methods import get_string_version
from ansys.aedt.core.generic.general_methods import grpc_active_sessions
Expand Down Expand Up @@ -110,6 +111,14 @@
_aedt_process_thread = threading.Thread(target=launch_desktop_on_port)
_aedt_process_thread.daemon = True
_aedt_process_thread.start()

if not student_version:
available_licenses = available_license_feature()
if available_licenses > 0:
settings.logger.info("Electronics Desktop license available.")

Check warning on line 118 in src/ansys/aedt/core/desktop.py

View check run for this annotation

Codecov / codecov/patch

src/ansys/aedt/core/desktop.py#L118

Added line #L118 was not covered by tests
elif available_licenses == 0: # pragma: no cover
settings.logger.warning("Electronics Desktop license not found on the default license server.")

timeout = settings.desktop_launch_timeout
k = 0
while not _is_port_occupied(port):
Expand Down
7 changes: 7 additions & 0 deletions src/ansys/aedt/core/generic/general_methods.py
Original file line number Diff line number Diff line change
Expand Up @@ -968,6 +968,13 @@ def available_license_feature(
"""
import subprocess # nosec B404

if os.getenv("ANSYSLMD_LICENSE_FILE", None):
name_env = os.getenv("ANSYSLMD_LICENSE_FILE")
name_env = name_env.split(",")[0].split("@")
if len(name_env) == 2:
port = name_env[0]
name = name_env[1]

if not input_dir:
input_dir = list(aedt_versions.installed_versions.values())[0]

Expand Down