Skip to content
This repository has been archived by the owner on Sep 20, 2024. It is now read-only.

General: Define query functions #3288

Merged

Conversation

iLLiCiTiT
Copy link
Member

@iLLiCiTiT iLLiCiTiT commented Jun 6, 2022

Brief description

Define basic query functions to replace direct mongo queries for project specific entities.

Description

We need to define functions that will cover all direct mongo queries in code and use only functions in a way that functions logic can be changed to work with any other database system, or at least as much as possible. This is first step of the change by defying basic query functions which are used (for now) only in tools. AvalonMongoDB objects and legacy_io have new functions active_project and current_project (difference is that current_project does not require installation).

Additional information

At this stage all tools should work as they did. Content of openpype.client must be self contained so there is no place to use
any other context then context passed to functions which are called there.

Some functions can be split into more, some functions can be merged into one, some are missing completely because there was not a use case for them in tools.

Future goals

  1. Conver remaining parts of codebase to use these functions.
  2. Move MongoDB connection handling from openpype.lib to openpype.client (with backwards compatibility).
  3. Find out how to handle "creation" and "update" with some abstraction which is not MongoDB based.

Testing notes:

  1. Tools should work as they did

@ynbot
Copy link
Contributor

ynbot commented Jun 6, 2022

)
from openpype.pipeline import HeroVersionType
from .models import TreeModel
from . import lib
Copy link

Choose a reason for hiding this comment

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

module level import not at top of file

get_hero_versions,
)
from openpype.pipeline import HeroVersionType
from .models import TreeModel
Copy link

Choose a reason for hiding this comment

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

module level import not at top of file

get_versions,
get_hero_versions,
)
from openpype.pipeline import HeroVersionType
Copy link

Choose a reason for hiding this comment

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

module level import not at top of file

if Qt.__binding__ == "PySide":
from PySide.QtGui import QStyleOptionViewItemV4
elif Qt.__binding__ == "PyQt4":
from PyQt4.QtGui import QStyleOptionViewItemV4

from openpype.client import (
Copy link

Choose a reason for hiding this comment

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

module level import not at top of file

@iLLiCiTiT iLLiCiTiT self-assigned this Jun 7, 2022
@iLLiCiTiT iLLiCiTiT marked this pull request as ready for review June 7, 2022 16:58
@mkolar mkolar added the type: refactor Structural changes not affecting functionality label Jun 7, 2022
@mkolar
Copy link
Member

mkolar commented Jun 7, 2022

I'll just add that this is part of the continuous work towards a properly defined V4 API on the client side as well as server. To be able to make the move, we first need to unify what's going on with the DB call across the codebase.

Copy link
Member

@mkolar mkolar left a comment

Choose a reason for hiding this comment

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

When I select asset in tray loader
image

Launcher doesn't show anything inside a project

Selecting asset and task in standalone publisher
image

Can't test further, because without launcher, i can't launch hosts :D

@iLLiCiTiT
Copy link
Member Author

Should work now

@iLLiCiTiT iLLiCiTiT requested a review from mkolar June 8, 2022 17:21
- versions

### Standalone publisher
- openpype/hosts/standalonepublisher/plugins/publish/collect_bulk_mov_instances.py
Copy link

Choose a reason for hiding this comment

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

line too long (82 > 79 characters)

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.

As far as I've tested it works for me.

Copy link
Member

@kalisp kalisp left a comment

Choose a reason for hiding this comment

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

Tested in AE/PS.
Tested Loader and Site Sync.
So far it works fine.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
type: refactor Structural changes not affecting functionality
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants