@@ -98,6 +98,10 @@ def __init__(self):
9898 max_cpus = multiprocessing .cpu_count () # Python 2.7 fallback
9999 max_licenses = self .getLicenseCount ()
100100 max_envs = self .getEnvCount ()
101+
102+ print (f"Max CPUs : { max_cpus } " )
103+ print (f"Max licenses: { max_licenses } " )
104+ print (f"Max Envs : { max_envs } \n " )
101105
102106 self .max_concurrent = min (x for x in [max_cpus ,max_licenses , max_envs ] if x > 0 )
103107
@@ -123,7 +127,7 @@ def getEnvCount(self):
123127 max_envs = len (self .api .Environment .all ())
124128 return max_envs
125129
126- def getLicenseCount (self ):
130+ def getLicenseCount (self , network = "" ):
127131
128132 if os .environ .get ("VECTOR_LICENSE_FILE" ) is not None :
129133 if sys .platform .startswith ('win32' ):
@@ -157,9 +161,9 @@ def getLicenseCount(self):
157161 import re
158162
159163 if os .path .exists (r'C:\Program Files\Vector License Client\Vector.LicenseClient.exe' ):
160- cmd = r'"C:\Program Files\Vector License Client\Vector.LicenseClient.exe" -listlicenses'
164+ cmd = r'"C:\Program Files\Vector License Client\Vector.LicenseClient.exe" -listlicenses ' + network
161165 elif os .path .exists (r'C:\Program Files (x86)\Vector License Client\Vector.LicenseClient.exe' ):
162- cmd = r'"C:\Program Files (x86)\Vector License Client\Vector.LicenseClient.exe" -listlicenses'
166+ cmd = r'"C:\Program Files (x86)\Vector License Client\Vector.LicenseClient.exe" -listlicenses ' + network
163167 else :
164168 print ("Cannot find the Vector License Client - setting license count to 1" )
165169 return 1
@@ -182,19 +186,21 @@ def getLicenseCount(self):
182186 try :
183187 root = ET .fromstring (xml_data )
184188 except Eception as e :
185- print (f"Error with { xml_data } " )
186- import traceback
187189 print ("Exception in root = ET.fromstring(xml_data):" , traceback .format_exc ())
188190 return 1
189191
190192 now = datetime .now ()
191193 if os .environ .get ("VCAST_USE_CI_LICENSES" ) is not None or os .environ .get ("VCAST_USING_HEADLESS_MODE" ) is not None :
192- searchType = ["Server Edition" , "SE" ]
194+ searchType = ["Server Edition" , "SE" , "Server" ]
193195 else :
194- searchType = ["Desktop Edition" , "DE" ]
196+ searchType = ["Desktop Edition" , "DE" , "Desktop" ]
195197
196198 free_list = []
197-
199+
200+ if root .findall ('.//VectorLicense' ) == []:
201+ print ("No Vector Licenses found locally, checking for network licenses" )
202+ return self .getLicenseCount ("-network" )
203+
198204 # Loop through all VectorLicense nodes
199205 for lic in root .findall ('.//VectorLicense' ):
200206 product_text = lic .find ('ProductText' )
@@ -214,7 +220,7 @@ def getLicenseCount(self):
214220 free_list .append (free )
215221
216222
217- licMin = min (free_list ) if free_list else None
223+ licMin = min (free_list ) if free_list else 1
218224 return int (licMin )
219225
220226 return 1
0 commit comments