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

Refactor Settings and fix launch environment #33

Merged
merged 14 commits into from
Sep 2, 2024

Conversation

BigRoy
Copy link
Collaborator

@BigRoy BigRoy commented Aug 30, 2024

Changelog Description

Refactor settings to match with feedback in #31

Additional info

This is a first pass draft, and likely does not work. Just wanted to put it up so there's visibility on that I have a first pass on this. This now works for me, with both Houdini 20 and Maya 2024.2

  • Bugfix: The used settings are now from the active bundle (and use ayon_core studio settings and project settings retrieval)
  • Bugfix: Launch context environment is now maintained and used (this contains Construct AYON USD environment on top launch context environment #32)
  • Bugfix: Setup resolver env logic now does not 'kill' PATH on Windows by accident because it previously stacked to LD_LIBRARY_PATH and got set to PATH. It is now 'appended'toPATH`.
  • Simplifies settings (and also changes the settings keys! So note that you need to reconfigure your settings)
  • Improves logging for invalid server repository, it will report now no timestamp was found for that path. Which was better than the unclear error before.
  • Added more docstrings to functions

A potential downside to this PR is that aside of the LakeFS instance connection it now uses no local cache - which of course can be implemented in a separate PR later.

Testing notes:

  1. Clone the repository, checkout the branch (and don't forget all the git submodules, etc.)
  2. Configure the settings using the LakeFS urls, etc. (request them with Lyon from Ynput team)
  3. Launch Maya or Houdini

@BigRoy BigRoy requested review from iLLiCiTiT and Lypsolon August 30, 2024 22:46
@BigRoy BigRoy marked this pull request as ready for review August 31, 2024 18:28
@BigRoy BigRoy added type: bug Something isn't working type: enhancement Improvement of existing functionality or minor addition labels Aug 31, 2024
@BigRoy BigRoy self-assigned this Aug 31, 2024
@BigRoy BigRoy changed the title First pass on draft refactoring settings Refactor Settings and fix launch environment Aug 31, 2024
@BigRoy BigRoy linked an issue Aug 31, 2024 that may be closed by this pull request
Copy link
Member

@iLLiCiTiT iLLiCiTiT left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code changes look good to me, needs testing.

@BigRoy
Copy link
Collaborator Author

BigRoy commented Sep 2, 2024

@Lypsolon I suppose this is now in your lap - but I'll also add @antirotor as reviewer just in case.

@BigRoy BigRoy requested a review from antirotor September 2, 2024 09:57
…ix/refactor_settings_fix_31

# Conflicts:
#	client/ayon_usd/addon.py
#	server/settings/main.py
@Lypsolon
Copy link
Collaborator

Lypsolon commented Sep 2, 2024

Basic Testing on Almalinux 9
Installed New addon and opend houdini (Resolver was loaded as expected)

Im not the biggest fan of using direct Dict[] access but if most developers like this we can keep it this way.

i would like to ask @BigRoy and @iLLiCiTiT what you think about using a data class that simply exposes the data. aka: Dataclass(settings).lakeFs_Setting_A instead of the direct dict asses.
I prefer that but that might just be bias and if most Developers Prefer it the other way around then this code Looks Good.

@BigRoy
Copy link
Collaborator Author

BigRoy commented Sep 2, 2024

Dataclass(settings).lakeFs_Setting_A instead of the direct dict asses.
I prefer that but that might just be bias and if most Developers Prefer it the other way around then this code Looks Good.

I think the best we could get to is sharing the actual pydantic setting classes and somehow be able to use that frontend without much magic and code shuffling around at runtime so that an IDE is able to pick that up. Otherwise it's still a matter of maintaining the models on both client and backend site separately - which I'd prefer to avoid.

But then we'd get type hints as well! (which copying a dataclass to client manually would also do, etc.) - however I have no idea if anything like that is even feasible without code duplication.

Anyway, again - there's merit to it, but preferably this is done in a way that makes sense across all addons. So this may be worth a separate issue in a more global space and go from there.

Also, no matter what we choose - definitely a separate issue or PR.

@Lypsolon could you give the the "Approved" stamp?

Copy link
Collaborator

@Lypsolon Lypsolon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Simple Tests have been Done under Almalinux 9 and looks like it works.
the code looks good.

@BigRoy BigRoy merged commit 569f79e into develop Sep 2, 2024
1 check passed
@iLLiCiTiT
Copy link
Member

We could have model that is dynamically created based on server models, but only change at the end would be that I do settings.lake_fs instead of settings["lake_fs"]. Considering there might be addons that are accessing other addons settings (should not happen, but it does), then you're kinda screwed.

Sum up: I don't see any advantage to use attributes over dictionary keys. It only adds unecessary conversion step of settings to objects, that cannot be used in IDE, because it has to be created on the fly based on current server model (which IDE does not doo).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug Something isn't working type: enhancement Improvement of existing functionality or minor addition
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Remove config.py
3 participants