ynput / ayon-core

Apache License 2.0
18 stars 30 forks source link

Publisher: Separate backend into models #689

Closed iLLiCiTiT closed 5 days ago

iLLiCiTiT commented 1 week ago

Changelog Description

Separate publisher tool logic into smaller models.

Additional info

Content of control.py was huge mess with ton of public methods and properties, it was hard to find out what is used where and how. Hopefully this helps a little bit to manage the logic. Some of the changes may cause issues with custom modifications of the tool (e.g. traypublisher). Some methods/properties were kept to keep backwards compatibility.

This is first PR that is "refactoring" the logic. There will be more. This is already huge.

Testing notes:

Publisher tool should work as usual in host integrations.

  1. Validate any feature of publisher.
    • create
    • publish
    • pause publishing
    • see validation errors
    • see errors
    • change attributes
    • change context
    • save should keep values
    • invalid instance context should not cause crash (which did in develop)
    • reset should do what did reset do
    • buttons are enabled/disabled when they should be
    • publish report can be loaded in publish report viewer
ynbot commented 1 week ago

Task linked: AY-5916 Separate backend into models/api

BigRoy commented 1 week ago

Just wanted to remark that I'm not sure what this separation helps with aside of maybe from a software-design purism - to me it's still just a lot of code. (According to the "changed lines" it's even more code, hehe) Not something we can fix I think but anything with a "cleanup" or "organize it more" effort I feel is a good goal so from that perspective I'd approve. But do keep in mind that at first sight to an 'outsider' this PR doesn't necessarily solve it. I likely still need to ask you where something is.

Side-question. Does this PR also tend to solve that e.g. the Publish Report isn't accessible from an API standpoint? Because my preference would be to refactor it so that the core functionality is API-driven first (no GUIs, no controllers; just a plain publishing iterator or whatever?) and then the controller just uses that.

Sorry if these are dumb questions.