Skip to content

submit_blender_deadline

Submitting render job to Deadline.

BlenderSubmitDeadline

Bases: AbstractSubmitDeadline, AYONPyblishPluginMixin

Source code in client/ayon_deadline/plugins/publish/blender/submit_blender_deadline.py
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
class BlenderSubmitDeadline(abstract_submit_deadline.AbstractSubmitDeadline,
                            AYONPyblishPluginMixin):
    label = "Submit Render to Deadline"
    hosts = ["blender"]
    families = ["render"]  # TODO this should be farm specific as render.farm
    settings_category = "deadline"

    def get_job_info(self, job_info=None):
        instance = self._instance
        job_info.Plugin = instance.data.get("blenderRenderPlugin", "Blender")

        # Deadline requires integers in frame range
        frames = "{start}-{end}x{step}".format(
            start=int(instance.data["frameStartHandle"]),
            end=int(instance.data["frameEndHandle"]),
            step=int(instance.data["byFrameStep"]),
        )
        job_info.Frames = frames

        return job_info

    def get_plugin_info(self):
        # Not all hosts can import this module.
        import bpy

        plugin_info = BlenderPluginInfo(
            SceneFile=self.scene_path,
            Version=bpy.app.version_string,
            SaveFile=True,
        )

        plugin_payload = asdict(plugin_info)

        return plugin_payload

    def process_submission(self, auth=None):
        instance = self._instance

        expected_files = instance.data["expectedFiles"]
        if not expected_files:
            raise RuntimeError("No Render Elements found!")

        first_file = next(iter_expected_files(expected_files))
        output_dir = os.path.dirname(first_file)
        instance.data["outputDir"] = output_dir
        instance.data["toBeRenderedOn"] = "deadline"

        payload = self.assemble_payload()
        auth = self._instance.data["deadline"]["auth"]
        verify = self._instance.data["deadline"]["verify"]
        return self.submit(payload, auth=auth, verify=verify)

    def from_published_scene(self, replace_in_path=True):
        """
        This is needed to set the correct path for the json metadata. Because
        the rendering path is set in the blend file during the collection,
        and the path is adjusted to use the published scene, this ensures that
        the metadata and the rendered files are in the same location.
        """
        return super().from_published_scene(False)

from_published_scene(replace_in_path=True)

This is needed to set the correct path for the json metadata. Because the rendering path is set in the blend file during the collection, and the path is adjusted to use the published scene, this ensures that the metadata and the rendered files are in the same location.

Source code in client/ayon_deadline/plugins/publish/blender/submit_blender_deadline.py
72
73
74
75
76
77
78
79
def from_published_scene(self, replace_in_path=True):
    """
    This is needed to set the correct path for the json metadata. Because
    the rendering path is set in the blend file during the collection,
    and the path is adjusted to use the published scene, this ensures that
    the metadata and the rendered files are in the same location.
    """
    return super().from_published_scene(False)