Open germa89 opened 2 years ago
Due to different other priorities, this have to be postponed until further notice.
Temporal solution for this:
from ansys.mapdl.core import launch_mapdl
from ansys.mapdl.core.errors import LicenseServerConnectionError
LICENSES = {
"ansys": "Ansys Mechanical Enterprise",
"meba": "Ansys Mechanical Enterprise Solver",
"mech_2": "Ansys Mechanical Premium",
"mech_1": "Ansys Mechanical Pro",
} # reorder as you wish
for each_license in LICENSES: # you are iterating over the keys
try:
mapdl = launch_mapdl(license_type=each_license)
except LicenseServerConnectionError:
continue # keep looping
else: # There is no error
break # Go out of loop
else: # To be executed at the end of the loop
print("There is no available licenses")
mapdl.prep7()
@akaszynski what do you think about doing this via appdirs, so that it doesn't have to be in the method arguments of launch_mapdl
.
One time setup:
from ansys.mapdl.core import preferences
preferences.set_licenses(["mech_1", "mech_2"])
When starting pymapdl, it checks to see if the licenses preference is set, if not nothing changes. If the preference is set, it does a loop similar to German's suggestion
== From internal email ==
(Copied and pasted as it is)
On our training course this morning they had license issues (Not enough available licences at their site and different licences available) and requested to have a feature like a list of licence priorities they want to check to get a licence from.
I think that this is a good feature request and it would be best if license_type is optional and could be str or a list of str. What do you think?
For two license types it would like this:
==
Approach