diff --git a/client/ayon_deadline/lib.py b/client/ayon_deadline/lib.py index 2a5d99c433..6d580850b0 100644 --- a/client/ayon_deadline/lib.py +++ b/client/ayon_deadline/lib.py @@ -1,5 +1,4 @@ import os -import sys import json from dataclasses import dataclass, field, asdict from functools import partial @@ -173,11 +172,7 @@ def _get_deadline_info( except requests.exceptions.ConnectionError as exc: msg = 'Cannot connect to DL web service {}'.format(endpoint) log.error(msg) - raise( - DeadlineWebserviceError, - DeadlineWebserviceError('{} - {}'.format(msg, exc)), - sys.exc_info()[2] - ) + raise DeadlineWebserviceError(msg) from exc if not response.ok: log.warning(f"No {item_type} retrieved") return [] diff --git a/client/ayon_deadline/plugins/publish/global/collect_jobinfo.py b/client/ayon_deadline/plugins/publish/global/collect_jobinfo.py index bf66cfcaa5..4b997c5de9 100644 --- a/client/ayon_deadline/plugins/publish/global/collect_jobinfo.py +++ b/client/ayon_deadline/plugins/publish/global/collect_jobinfo.py @@ -16,6 +16,7 @@ from ayon_deadline.lib import ( FARM_FAMILIES, AYONDeadlineJobInfo, + DeadlineWebserviceError, ) @@ -116,36 +117,50 @@ def apply_settings(cls, project_settings): addons_manager = AddonsManager(project_settings) deadline_addon = addons_manager["deadline"] deadline_server_name = settings["deadline_server"] - pools = deadline_addon.get_pools_by_server_name(deadline_server_name) - cls.pool_enum_values = [ - {"value": pool, "label": pool} - for pool in pools - ] - - groups = deadline_addon.get_groups_by_server_name(deadline_server_name) - cls.group_enum_values = [ - {"value": group, "label": group} - for group in groups - ] - - limit_groups = deadline_addon.get_limit_groups_by_server_name( - deadline_server_name - ) - limit_group_items = [ - {"value": limit_group, "label": limit_group} - for limit_group in limit_groups - ] - if not limit_group_items: - limit_group_items.append({"value": None, "label": "< none >"}) - cls.limit_group_enum_values = limit_group_items - - machines = deadline_addon.get_machines_by_server_name( - deadline_server_name - ) - cls.machines_enum_values = [ - {"value": machine, "label": machine} - for machine in machines - ] + pools = [] + groups = [] + limit_groups = [] + machines = [] + try: + pools = [ + {"value": pool, "label": pool} + for pool in deadline_addon.get_pools_by_server_name( + deadline_server_name + ) + ] + groups = [ + {"value": group, "label": group} + for group in deadline_addon.get_groups_by_server_name( + deadline_server_name + ) + ] + limit_groups = [ + {"value": limit_group, "label": limit_group} + for limit_group in ( + deadline_addon.get_limit_groups_by_server_name( + deadline_server_name + ) + ) + ] + machines = [ + {"value": machine, "label": machine} + for machine in deadline_addon.get_machines_by_server_name( + deadline_server_name + ) + ] + except DeadlineWebserviceError: + cls.log.warning(f"Unable to connect to {deadline_server_name}") + + for items in [ + pools, groups, limit_groups, machines + ]: + if not items: + items.append({"value": None, "label": "< none >"}) + + cls.pool_enum_values = pools + cls.group_enum_values = groups + cls.limit_group_enum_values = limit_groups + cls.machines_enum_values = machines @classmethod def get_attr_defs_for_instance(cls, create_context, instance):