added functionality to check for available licenses to damask/environment.py, now using this functionality + a check for the correct version before starting Abaqus6.12.2_compileIfort/run_test.py and Abaqus6.12.2_example/run_test.py
This commit is contained in:
parent
5c1185a5d2
commit
3660b2a245
|
@ -1,6 +1,6 @@
|
||||||
# $Id$
|
# $Id$
|
||||||
|
|
||||||
import os,sys,string,re
|
import os,sys,string,re,subprocess,shlex
|
||||||
|
|
||||||
class Environment():
|
class Environment():
|
||||||
__slots__ = [ \
|
__slots__ = [ \
|
||||||
|
@ -50,3 +50,20 @@ class Environment():
|
||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
def isAvailable(self,software,noNeeded=-1):
|
||||||
|
licensesNeeded = {'abaqus' :5,
|
||||||
|
'standard':5,
|
||||||
|
'explicit':5}
|
||||||
|
if noNeeded == -1: noNeeded = licensesNeeded[software]
|
||||||
|
cmd = """ ssh mulicense2 "/Stat_Flexlm | grep 'Users of %s: ' | cut -d' ' -f7,13" """%software
|
||||||
|
process = subprocess.Popen(shlex.split(cmd),stdout = subprocess.PIPE,stderr = subprocess.PIPE)
|
||||||
|
licenses = map(int, process.stdout.readline().split())
|
||||||
|
try:
|
||||||
|
if licenses[0]-licenses[1] >= noNeeded:
|
||||||
|
return 0
|
||||||
|
else:
|
||||||
|
print licenses[1] + noNeeded - licenses[0], 'missing licenses for %s'%software
|
||||||
|
return licenses[1] + noNeeded - licenses[0]
|
||||||
|
except IndexError:
|
||||||
|
print 'Could not retrieve license information for %s'%software
|
||||||
|
return 127
|
|
@ -36,6 +36,8 @@ class Test():
|
||||||
'''
|
'''
|
||||||
Run all variants and report first failure.
|
Run all variants and report first failure.
|
||||||
'''
|
'''
|
||||||
|
if not self.testPossible():
|
||||||
|
return -1
|
||||||
if len(update) == 0 and self.options.update: print ' This test has no reference to update'
|
if len(update) == 0 and self.options.update: print ' This test has no reference to update'
|
||||||
if len(variants) == 0: variants = xrange(len(self.variants)) # iterate over all variants
|
if len(variants) == 0: variants = xrange(len(self.variants)) # iterate over all variants
|
||||||
self.clean()
|
self.clean()
|
||||||
|
@ -48,11 +50,17 @@ class Test():
|
||||||
if variant in update:
|
if variant in update:
|
||||||
self.update(variant)
|
self.update(variant)
|
||||||
elif not self.compare(variant):
|
elif not self.compare(variant):
|
||||||
return variant
|
return variant+1
|
||||||
except Exception,e :
|
except Exception,e :
|
||||||
print '\nWARNING:\n %s\n'%e
|
print '\nWARNING:\n %s\n'%e
|
||||||
return variant
|
return variant+1
|
||||||
return -1
|
return 0
|
||||||
|
|
||||||
|
def testPossible(self):
|
||||||
|
'''
|
||||||
|
Check if test is possible or not (e.g. no license available).
|
||||||
|
'''
|
||||||
|
return True
|
||||||
|
|
||||||
def clean(self):
|
def clean(self):
|
||||||
'''
|
'''
|
||||||
|
@ -337,12 +345,15 @@ class Test():
|
||||||
|
|
||||||
def report_Success(self,culprit):
|
def report_Success(self,culprit):
|
||||||
|
|
||||||
if culprit < 0:
|
if culprit == 0:
|
||||||
print '%s passed.'%({False: 'The test',
|
print '%s passed.'%({False: 'The test',
|
||||||
True: 'All %i tests'%(len(self.variants))}[len(self.variants) > 1])
|
True: 'All %i tests'%(len(self.variants))}[len(self.variants) > 1])
|
||||||
print '\n!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n'
|
print '\n!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n'
|
||||||
return 0
|
return 0
|
||||||
|
if culprit == -1:
|
||||||
|
print 'Warning: Could not start test'
|
||||||
|
return 0
|
||||||
else:
|
else:
|
||||||
print ' ********\n * Test %i failed...\n ********'%(culprit+1)
|
print ' ********\n * Test %i failed...\n ********'%(culprit)
|
||||||
print '\n!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n'
|
print '\n!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n'
|
||||||
return culprit+1
|
return culprit
|
||||||
|
|
Loading…
Reference in New Issue