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

Shims for AYON launcher executables #112

Merged
merged 85 commits into from
Aug 15, 2024

Conversation

iLLiCiTiT
Copy link
Member

@iLLiCiTiT iLLiCiTiT commented Apr 18, 2024

Changelog Description

Implemented simple shims which can redirect to ayon launcher version.

Additional info

Shims are meant to help with registering of path to AYON launcher. Right now you can point to a single version of AYON launcher, which would stop to work when the version is uninstalled because new version is available. Only think which shim does is to find an existing ayon launcher and execute it, it does not download it or handle logic.

The downside of this approach is that it does not handle cases when there are any available versions. In that case it just crashes. It also does not autodetect available versions, so the new launcher must be launched at least once so shim can find it.

The shim is versioned with version file which contains version raw string. This file was used instead of version.py because of potential future change of implementation from Python to C++.

AYON launcher has new argument handling. When "init-ayon-launcher" is passed it just stores information about executable and deploys shims witout any other action.

Full feature set of this PR

  • AYON launcher has shim, which is capable of finding real AYON launcher executable. That is executable to which can be pointed any automation which should support any version of AYON launcher (e.g. deadline Ayon plugin).
  • The shim is also used for custom ayon-launcher:// protocol scheme, that is different based on OS. With this support we can start to use webactions.
  • Login window can force username to be logged in.

Warning

On windows and linux is shim launching new ayon launcher and the shim process ends after the AYON launcher process ends and is using the same exit code and is passing in stdout and stderr (if is available). That is not true on macOs where shim only opens new launcher and ends.

Reason: Shim is used for webactions, api of uri handling on macOs is based on events (launch process and send event to start uri). The issue is that only one process of the application can be running to be able to achieve this. Any future process just won't start.

Possible issues: If the exectable is used in a automation that should wait for the process to "finish", it is not possible.

Testing notes:

  1. Run Create env command.
  2. Run build and make installer.
  3. Install AYON launcher on windows. Start unpacked AYON launcher at least once on linux and mac.
  4. On Windows It should create shims on your machine (%LOCALAPPDATA%\Ynput\AYON\shim\).
  5. For other platforms the shims are created when the AYON launcher is launched for a first time.
  6. When you run the shim it should start AYON launcher.

If you're retesting this PR, make sure to reinstall venv and remove existing AYON launcher. Also remove existing shim, %LOCALAPPDATA%\Ynput\AYON\shim\ on windows /Applications/AYON.app on macOs and ~/.local/AYON/shim on linux.

  • Windows
  • Linux
  • macOs

Webactions

Shims added option to use webactions. For that make sure you have

@iLLiCiTiT iLLiCiTiT marked this pull request as ready for review April 19, 2024 14:41
Copy link
Member

@antirotor antirotor left a comment

Choose a reason for hiding this comment

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

so far, code looks good and I was able to build it on centos7

@ynbot
Copy link

ynbot commented May 29, 2024

Task linked: AY-5077 AYON launcher shims

@iLLiCiTiT iLLiCiTiT requested review from kalisp and 64qam August 9, 2024 11:06
@64qam
Copy link
Member

64qam commented Aug 12, 2024

Launcher on Windows is working only via command line. When starting from Total Commnader, ayon_console.exe immediately close the pop up console and ayon.exe crashes with the error:
image

@64qam
Copy link
Member

64qam commented Aug 12, 2024

Linux (Rocky8, Rocky9), Mac:

  File "/Users/ynput/ayon/ayon-launcher/tools/build_post_process.py", line 829, in <module>
    main()
  File "/Users/ynput/ayon/ayon-launcher/tools/build_post_process.py", line 822, in main
    post_build_process(ayon_root, build_root)
  File "/Users/ynput/ayon/ayon-launcher/tools/build_post_process.py", line 605, in post_build_process
    copy_shim_to_build(ayon_root, build_content_root)
  File "/Users/ynput/ayon/ayon-launcher/tools/build_post_process.py", line 232, in copy_shim_to_build
    with open(dist_root / "version", "r") as stream:
FileNotFoundError: [Errno 2] No such file or directory: '/Users/ynput/ayon/ayon-launcher/shim/dist/version'```

@64qam 64qam requested a review from MilaKudr August 13, 2024 07:43
Copy link
Member

@64qam 64qam left a comment

Choose a reason for hiding this comment

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

Tested on Windows, MacOS, Rocky 8, Rocky 9.

@64qam
Copy link
Member

64qam commented Aug 14, 2024

Still the same. On Mac login window always pops up. On Rocky launcher doesn't start.

@iLLiCiTiT iLLiCiTiT force-pushed the feature/AY-5077_AYON-launcher-shims branch 2 times, most recently from 841e127 to e62c3e8 Compare August 14, 2024 20:07
@iLLiCiTiT iLLiCiTiT merged commit cee0832 into develop Aug 15, 2024
1 check passed
@iLLiCiTiT iLLiCiTiT deleted the feature/AY-5077_AYON-launcher-shims branch August 15, 2024 13:49
@fabiaserra
Copy link

got this error building ayon-launcher:

Traceback (most recent call last):
  File "/builds/coreweave/pipeline/ayon/ayon-launcher/tools/installer_post_process.py", line 362, in <module>
    main()
  File "/builds/coreweave/pipeline/ayon/ayon-launcher/tools/installer_post_process.py", line 346, in main
    func(**result_dict)
  File "/builds/coreweave/pipeline/ayon/ayon-launcher/tools/installer_post_process.py", line 240, in cli_upload
    installer_info: InstallerInfo = find_installer_info(installer_dir)
  File "/builds/coreweave/pipeline/ayon/ayon-launcher/tools/installer_post_process.py", line 107, in find_installer_info
    return InstallerInfo(installer_path=str(installer_path), **metadata)
TypeError: __init__() got an unexpected keyword argument 'distro_short'

I fixed it by adding distro_short on the InstallerInfo:

@dataclass
class InstallerInfo:
    version: str
    platform: str
    filename: str
    installer_path: str
    python_version: str
    checksum: str
    checksum_algorithm: str
    size: int
    python_modules: dict[str, str]
    runtime_python_modules: dict[str, str]
    distro_short: str

@iLLiCiTiT
Copy link
Member Author

Not related to this PR but #158 , fixed in develop.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants