OpenPype icon indicating copy to clipboard operation
OpenPype copied to clipboard

General: Connect to v4 server (base)

Open iLLiCiTiT opened this issue 2 years ago • 1 comments

Brief description

Initial implementation of being able use v4 server for queries. Added ability to connecto v4 server and use base queries.

Description

It is still required to have running mongo. A lot of data are still received from mongo, those will be replaced in future PRs. V4 state of client is optional and to enable it enironment variable "OP4_TEST" must be set to "1". From that moment a login to v4 server will be required on start. At this moment most of entity queries are working so you should see project structure in launcher and loader.

For authentication of v4 server are used tokens. Token is stored under env "OPENPYPE_TOKEN" and server url under "OPENPYPE_SERVER_URL".

I had to modify ~/openpype/client content to be able do this switch. I've moved mongo implementation to mongo subfolder and use start imports in files from where current imports are used. Logic of any tool or query in code was not changed at all. Since functions were based on mongo queries they don't use full potential of v4 abilities and current implementation.

Additional info

Tokens are stored per url using keyring and last url is stored to appdirs. On launch is used last used server if env for server is not set. Tokens are stored under hardcoded user "username" as we would have to store also username next to url which is not needed for authentication. This is working solution but will probably change in future. I'm not sure how to handle tokens. They're stored to env variable and used for rest of process but it can easily happen the token is recreated on different machine and from that moment is old token invalid which can cause issues. Also not sure if it's safe to store it to env variable but not sure if there is different way how it could be send to DCC processes in future.

I've tried to abstract graphql queries into objects which was required to query specific fields from server. It works but the entity fields are hardcoded and not taken from server itself (which is probably fine). That is connected to mapping of data v3 <-> v4 structure. Created mapping of v3 and v4 entities so query functions can accept the same arguments and return the same result (at least in most of cases).

Implementation related to bootstrap and login was added to openpype_common where code common for bootstrap and openpype processes is located.

Notes

We'll have to drop filtering of representations by their context and using regex filters which is not possible in v4 (at least not at this moment).

Todos

  • Be able to change server and login in running tray.
  • Add tests for fields and entities conversions (v3 - v4).
  • Implement remaining query functions.
    • functions which are raising NotImplementedError
    • Change how folders are queried (right now there are double nested edge queries in folders because are also queriyng tasks - cause possible slowdown)
      • get folders should not handle tasks
      • implement get tasks function
      • implement function (for v3 compatibility) to query folders and tasks which should use task as source entity (in that case are grapql edges not nested and paging is easier)
    • Add some functions to client which do specific logic which is common for tools (*Nice to have)
  • Implement operations (will hard to make mapping of update data)
    • Needed for publishing
  • Change Anatomy (in v3) to not use get_anatomy_settings but use get_project and apply local settings on it's own
    • that way we can implement Anatomy for v4 without huge issues
  • Create v4 addon repositories for current v3 modules and add current settings to be able replace usage of get_project_settings and get_system_settings.
  • Maybe move openpype.settings to client part(???)

Testing notes:

  1. Launch OpenPype with env "OP4_TEST" set to "1"
  2. Login to an openpype v4 server
  3. Try open launcher or loader

iLLiCiTiT avatar Sep 27 '22 16:09 iLLiCiTiT

Task linked: OP-3739 Connect OP tray to v4 server

ynbot avatar Sep 27 '22 16:09 ynbot

Launcher is empty, Loader only show the three default project and I have to run refresh to show any subsets

I've found out I did not create projects correctly. Should be fixed.

iLLiCiTiT avatar Nov 08 '22 15:11 iLLiCiTiT

I would like to change the env variable "OP4_TEST" to something else. Any ideas?

iLLiCiTiT avatar Nov 16 '22 15:11 iLLiCiTiT

**# Error: ImportError: file C:\Users\milan\code\OpenPype\openpype\tools\utils\host_tools.py line 220: No Pyblish GUI found**

Not possible to open publisher in Maya

mkolar avatar Feb 09 '23 14:02 mkolar

Not able to test anything. Tray menu is having some strange inputs and Launcher is offering 3 projects with some random project names.

Not sure how I can do something about it. It looks like an issue with unicode conversion (could be OS issue).

iLLiCiTiT avatar Feb 13 '23 12:02 iLLiCiTiT

Not sure if I missed something, but I'm getting this error when trying to loading something in Maya 2023:

Traceback (most recent call last):
  File "C:\Dev\OpenPype\openpype\openpype\tools\loader\widgets.py", line 1592, in _load_representations_by_loader
    load_with_repre_context(
  File "C:\Dev\OpenPype\openpype\openpype\pipeline\load\utils.py", line 308, in load_with_repre_context
    loader = Loader(repre_context)
  File "C:\Dev\OpenPype\openpype\openpype\pipeline\load\plugins.py", line 44, in __init__
    self.fname = self.filepath_from_context(context)
  File "C:\Dev\OpenPype\openpype\openpype\pipeline\load\plugins.py", line 130, in filepath_from_context
    return get_representation_path_from_context(context)
  File "C:\Dev\OpenPype\openpype\openpype\pipeline\load\utils.py", line 541, in get_representation_path_from_context
    return get_representation_path(representation, root)
  File "C:\Dev\OpenPype\openpype\openpype\pipeline\load\utils.py", line 738, in get_representation_path
    path_from_config() or
  File "C:\Dev\OpenPype\openpype\openpype\pipeline\load\utils.py", line 646, in path_from_config
    version_, subset, asset, project = dbcon.parenthood(representation)
  File "C:\Dev\OpenPype\openpype\openpype\pipeline\legacy_io.py", line 66, in decorated
    return func(*args, **kwargs)
  File "C:\Dev\OpenPype\openpype\openpype\pipeline\legacy_io.py", line 147, in parenthood
    return _connection_object.parenthood(*args, **kwargs)
  File "C:\Dev\OpenPype\openpype\openpype\pipeline\mongodb.py", line 268, in parenthood
    document = self.find_one({"_id": document["parent"]})
  File "C:\Dev\OpenPype\openpype\openpype\pipeline\mongodb.py", line 143, in __getattr__
    collection = self._database[project_name]
TypeError: 'NoneType' object is not subscriptable

Technically shouldn't use mongo anymore?

simonebarbieri avatar Feb 13 '23 12:02 simonebarbieri

I can create and save workfiles without problem. But I can see in the server that for several tasks there already are workfiles:

image

but if I check from the workfile manager inside Maya, I cannot see them:

image

simonebarbieri avatar Feb 13 '23 12:02 simonebarbieri

houdini 19.5

Traceback (most recent call last):
  File "C:\Users\annat\Documents\Projects\OpenPype\sources\op-py39\openpype\tools\loader\widgets.py", line 1592, in _load_representations_by_loader
    load_with_repre_context(
  File "C:\Users\annat\Documents\Projects\OpenPype\sources\op-py39\openpype\pipeline\load\utils.py", line 308, in load_with_repre_context
    loader = Loader(repre_context)
  File "C:\Users\annat\Documents\Projects\OpenPype\sources\op-py39\openpype\pipeline\load\plugins.py", line 44, in __init__
    self.fname = self.filepath_from_context(context)
  File "C:\Users\annat\Documents\Projects\OpenPype\sources\op-py39\openpype\pipeline\load\plugins.py", line 130, in filepath_from_context
    return get_representation_path_from_context(context)
  File "C:\Users\annat\Documents\Projects\OpenPype\sources\op-py39\openpype\pipeline\load\utils.py", line 541, in get_representation_path_from_context
    return get_representation_path(representation, root)
  File "C:\Users\annat\Documents\Projects\OpenPype\sources\op-py39\openpype\pipeline\load\utils.py", line 738, in get_representation_path
    path_from_config() or
  File "C:\Users\annat\Documents\Projects\OpenPype\sources\op-py39\openpype\pipeline\load\utils.py", line 646, in path_from_config
    version_, subset, asset, project = dbcon.parenthood(representation)
  File "C:\Users\annat\Documents\Projects\OpenPype\sources\op-py39\openpype\pipeline\legacy_io.py", line 66, in decorated
    return func(*args, **kwargs)
  File "C:\Users\annat\Documents\Projects\OpenPype\sources\op-py39\openpype\pipeline\legacy_io.py", line 147, in parenthood
    return _connection_object.parenthood(*args, **kwargs)
  File "C:\Users\annat\Documents\Projects\OpenPype\sources\op-py39\openpype\pipeline\mongodb.py", line 268, in parenthood
    document = self.find_one({"_id": document["parent"]})
  File "C:\Users\annat\Documents\Projects\OpenPype\sources\op-py39\openpype\pipeline\mongodb.py", line 143, in __getattr__
    collection = self._database[project_name]
TypeError: 'NoneType' object is not subscriptable

antirotor avatar Feb 13 '23 16:02 antirotor

Not sure if I missed something, but I'm getting this error when trying to loading something in Maya 2023: houdini 19.5

Should be fix with https://github.com/ynput/OpenPype/pull/4459 (will fix when merged to develop and then develop to this branch)

But I can see in the server that for several tasks there already are workfiles:

Probably someone else created workfiles information for the asset (not on your PC),

Copy to Clipboard in OpenPypeInfo

Should be fixed

iLLiCiTiT avatar Feb 14 '23 10:02 iLLiCiTiT

When you'll have AYON_SERVER_URL start will fail with: 2023-02-15 17_23_19-Pype3 0 – credentials py  Pype3 0

kalisp avatar Feb 15 '23 16:02 kalisp

When you'll have AYON_SERVER_URL start will fail with:

Good catch. Fixed

iLLiCiTiT avatar Feb 15 '23 16:02 iLLiCiTiT

~~Published with Publisher, I can see subset on the server, not in Loader (maybe my project is not Library?)~~ Cannot reproduce it now. 2023-02-15 17_57_03-Window

kalisp avatar Feb 15 '23 16:02 kalisp

Time of publish in Loader is moved by 1 hour. 2023-02-15 18_14_28-Window

kalisp avatar Feb 15 '23 17:02 kalisp

Anatomy Applications enumerator issue

After I had created new App variant and saved the settings, I was expecting the variant to be offered in Anatomy Applications enumerator on a project, but it wasn't showing.

Launcher is not updating after new app was added to Anatomy Applications

I've added app to anatomy in project settings. After I had hit the reload button in Launcher but the app didn't show. I had to change a project and then go back to the original project and it was working then and the app had been offered.

App label is sowing -

Also there is an cosmetic issue as it is showing the app with variant name rather than label in the launcher. image

jakubjezek001 avatar Mar 03 '23 09:03 jakubjezek001

Related to change in settings model this is probable caused by it:

Traceback (most recent call last):
  File "C:\CODE\__PYPE\OpenPype_3.15_up\.venv\lib\site-packages\pyblish\plugin.py", line 522, in __explicit_process
    runner(*args)
  File "C:\CODE\__PYPE\OpenPype_3.15_up\openpype\plugins\publish\extract_burnin.py", line 87, in process
  File "C:\CODE\__PYPE\OpenPype_3.15_up\openpype\plugins\publish\extract_burnin.py", line 174, in main_process
  File "C:\CODE\__PYPE\OpenPype_3.15_up\openpype\plugins\publish\extract_burnin.py", line 734, in filter_burnins_defs
AttributeError: 'list' object has no attribute 'items'

jakubjezek001 avatar Mar 03 '23 10:03 jakubjezek001

Login window is not active on start which confuses user

iLLiCiTiT avatar Mar 13 '23 17:03 iLLiCiTiT

I ran this in automatic tests in v3 mode, seems same as regular v3 tray

kalisp avatar Mar 14 '23 09:03 kalisp

Seeing the new Ayon Tray and the splash screen 👍 image

narenandu avatar Mar 23 '23 04:03 narenandu

slack addon was causing ayon.exe to not launch and crash ..

image

narenandu avatar Mar 23 '23 17:03 narenandu