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$
|
||||
|
||||
import os,sys,string,re
|
||||
import os,sys,string,re,subprocess,shlex
|
||||
|
||||
class Environment():
|
||||
__slots__ = [ \
|
||||
|
@ -50,3 +50,20 @@ class Environment():
|
|||
except:
|
||||
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.
|
||||
'''
|
||||
if not self.testPossible():
|
||||
return -1
|
||||
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
|
||||
self.clean()
|
||||
|
@ -48,11 +50,17 @@ class Test():
|
|||
if variant in update:
|
||||
self.update(variant)
|
||||
elif not self.compare(variant):
|
||||
return variant
|
||||
return variant+1
|
||||
except Exception,e :
|
||||
print '\nWARNING:\n %s\n'%e
|
||||
return variant
|
||||
return -1
|
||||
return variant+1
|
||||
return 0
|
||||
|
||||
def testPossible(self):
|
||||
'''
|
||||
Check if test is possible or not (e.g. no license available).
|
||||
'''
|
||||
return True
|
||||
|
||||
def clean(self):
|
||||
'''
|
||||
|
@ -337,12 +345,15 @@ class Test():
|
|||
|
||||
def report_Success(self,culprit):
|
||||
|
||||
if culprit < 0:
|
||||
if culprit == 0:
|
||||
print '%s passed.'%({False: 'The test',
|
||||
True: 'All %i tests'%(len(self.variants))}[len(self.variants) > 1])
|
||||
print '\n!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n'
|
||||
return 0
|
||||
if culprit == -1:
|
||||
print 'Warning: Could not start test'
|
||||
return 0
|
||||
else:
|
||||
print ' ********\n * Test %i failed...\n ********'%(culprit+1)
|
||||
print ' ********\n * Test %i failed...\n ********'%(culprit)
|
||||
print '\n!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n'
|
||||
return culprit+1
|
||||
return culprit
|
||||
|
|
Loading…
Reference in New Issue