to specific for MPIE
This commit is contained in:
parent
1e2766cda6
commit
835831b610
|
@ -26,24 +26,3 @@ class Environment():
|
||||||
if len(items) == 2:
|
if len(items) == 2:
|
||||||
self.options[items[0].upper()] = \
|
self.options[items[0].upper()] = \
|
||||||
re.sub('\$\{*DAMASK_ROOT\}*',self.rootDir(),os.path.expandvars(items[1])) # expand all shell variables and DAMASK_ROOT
|
re.sub('\$\{*DAMASK_ROOT\}*',self.rootDir(),os.path.expandvars(items[1])) # expand all shell variables and DAMASK_ROOT
|
||||||
|
|
||||||
def isAvailable(self,software,Nneeded =-1):
|
|
||||||
licensesNeeded = {'abaqus' :5,
|
|
||||||
'standard':5
|
|
||||||
}
|
|
||||||
if Nneeded == -1: Nneeded = licensesNeeded[software]
|
|
||||||
try:
|
|
||||||
cmd = """ ssh mulicense2 "/lm-status | grep 'Users of %s: ' | cut -d' ' -f7,13" """%software
|
|
||||||
process = subprocess.Popen(shlex.split(cmd),stdout = subprocess.PIPE,stderr = subprocess.PIPE)
|
|
||||||
licenses = list(map(int, process.stdout.readline().split()))
|
|
||||||
try:
|
|
||||||
if licenses[0]-licenses[1] >= Nneeded:
|
|
||||||
return 0
|
|
||||||
else:
|
|
||||||
print('%s missing licenses for %s'%(licenses[1] + Nneeded - licenses[0],software))
|
|
||||||
return licenses[1] + Nneeded - licenses[0]
|
|
||||||
except IndexError:
|
|
||||||
print('Could not retrieve license information for %s'%software)
|
|
||||||
return 127
|
|
||||||
except:
|
|
||||||
return 126
|
|
||||||
|
|
Loading…
Reference in New Issue