Implement subprocess termination

This commit is contained in:
2018-08-06 12:27:30 +02:00
parent 49d0569c6b
commit 969776f4ad
3 changed files with 103 additions and 18 deletions

View File

@@ -41,6 +41,7 @@ def benchmarkBlenderWatched(command):
process = subprocess.Popen(command,
stdout=subprocess.PIPE,
stderr=subprocess.STDOUT)
progress.render_process(process)
# Keep reading status while Blender is alive.
st = stats.Stats()
@@ -67,6 +68,8 @@ def benchmarkBlenderWatched(command):
# Clear line used by progress.
progress.progressClear()
progress.render_process(None)
if process.returncode != 0:
logger.ERROR("Rendering crashed")
return None
@@ -91,6 +94,8 @@ def benchmarkScene(ctx, scene):
"(this might take several minutes).")
warmup_command = command + ['--benchmark-warmup']
benchmarkBlenderWatched(warmup_command)
if progress.is_canceled():
return None
# Remove resutl of warmup round.
if ctx.image_output_dir:
full_image_output = os.path.join(ctx.image_output_dir, scene) + \
@@ -129,6 +134,8 @@ def benchmarkAll(ctx):
for scene in ctx.scenes:
file_stats = benchmarkScene(ctx, scene)
all_stats[scene] = file_stats
if progress.is_canceled():
break
return all_stats