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

Applications: Live attributes update #350

Merged

Conversation

iLLiCiTiT
Copy link
Member

Changelog Description

Update attribute values on settings save.

Additional info

This helps to update the attribute live on settings change. It does work from this version up. The update does not require restart of server, but the live attributes update is available from server version 1.0.7 .

Testing notes:

  1. Make sure you have server 1.0.7 or newer.
  2. Create packages on server addons from this PR.
  3. Upload applications addon.
  4. Use the version in production/staging bundle.
  5. Add new vartiant of applications and save settings.
  6. Go to any project anatomy and check if the variant is available in the attribute.

@ynbot ynbot added the size/S label Apr 2, 2024
@ynbot ynbot added the type: enhancement Improvement of existing functionality or minor addition label Apr 2, 2024
Copy link
Member

@m-u-r-p-h-y m-u-r-p-h-y left a comment

Choose a reason for hiding this comment

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

not working for me

application addon 0.1.9
server 1.0.8+202403281707

image

Copy link
Member

@martastain martastain left a comment

Choose a reason for hiding this comment

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

Adding new variants with live updating works, but default variants (both for tools and applications) are present in enums even if i remove them and replace with others. i purged all previous versions of the application addon as well as all settings, but old variants are still there.

Also. Could you please add:

from ayon_server.entities.core import attribute_library
await attribute_library.load()

to the end of update_enums? it is not required for now, but in a future release (soon) this will invalidate attribute cache in redis, which is going to be needed for horizontal scaling of the server. At this point, it won't hurt doing it, so it is just for forwards compatibility.

@BigRoy
Copy link
Collaborator

BigRoy commented Apr 3, 2024

Adding new variants with live updating works, but default variants (both for tools and applications) are present in enums even if i remove them and replace with others. i purged all previous versions of the application addon as well as all settings, but old variants are still there.

Did you remove them in both the production settings AND the staging settings?

@iLLiCiTiT
Copy link
Member Author

iLLiCiTiT commented Apr 3, 2024

Adding new variants with live updating works, but default variants (both for tools and applications) are present in enums even if i remove them and replace with others. i purged all previous versions of the application addon as well as all settings, but old variants are still there.

As Roy mentioned, did you change staging applications too?

to the end of update_enums? it is not required for now, but in a future release (soon) this will invalidate attribute cache in redis, which is going to be needed for horizontal scaling of the server. At this point, it won't hurt doing it, so it is just for forwards compatibility.

Could you add function reset_attributes_cache which does it? This is too specific for cases the logic would change in future.

from ayon_server.entities.core import attribute_library
await attribute_library.load()

@iLLiCiTiT iLLiCiTiT requested a review from martastain April 3, 2024 12:12
@iLLiCiTiT iLLiCiTiT requested a review from m-u-r-p-h-y April 3, 2024 13:50
Copy link
Member

@m-u-r-p-h-y m-u-r-p-h-y left a comment

Choose a reason for hiding this comment

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

It works only in case you manually refresh the page to force the enum to reload.

image

after CTRL+R it is there
image

@iLLiCiTiT
Copy link
Member Author

iLLiCiTiT commented Apr 3, 2024

It works only in case you manually refresh the page to force the enum to reload.

That's out of scope of this PR and my competence.

It works ok for me, but I don't have opened 2 windows which might be the reason?

@iLLiCiTiT iLLiCiTiT requested a review from m-u-r-p-h-y April 3, 2024 16:42
Copy link
Member

@m-u-r-p-h-y m-u-r-p-h-y left a comment

Choose a reason for hiding this comment

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

you are right. it was becasue of two windows opened (for the screenshot)

in single window it works as expected!

@martastain
Copy link
Member

martastain commented Apr 4, 2024

It works only in case you manually refresh the page to force the enum to reload.
after CTRL+R it is there

Yep. But it's better than restarting the server. Also we might be able to do that without page reload, but that's a frontend/backend issue (planned). We need to notify connected clients that they should invalidate their cached attribute list.

@m-u-r-p-h-y m-u-r-p-h-y merged commit fa515ea into develop Apr 4, 2024
6 of 7 checks passed
@m-u-r-p-h-y m-u-r-p-h-y deleted the enhancement/applications-live-attributes-update branch April 4, 2024 07:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
size/S type: enhancement Improvement of existing functionality or minor addition
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

5 participants