Deadline: correct webservice couldn't be selected in Ayon (#6007)

* Refactor necessary for Ayon changes in Setting model

* Removed unnecessary configuration

MongoDB is not a thing in Ayon.

* Changed DL model to use dynamic enum

Enum values are set in Studio Settings, in Project settings will be selected from.
Used this way to be close to OP variant and support both until OP is deprecated.

* Hound

* Refactor with use of AYON_SERVER_ENABLED

This will make it simpler to remove obsolete code in the future.

---------

Co-authored-by: Libor Batek <112623825+LiborBatek@users.noreply.github.com>
This commit is contained in:
Petr Kalis 2023-12-06 16:40:24 +01:00 committed by GitHub
parent 0ed8a66fb8
commit f9509f3613
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 43 additions and 35 deletions

View file

@ -14,15 +14,35 @@ class ServerListSubmodel(BaseSettingsModel):
value: str = Field(title="Value")
async def defined_deadline_ws_name_enum_resolver(
addon: "BaseServerAddon",
settings_variant: str = "production",
project_name: str | None = None,
) -> list[str]:
"""Provides list of names of configured Deadline webservice urls."""
if addon is None:
return []
settings = await addon.get_studio_settings(variant=settings_variant)
ws_urls = []
for deadline_url_item in settings.deadline_urls:
ws_urls.append(deadline_url_item.name)
return ws_urls
class DeadlineSettings(BaseSettingsModel):
deadline_urls: list[ServerListSubmodel] = Field(
default_factory=list,
title="System Deadline Webservice URLs",
scope=["studio"],
)
deadline_servers: list[str] = Field(
title="Project deadline servers",
deadline_server: str = Field(
title="Project deadline server",
section="---",
scope=["project"],
enum_resolver=defined_deadline_ws_name_enum_resolver
)
publish: PublishPluginsModel = Field(
default_factory=PublishPluginsModel,
@ -42,7 +62,6 @@ DEFAULT_VALUES = {
"value": "http://127.0.0.1:8082"
}
],
# TODO: this needs to be dynamic from "deadline_urls"
"deadline_servers": [],
"deadline_server": "default",
"publish": DEFAULT_DEADLINE_PLUGINS_SETTINGS
}