Skip to content

validate_deadline_connection

ValidateDeadlineConnection

Bases: InstancePlugin

Validate Deadline Web Service is running

Source code in client/ayon_deadline/plugins/publish/global/validate_deadline_connection.py
 9
10
11
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
class ValidateDeadlineConnection(pyblish.api.InstancePlugin):
    """Validate Deadline Web Service is running"""

    label = "Validate Deadline Web Service"
    order = pyblish.api.ValidatorOrder
    families = FARM_FAMILIES
    targets = ["local"]

    # cache
    responses = {}

    def process(self, instance):
        if not instance.data.get("farm"):
            self.log.debug("Should not be processed on farm, skipping.")
            return

        deadline_url = instance.data["deadline"]["url"]
        assert deadline_url, "Requires Deadline Webservice URL"

        kwargs = {
            "verify": instance.data["deadline"]["verify"]
        }

        if instance.data["deadline"]["require_authentication"]:
            auth = instance.data["deadline"]["auth"]
            kwargs["auth"] = auth

            if not auth[0]:
                raise PublishXmlValidationError(
                    self,
                    "Deadline requires authentication. "
                    "At least username is required to be set in "
                    "Site Settings.")

        if deadline_url not in self.responses:
            self.responses[deadline_url] = requests_get(deadline_url, **kwargs)

        response = self.responses[deadline_url]
        if response.status_code == 401:
            raise PublishXmlValidationError(
                self,
                "Deadline requires authentication. "
                "Provided credentials are not working. "
                "Please change them in Site Settings")
        assert response.ok, "Response must be ok"
        assert response.text.startswith("Deadline Web Service "), (
            "Web service did not respond with 'Deadline Web Service'"
        )