Skip to content

Use +git version when starting service from Makefile #94

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

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from

Conversation

martastain
Copy link
Member

No description provided.

@MustafaJafar
Copy link
Member

What is this PR trying to solve?
I can run kitsu service from the develop branch. both (manage.ps1 and Makefile).

  • Makefile
    image
  • manage.ps1
    image

@MustafaJafar
Copy link
Member

Also, here's the result from testing this PR

E:\Ynput\ayon-kitsu\services\processor>make -f Makefile run 
poetry run python -m processor
Connecting to server "http://192.168.1.4:5000/"
Logged in as user "Service"
2024-12-20 16:42:44 ERROR      Exception!

    Traceback (most recent call last):
      File "E:\Ynput\ayon-kitsu\services\processor\.venv\Lib\site-packages\ayon_api\server_api.py", line 191, in raise_for_status
        self._response.raise_for_status()
      File "E:\Ynput\ayon-kitsu\services\processor\.venv\Lib\site-packages\requests\models.py", line 1024, in raise_for_status
        raise HTTPError(http_error_msg, response=self)
    requests.exceptions.HTTPError: 404 Client Error: Not Found for url: http://192.168.1.4:5000/api/addons/kitsu/1.2.4-dev/settings?variant=production

    During handling of the above exception, another exception occurred:

    Traceback (most recent call last):
      File "E:\Ynput\ayon-kitsu\services\processor\processor\__main__.py", line 28, in <module>
        processor = KitsuProcessor()
                    ^^^^^^^^^^^^^^^^
      File "E:\Ynput\ayon-kitsu\services\processor\processor\processor.py", line 70, in __init__
        self.settings = ayon_api.get_service_addon_settings()
                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      File "E:\Ynput\ayon-kitsu\services\processor\.venv\Lib\site-packages\ayon_api\_api.py", line 255, in get_service_addon_settings
        return get_addon_settings(addon_name, addon_version)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      File "E:\Ynput\ayon-kitsu\services\processor\.venv\Lib\site-packages\ayon_api\_api.py", line 711, in get_addon_settings
        return con.get_addon_settings(*args, **kwargs)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      File "E:\Ynput\ayon-kitsu\services\processor\.venv\Lib\site-packages\ayon_api\server_api.py", line 2913, in get_addon_settings
        return self.get_addon_studio_settings(
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      File "E:\Ynput\ayon-kitsu\services\processor\.venv\Lib\site-packages\ayon_api\server_api.py", line 2817, in get_addon_studio_settings
        result.raise_for_status()
      File "E:\Ynput\ayon-kitsu\services\processor\.venv\Lib\site-packages\ayon_api\server_api.py", line 195, in raise_for_status
        raise HTTPRequestError(message, exc.response)
    ayon_api.exceptions.HTTPRequestError: 404 Client Error: Not Found for url: http://192.168.1.4:5000/api/addons/kitsu/1.2.4-dev/settings?variant=production


2024-12-20 16:42:54 ERROR      Unable to initialize KitsuProcessor. Exiting
2024-12-20 16:42:54 DEBUG      Critical error. Terminating program.
make: *** [Makefile:30: run] Error 1

@iLLiCiTiT
Copy link
Member

iLLiCiTiT commented Dec 20, 2024

What if I don't run it from server addons? Which is most of devs and testers (#94 (comment)).

@martastain
Copy link
Member Author

What if I don't run it from server addons? Which is most of devs and testers.

Fair enough.... so. would it make sense to you to have this as a different target? I actually run +git version of the addon quite often

@iLLiCiTiT
Copy link
Member

iLLiCiTiT commented Dec 20, 2024

I would say that most of devs and testers would welcome service tools, similar to ftrack's and shotgrid's. They're used to run services out of docker. https://github.com/ynput/ayon-ftrack/tree/develop/service_tools

@MustafaJafar
Copy link
Member

I was exploring addon development when cloning them to ayon-docker/addons which is the case this PR deals with.

it's worth mentioning that the processor service doesn't work without setting these environment variables, I added these to the top of the manage.ps1

$env:AYON_ADDON_VERSION = $AYON_WORKING_VERSION
$env:AYON_ADDON_NAME = "kitsu"

@MustafaJafar
Copy link
Member

I think using an environment varibale like the one we are using in docker file can be helpful AYON_USE_GIT_SUFFIX_FOR_ADDONS.

this one works nicely on my side for both running kitsu addon either inside or outside of ayon-docker/addons directory.

if ($env:AYON_USE_GIT_SUFFIX_FOR_ADDONS) {
  $env:AYON_ADDON_VERSION = Invoke-Expression -Command "python -c ""import os;import sys;content={};f=open(r'$($script_dir)/../../package.py');exec(f.read(),content);f.close();print(content['version'].split('-')[0].split('+')[0] + '+git')"""
}
else {
  $env:AYON_ADDON_VERSION = Invoke-Expression -Command "python -c ""import os;import sys;content={};f=open(r'$($script_dir)/../../package.py');exec(f.read(),content);f.close();print(content['version'])"""
}

@MustafaJafar
Copy link
Member

Here's an alternative solution.
#114

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.

3 participants