예제 #1
0
    def test_blender_docker_env(self):
        env = BlenderEnvironment()
        self.assertTrue(
            all(isinstance(img, DockerImage) for img in env.docker_images))

        image_available = any(img.is_available() for img in env.docker_images)
        self.assertEqual(image_available, env.check_support().is_ok())
예제 #2
0
 def test_get_performance(self):
     """Changing estimated performance in ClientConfigDescriptor."""
     env = BlenderEnvironment()
     fake_performance = 2345.2
     cfg_desc = ClientConfigDescriptor()
     cfg_desc.estimated_blender_performance = fake_performance
     result = env.get_performance(cfg_desc)
     self.assertEquals(result, fake_performance)
예제 #3
0
    def __init__(self):
        RendererDefaults.__init__(self)
        self.output_format = "EXR"

        self.main_program_file = BlenderEnvironment().main_program_file
        self.min_subtasks = 1
        self.max_subtasks = 100
        self.default_subtasks = 6
예제 #4
0
    def test_get_min_accepted_performance(self):
        # given
        p = Performance(environment_id=BlenderEnvironment.get_id(),
                        min_accepted_step=100)
        p.save()
        MinPerformanceMultiplier.set(3.141)

        # then
        self.assertEqual(MinPerformanceMultiplier.get(), 3.141)
        self.assertEqual(self.env.get_min_accepted_performance(), 314.1)
예제 #5
0
class BlenderEnvTest(DatabaseFixture, PEP8MixIn):
    PEP8_FILES = ["apps/blender/blenderenvironment.py"]

    def setUp(self):
        super().setUp()
        self.env = BlenderEnvironment()

    def test_blender(self):
        """Basic environment test."""
        self.assertTrue(self.env.check_support())

    def test_get_performance(self):
        """Changing estimated performance in ClientConfigDescriptor."""
        assert self.env.get_performance() == 0.0

        # given
        fake_performance = 2345.2
        p = Performance(environment_id=BlenderEnvironment.get_id(),
                        value=fake_performance)
        p.save()

        # then
        self.assertEqual(self.env.get_performance(), fake_performance)

    def test_get_min_accepted_performance_default(self):
        self.assertEqual(MinPerformanceMultiplier.get(), 0.0)
        self.assertEqual(self.env.get_min_accepted_performance(), 0.0)

    def test_get_min_accepted_performance(self):
        # given
        p = Performance(environment_id=BlenderEnvironment.get_id(),
                        min_accepted_step=100)
        p.save()
        MinPerformanceMultiplier.set(3.141)

        # then
        self.assertEqual(MinPerformanceMultiplier.get(), 3.141)
        self.assertEqual(self.env.get_min_accepted_performance(), 314.1)

    def test_main_program_file(self):
        assert path.isfile(BlenderEnvironment().main_program_file)
예제 #6
0
    def test_get_performance(self):
        """Changing estimated performance in ClientConfigDescriptor."""
        assert self.env.get_performance() == 0.0

        # given
        fake_performance = 2345.2
        p = Performance(environment_id=BlenderEnvironment.get_id(),
                        value=fake_performance)
        p.save()

        # then
        self.assertEqual(self.env.get_performance(), fake_performance)
예제 #7
0
    def run_benchmark(self, env_id):
        # TODO: move benchmarks to environments
        from apps.blender.blenderenvironment import BlenderEnvironment
        from apps.lux.luxenvironment import LuxRenderEnvironment

        deferred = Deferred()

        if env_id == BlenderEnvironment.get_id():
            self.task_server.task_computer.run_blender_benchmark(
                deferred.callback, deferred.errback)
        elif env_id == LuxRenderEnvironment.get_id():
            self.task_server.task_computer.run_lux_benchmark(
                deferred.callback, deferred.errback)
        else:
            raise Exception("Unknown environment: {}".format(env_id))

        result = yield deferred
        returnValue(result)
예제 #8
0
    def test_run_benchmark(self, *_):
        from apps.blender.blenderenvironment import BlenderEnvironment
        from apps.blender.benchmark.benchmark import BlenderBenchmark

        benchmark_manager = self.client.task_server.benchmark_manager
        benchmark_manager.run_benchmark = Mock()
        benchmark_manager.run_benchmark.side_effect = lambda b, tb, e, c, ec: \
            c(True)

        with self.assertRaisesRegex(Exception, "Unknown environment"):
            sync_wait(self.client.run_benchmark(str(uuid.uuid4())))

        sync_wait(self.client.run_benchmark(BlenderEnvironment.get_id()))

        assert benchmark_manager.run_benchmark.call_count == 1
        assert isinstance(benchmark_manager.run_benchmark.call_args[0][0],
                          BlenderBenchmark)

        assert benchmark_manager.run_benchmark.call_count == 1
예제 #9
0
    def __init__(self):

        Benchmark.__init__(self)

        self.normalization_constant = 9360

        self.blender_task_path = os.path.join(
            os.path.dirname(os.path.abspath(__file__)), "test_task")

        self.task_definition.output_file = os.path.join(
            tempfile.gettempdir(), "blender_benchmark.png")
        self.task_definition.task_type = "Blender"
        self.task_definition.output_format = "png"
        self.task_definition.options = BlenderRendererOptions()
        self.task_definition.options.frames = [1]
        self.task_definition.task_id = u"{}".format("blender_benchmark")
        self.task_definition.main_scene_file = os.path.join(
            self.blender_task_path, "scene-Helicopter-27-cycles.blend")
        self.task_definition.main_program_file = BlenderEnvironment(
        ).main_program_file

        self.task_definition.resources.add(
            os.path.normpath(self.task_definition.main_scene_file))
예제 #10
0
    def test_run_benchmark(self, *_):
        from apps.blender.blenderenvironment import BlenderEnvironment
        from apps.lux.luxenvironment import LuxRenderEnvironment

        task_computer = self.client.task_server.task_computer
        task_computer.run_blender_benchmark.side_effect = lambda c, e: c(True)
        task_computer.run_lux_benchmark.side_effect = lambda c, e: c(True)

        with self.assertRaises(Exception):
            sync_wait(self.client.run_benchmark(str(uuid.uuid4())))

        sync_wait(self.client.run_benchmark(BlenderEnvironment.get_id()))

        assert task_computer.run_blender_benchmark.called
        assert not task_computer.run_lux_benchmark.called

        task_computer.run_blender_benchmark.called = False
        task_computer.run_lux_benchmark.called = False

        sync_wait(self.client.run_benchmark(LuxRenderEnvironment.get_id()))

        assert not task_computer.run_blender_benchmark.called
        assert task_computer.run_lux_benchmark.called
예제 #11
0
 def test_main_program_file(self):
     assert path.isfile(BlenderEnvironment().main_program_file)
예제 #12
0
파일: base.py 프로젝트: U0001F3A2/golem
 def setUp(self):
     super(SubtaskResultsVerifyBaseTest, self).setUp()
     self.env = BlenderEnvironment()
     self.main_program_file = self.env.main_program_file
예제 #13
0
 def _get_better_task_def(self):
     ctd = ComputeTaskDef()
     ctd['docker_images'] = [
         di.to_dict() for di in BlenderEnvironment().docker_images
     ]
     return ctd
예제 #14
0
 def setUp(self):
     super(SubtaskResultsVerifyBaseTest, self).setUp()
     self.env = BlenderEnvironment()
예제 #15
0
 def setUp(self):
     super().setUp()
     self.env = BlenderEnvironment()
예제 #16
0
 def __init__(self):
     super(BlenderRendererOptions, self).__init__()
     self.environment = BlenderEnvironment()
     self.compositing = False
예제 #17
0
 def test_blender(self):
     """Basic environment test."""
     env = BlenderEnvironment()
     self.assertTrue(env.supported())
     self.assertTrue(env.check_software())
예제 #18
0
 def _get_better_task_def(self):
     ctd = ComputeTaskDef()
     ctd.docker_images = BlenderEnvironment().docker_images
     return ctd