logfile does not contain much valuable information

Marc automatically creates .out
This commit is contained in:
Martin Diehl 2021-04-10 22:47:00 +02:00
parent 97d426718a
commit 1133090b6c
2 changed files with 10 additions and 21 deletions

@ -1 +1 @@
Subproject commit 1298124143e7e2901d0b9c2e79ab6388cb78a1e3
Subproject commit 1490f97417664d6ae11d7ceafb6b98c9cc2dade1

View File

@ -41,13 +41,9 @@ class Marc:
return path_tools
def submit_job(self,
model,
job = 'job1',
logfile = False,
def submit_job(self, model, job,
compile = False,
optimization = '',
):
optimization = ''):
usersub = Path(os.environ['DAMASK_ROOT'])/'src/DAMASK_Marc'
usersub = usersub.parent/(usersub.name + ('.f90' if compile else '.marc'))
@ -64,22 +60,15 @@ class Marc:
' -prog ' + str(usersub.with_suffix(''))
print(cmd)
if logfile is not None:
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)
ret = subprocess.run(shlex.split(cmd),capture_output=True)
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):
print(ret.stderr.decode())
print(ret.stdout.decode())
raise RuntimeError('Marc simulation failed (unknown return value)')
if v != 3004:
raise RuntimeError(f'Marc simulation failed ({v})')