Save ouytput images to a temp director which will be erased

Also removed hardcoded temp path in benchmark itself.
This commit is contained in:
2018-08-06 16:58:07 +02:00
parent 8cebc726ca
commit 93c7f172ad
2 changed files with 10 additions and 1 deletions

View File

@@ -1,4 +1,5 @@
import os
import tempfile
import time
import subprocess
@@ -86,8 +87,10 @@ def benchmarkScene(ctx, scene):
logger.DEBUG("File to use: {}" . format(blendfile))
# Get command for rendering.
# TODO(sergey): Create some temp folder.
tmpdir = tempfile.TemporaryDirectory(prefix="benchmark_")
cfra = util.queryCurrentFrame(blendfile)
command = constructBenchmarkCommand(ctx, scene, blendfile, "/tmp/", cfra)
command = constructBenchmarkCommand(
ctx, scene, blendfile, tmpdir.name, cfra)
logger.DEBUG("Command for rendering: {}" . format(command))
progress.step('WARM_UP')
logger.INFO("> Warm-up round, making sure everything is ready " +

View File

@@ -3,6 +3,7 @@ import json
import os
import platform
import sys
import tempfile
from threading import Thread, Lock
import blf
import bpy
@@ -533,6 +534,7 @@ class BENCHMARK_OT_run(bpy.types.Operator):
timer = None
progress_provider = None
logger_provider = None
tmpdir = None
def setup_sink(self):
self.progress_provider = ProgressProviderSink()
@@ -607,6 +609,7 @@ class BENCHMARK_OT_run(bpy.types.Operator):
global_progress_status = None
current_progress = 0.0
context.area.tag_redraw()
self.tmpdir = None
def modal(self, context, event):
if event.type == 'TIMER':
@@ -632,6 +635,8 @@ class BENCHMARK_OT_run(bpy.types.Operator):
compute_device = context.scene.compute_device
device_type, device_name = compute_device.split(":")
self.tmpdir = tempfile.TemporaryDirectory(prefix="blender_benchmark_")
# Before doing anything, make sure we have all sinks set up, so we do
# not miss any progress report.
self.setup_sink()
@@ -649,6 +654,7 @@ class BENCHMARK_OT_run(bpy.types.Operator):
ctx.device_type = device_type
ctx.device_name = device_name
ctx.single_compute_scene = True
ctx.image_output_dir = self.tmpdir.name
# Set this to True when having multiple GPUs of same name and only
# one of the mis to be enabled. Or when requesting GPU render without
# specifying GPU name.