logfile does not contain much valuable information
Marc automatically creates .out
This commit is contained in:
parent
97d426718a
commit
1133090b6c
2
PRIVATE
2
PRIVATE
|
@ -1 +1 @@
|
||||||
Subproject commit 1298124143e7e2901d0b9c2e79ab6388cb78a1e3
|
Subproject commit 1490f97417664d6ae11d7ceafb6b98c9cc2dade1
|
|
@ -41,13 +41,9 @@ class Marc:
|
||||||
return path_tools
|
return path_tools
|
||||||
|
|
||||||
|
|
||||||
def submit_job(self,
|
def submit_job(self, model, job,
|
||||||
model,
|
|
||||||
job = 'job1',
|
|
||||||
logfile = False,
|
|
||||||
compile = False,
|
compile = False,
|
||||||
optimization = '',
|
optimization = ''):
|
||||||
):
|
|
||||||
|
|
||||||
usersub = Path(os.environ['DAMASK_ROOT'])/'src/DAMASK_Marc'
|
usersub = Path(os.environ['DAMASK_ROOT'])/'src/DAMASK_Marc'
|
||||||
usersub = usersub.parent/(usersub.name + ('.f90' if compile else '.marc'))
|
usersub = usersub.parent/(usersub.name + ('.f90' if compile else '.marc'))
|
||||||
|
@ -64,22 +60,15 @@ class Marc:
|
||||||
' -prog ' + str(usersub.with_suffix(''))
|
' -prog ' + str(usersub.with_suffix(''))
|
||||||
print(cmd)
|
print(cmd)
|
||||||
|
|
||||||
if logfile is not None:
|
ret = subprocess.run(shlex.split(cmd),capture_output=True)
|
||||||
try:
|
|
||||||
f = open(logfile,'w+',newline='\n')
|
|
||||||
except TypeError:
|
|
||||||
f = logfile
|
|
||||||
else:
|
|
||||||
f = io.StringIO()
|
|
||||||
|
|
||||||
proc = subprocess.Popen(shlex.split(cmd),stdout=f,stderr=subprocess.STDOUT)
|
|
||||||
proc.wait()
|
|
||||||
f.seek(0)
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
v = int(re.search('Exit number ([0-9]+)',''.join(f.readlines())).group(1))
|
if 3004 != int(re.search('Exit number ([0-9]+)',ret.stderr.decode()).group(1)):
|
||||||
|
print(ret.stderr.decode())
|
||||||
|
print(ret.stdout.decode())
|
||||||
|
raise RuntimeError(f'Marc simulation failed ({v})')
|
||||||
except (AttributeError,ValueError):
|
except (AttributeError,ValueError):
|
||||||
|
print(ret.stderr.decode())
|
||||||
|
print(ret.stdout.decode())
|
||||||
raise RuntimeError('Marc simulation failed (unknown return value)')
|
raise RuntimeError('Marc simulation failed (unknown return value)')
|
||||||
|
|
||||||
if v != 3004:
|
|
||||||
raise RuntimeError(f'Marc simulation failed ({v})')
|
|
||||||
|
|
Loading…
Reference in New Issue