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

Tray: Add username to info #797

Merged
merged 6 commits into from
Jul 25, 2024
Merged

Conversation

iLLiCiTiT
Copy link
Member

Changelog Description

Tray info received with /tray endpoint does return username.

Additional info

Username will be important check for running webactions, which can be available from the start of tray process. Cache the username as user change requires restart.

Testing notes:

  1. You can get tray information to validate that "username" is there.

@iLLiCiTiT iLLiCiTiT requested review from BigRoy, kalisp and antirotor July 24, 2024 13:52
@ynbot ynbot added size/XS type: enhancement Improvement of existing functionality or minor addition labels Jul 24, 2024
@BigRoy
Copy link
Collaborator

BigRoy commented Jul 24, 2024

Would love to test - but how do I "get" this tray info? How do I request it? Do you have an example for dummies?

@iLLiCiTiT
Copy link
Member Author

Would love to test - but how do I "get" this tray info? How do I request it? Do you have an example for dummies?

Oh, when you start a tray, you can open Admin > Console and do

import json
import requests
from ayon_core.tools.tray import get_tray_server_url

response = requests.get(f"{get_tray_server_url()}/tray")
print(json.dumps(response.json(), indent=4))

@iLLiCiTiT iLLiCiTiT requested review from 64qam and MilaKudr July 25, 2024 12:10
Copy link
Collaborator

@BigRoy BigRoy left a comment

Choose a reason for hiding this comment

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

Works for me.

{
    "username": "admin",
    "bundle": "2024.01.0-full-2024-01-17-02-roydev",
    "dev_mode": true,
    "staging_mode": false,
    "addons": {
        "applications": "0.2.5-dev.1",
        "ayon_ocio": "1.1.1",
        "ayon_third_party": "1.1.1",
        "blender": "0.2.2-dev.1",
        "colorbleed": "0.0.6",
        "deadline": "0.2.5-dev.1",
        "fusion": "0.2.1-dev.1",
        "houdini": "0.3.10-dev.1",
        "launch_scripts": "0.1.0",
        "maya": "0.2.10-dev.1",
        "resolve": "0.2.3-dev.1",
        "substancepainter": "0.2.2-dev.1",
        "traypublisher": "0.2.6-dev.1",
        "launcher_tool": "1.0.0",
        "loader_tool": "1.0.0",
        "python_interpreter": "1.0.0"
    },
    "installer_version": "1.0.3",
    "running_time": 24.249284029006958
}

@BigRoy
Copy link
Collaborator

BigRoy commented Jul 25, 2024

By the way, also works when running the code not from console in tray but e.g. from a DCC (to showcase the point that it does get it via the request)

@iLLiCiTiT iLLiCiTiT merged commit 83ebaa3 into develop Jul 25, 2024
5 checks passed
@iLLiCiTiT iLLiCiTiT deleted the enhancement/add-username-to-tray-info branch July 25, 2024 12:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
size/XS type: enhancement Improvement of existing functionality or minor addition
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants