Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deadline: Use AYON settings #78

Merged
merged 2 commits into from
Feb 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 19 additions & 19 deletions client/ayon_core/modules/deadline/deadline_module.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import sys

from ayon_core.lib import requests_get, Logger
from ayon_core.modules import OpenPypeModule, IPluginPaths
from ayon_core.modules import AYONAddon, IPluginPaths


class DeadlineWebserviceError(Exception):
Expand All @@ -13,28 +13,28 @@ class DeadlineWebserviceError(Exception):
"""


class DeadlineModule(OpenPypeModule, IPluginPaths):
class DeadlineModule(AYONAddon, IPluginPaths):
name = "deadline"

def __init__(self, manager, settings):
self.deadline_urls = {}
super(DeadlineModule, self).__init__(manager, settings)

def initialize(self, modules_settings):
def initialize(self, studio_settings):
# This module is always enabled
deadline_settings = modules_settings[self.name]
self.enabled = deadline_settings["enabled"]
deadline_url = deadline_settings.get("DEADLINE_REST_URL")
if deadline_url:
self.deadline_urls = {"default": deadline_url}
else:
self.deadline_urls = deadline_settings.get("deadline_urls") # noqa: E501
deadline_urls = {}
enabled = self.name in studio_settings
if enabled:
deadline_settings = studio_settings[self.name]
deadline_urls = {
url_item["name"]: url_item["value"]
for url_item in deadline_settings["deadline_urls"]
}

if enabled and not deadline_urls:
enabled = False
self.log.warning((
"Deadline Webservice URLs are not specified. Disabling addon."
))

if not self.deadline_urls:
self.enabled = False
self.log.warning(("default Deadline Webservice URL "
"not specified. Disabling module."))
return
self.enabled = enabled
self.deadline_urls = deadline_urls

def get_plugin_paths(self):
"""Deadline plugin paths."""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,11 @@ def _collect_deadline_url(self, render_instance):
deadline_settings = (
render_instance.context.data
["system_settings"]
["modules"]
["deadline"]
)

default_server = render_instance.context.data["defaultDeadline"]
# QUESTION How and where is this is set? Should be removed?
instance_server = render_instance.data.get("deadlineServers")
if not instance_server:
self.log.debug("Using default server.")
Expand All @@ -64,7 +64,10 @@ def _collect_deadline_url(self, render_instance):
asString=True
)

default_servers = deadline_settings["deadline_urls"]
default_servers = {
url_item["name"]: url_item["value"]
for url_item in deadline_settings["deadline_urls"]
}
project_servers = (
render_instance.context.data
["project_settings"]
Expand Down
18 changes: 1 addition & 17 deletions client/ayon_core/settings/ayon_settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,22 +62,6 @@ def _convert_general(ayon_settings, output, default_settings):
}


def _convert_deadline_system_settings(
ayon_settings, output, addon_versions, default_settings
):
enabled = addon_versions.get("deadline") is not None
deadline_settings = default_settings["modules"]["deadline"]
deadline_settings["enabled"] = enabled
if enabled:
ayon_deadline = ayon_settings["deadline"]
deadline_settings["deadline_urls"] = {
item["name"]: item["value"]
for item in ayon_deadline["deadline_urls"]
}

output["modules"]["deadline"] = deadline_settings


def _convert_royalrender_system_settings(
ayon_settings, output, addon_versions, default_settings
):
Expand All @@ -99,14 +83,14 @@ def _convert_modules_system(
# TODO add all modules
# TODO add 'enabled' values
for func in (
_convert_deadline_system_settings,
_convert_royalrender_system_settings,
):
func(ayon_settings, output, addon_versions, default_settings)

for key in {
"timers_manager",
"clockify",
"deadline",
}:
if addon_versions.get(key):
output[key] = ayon_settings
Expand Down
Loading