Skip to content

validate_deadline_jobinfo

ValidateDeadlineJobInfo

Bases: OptionalPyblishPluginMixin, InstancePlugin

Validate collected values for JobInfo section in Deadline submission

Source code in client/ayon_deadline/plugins/publish/global/validate_deadline_jobinfo.py
12
13
14
15
16
17
18
19
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
class ValidateDeadlineJobInfo(
    OptionalPyblishPluginMixin,
    pyblish.api.InstancePlugin
):
    """Validate collected values for JobInfo section in Deadline submission

    """

    label = "Validate Deadline JobInfo"
    order = pyblish.api.ValidatorOrder
    families = FARM_FAMILIES
    optional = True
    targets = ["local"]

    # cache
    pools_by_url = {}

    def process(self, instance):
        if not self.is_active(instance.data):
            return

        if not instance.data.get("farm"):
            self.log.debug("Skipping local instance.")
            return

        priority = instance.data["deadline"]["job_info"].Priority
        if priority < 0 or priority > 100:
            raise PublishValidationError(
                f"Priority:'{priority}' must be between 0-100")

        custom_frames = instance.data["deadline"]["job_info"].Frames
        if not custom_frames:
            return

        frame_start = (
            instance.data.get("frameStart")
            or instance.context.data.get("frameStart")
        )
        frame_end = (
            instance.data.get("frameEnd")
            or instance.context.data.get("frameEnd")
        )
        if not frame_start or not frame_end:
            self.log.info("Unable to get frame range, skip validation.")
            return

        frames_to_render = convert_frames_str_to_list(custom_frames)

        if (
            min(frames_to_render) < frame_start
            or max(frames_to_render) > frame_end
        ):
            raise PublishValidationError(
                f"Custom frames '{custom_frames}' are outside of "
                f"expected frame range '{frame_start}'-'{frame_end}'"
            )