mirror of
https://github.com/ynput/ayon-core.git
synced 2025-12-24 21:04:40 +01:00
Rebrand database access
All occurences of 'pype' database should be replaced with 'openpype'
This commit is contained in:
parent
5887efeefc
commit
73841259bf
9 changed files with 24 additions and 25 deletions
|
|
@ -24,7 +24,7 @@ from .mongo import (
|
|||
compose_url,
|
||||
get_default_components,
|
||||
validate_mongo_connection,
|
||||
PypeMongoConnection
|
||||
OpenPypeMongoConnection
|
||||
)
|
||||
from .anatomy import (
|
||||
merge_dict,
|
||||
|
|
@ -213,7 +213,7 @@ __all__ = [
|
|||
"compose_url",
|
||||
"get_default_components",
|
||||
"validate_mongo_connection",
|
||||
"PypeMongoConnection",
|
||||
"OpenPypeMongoConnection",
|
||||
|
||||
"IniSettingRegistry",
|
||||
"JSONSettingRegistry",
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ from . import Terminal
|
|||
from .mongo import (
|
||||
MongoEnvNotSet,
|
||||
decompose_url,
|
||||
PypeMongoConnection
|
||||
OpenPypeMongoConnection
|
||||
)
|
||||
try:
|
||||
import log4mongo
|
||||
|
|
@ -203,7 +203,7 @@ class PypeLogger:
|
|||
log_mongo_url_components = None
|
||||
|
||||
# Database name in Mongo
|
||||
log_database_name = "pype"
|
||||
log_database_name = os.environ["OPENPYPE_DATABASE_NAME"]
|
||||
# Collection name under database in Mongo
|
||||
log_collection_name = "logs"
|
||||
|
||||
|
|
@ -470,7 +470,7 @@ class PypeLogger:
|
|||
if not cls.initialized:
|
||||
cls.initialize()
|
||||
|
||||
return PypeMongoConnection.get_mongo_client(cls.log_mongo_url)
|
||||
return OpenPypeMongoConnection.get_mongo_client(cls.log_mongo_url)
|
||||
|
||||
|
||||
def timeit(method):
|
||||
|
|
|
|||
|
|
@ -129,13 +129,13 @@ def validate_mongo_connection(mongo_uri):
|
|||
client.close()
|
||||
|
||||
|
||||
class PypeMongoConnection:
|
||||
class OpenPypeMongoConnection:
|
||||
"""Singleton MongoDB connection.
|
||||
|
||||
Keeps MongoDB connections by url.
|
||||
"""
|
||||
mongo_clients = {}
|
||||
log = logging.getLogger("PypeMongoConnection")
|
||||
log = logging.getLogger("OpenPypeMongoConnection")
|
||||
|
||||
@staticmethod
|
||||
def get_default_mongo_url():
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ import ftrack_api
|
|||
import pymongo
|
||||
from openpype.lib import (
|
||||
get_pype_execute_args,
|
||||
PypeMongoConnection
|
||||
OpenPypeMongoConnection
|
||||
)
|
||||
from openpype.modules.ftrack import FTRACK_MODULE_DIR
|
||||
from openpype.modules.ftrack.lib import (
|
||||
|
|
@ -181,7 +181,7 @@ def main_loop(ftrack_url):
|
|||
|
||||
os.environ["FTRACK_EVENT_SUB_ID"] = str(uuid.uuid1())
|
||||
|
||||
mongo_uri = PypeMongoConnection.get_default_mongo_url()
|
||||
mongo_uri = OpenPypeMongoConnection.get_default_mongo_url()
|
||||
|
||||
# Current file
|
||||
scripts_dir = os.path.join(FTRACK_MODULE_DIR, "scripts")
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ except ImportError:
|
|||
from ftrack_api._weakref import WeakMethod
|
||||
from openpype.modules.ftrack.lib import get_ftrack_event_mongo_info
|
||||
|
||||
from openpype.lib import PypeMongoConnection
|
||||
from openpype.lib import OpenPypeMongoConnection
|
||||
from openpype.api import Logger
|
||||
|
||||
TOPIC_STATUS_SERVER = "pype.event.server.status"
|
||||
|
|
@ -144,14 +144,14 @@ class ProcessEventHub(SocketBaseEventHub):
|
|||
def prepare_dbcon(self):
|
||||
try:
|
||||
database_name, collection_name = get_ftrack_event_mongo_info()
|
||||
mongo_client = PypeMongoConnection.get_mongo_client()
|
||||
mongo_client = OpenPypeMongoConnection.get_mongo_client()
|
||||
self.dbcon = mongo_client[database_name][collection_name]
|
||||
self.mongo_client = mongo_client
|
||||
|
||||
except pymongo.errors.AutoReconnect:
|
||||
self.pypelog.error((
|
||||
"Mongo server \"{}\" is not responding, exiting."
|
||||
).format(PypeMongoConnection.get_default_mongo_url()))
|
||||
).format(OpenPypeMongoConnection.get_default_mongo_url()))
|
||||
sys.exit(0)
|
||||
|
||||
except pymongo.errors.OperationFailure:
|
||||
|
|
|
|||
|
|
@ -1,8 +1,6 @@
|
|||
import os
|
||||
from openpype.api import get_system_settings
|
||||
|
||||
PYPE_DATABASE_NAME = "pype"
|
||||
|
||||
|
||||
def get_ftrack_settings():
|
||||
return get_system_settings()["modules"]["ftrack"]
|
||||
|
||||
|
|
@ -13,6 +11,6 @@ def get_ftrack_url_from_settings():
|
|||
|
||||
def get_ftrack_event_mongo_info():
|
||||
ftrack_settings = get_ftrack_settings()
|
||||
database_name = PYPE_DATABASE_NAME
|
||||
database_name = os.environ["OPENPYPE_DATABASE_NAME"]
|
||||
collection_name = "ftrack_events"
|
||||
return database_name, collection_name
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ from openpype.modules.ftrack.ftrack_server.lib import (
|
|||
TOPIC_STATUS_SERVER_RESULT
|
||||
)
|
||||
from openpype.modules.ftrack.lib import get_ftrack_event_mongo_info
|
||||
from openpype.lib import PypeMongoConnection
|
||||
from openpype.lib import OpenPypeMongoConnection
|
||||
from openpype.api import Logger
|
||||
|
||||
log = Logger.get_logger("Event storer")
|
||||
|
|
@ -35,11 +35,11 @@ ignore_topics = []
|
|||
def install_db():
|
||||
global dbcon
|
||||
try:
|
||||
mongo_client = PypeMongoConnection.get_mongo_client()
|
||||
mongo_client = OpenPypeMongoConnection.get_mongo_client()
|
||||
dbcon = mongo_client[database_name][collection_name]
|
||||
except pymongo.errors.AutoReconnect:
|
||||
log.error("Mongo server \"{}\" is not responding, exiting.".format(
|
||||
PypeMongoConnection.get_default_mongo_url()
|
||||
OpenPypeMongoConnection.get_default_mongo_url()
|
||||
))
|
||||
sys.exit(0)
|
||||
|
||||
|
|
|
|||
|
|
@ -170,18 +170,18 @@ class MongoSettingsHandler(SettingsHandler):
|
|||
|
||||
def __init__(self):
|
||||
# Get mongo connection
|
||||
from openpype.lib import PypeMongoConnection
|
||||
from openpype.lib import OpenPypeMongoConnection
|
||||
from avalon.api import AvalonMongoDB
|
||||
|
||||
settings_collection = PypeMongoConnection.get_mongo_client()
|
||||
settings_collection = OpenPypeMongoConnection.get_mongo_client()
|
||||
|
||||
self._anatomy_keys = None
|
||||
self._attribute_keys = None
|
||||
# TODO prepare version of pype
|
||||
# - pype version should define how are settings saved and loaded
|
||||
|
||||
database_name = os.environ["OPENPYPE_DATABASE_NAME"]
|
||||
# TODO modify to not use hardcoded keys
|
||||
database_name = "pype"
|
||||
collection_name = "settings"
|
||||
|
||||
self.settings_collection = settings_collection
|
||||
|
|
@ -541,19 +541,19 @@ class MongoLocalSettingsHandler(LocalSettingsHandler):
|
|||
def __init__(self, local_site_id=None):
|
||||
# Get mongo connection
|
||||
from openpype.lib import (
|
||||
PypeMongoConnection,
|
||||
OpenPypeMongoConnection,
|
||||
get_local_site_id
|
||||
)
|
||||
|
||||
if local_site_id is None:
|
||||
local_site_id = get_local_site_id()
|
||||
settings_collection = PypeMongoConnection.get_mongo_client()
|
||||
settings_collection = OpenPypeMongoConnection.get_mongo_client()
|
||||
|
||||
# TODO prepare version of pype
|
||||
# - pype version should define how are settings saved and loaded
|
||||
|
||||
database_name = os.environ["OPENPYPE_DATABASE_NAME"]
|
||||
# TODO modify to not use hardcoded keys
|
||||
database_name = "pype"
|
||||
collection_name = "settings"
|
||||
|
||||
self.settings_collection = settings_collection
|
||||
|
|
|
|||
1
start.py
1
start.py
|
|
@ -140,6 +140,7 @@ def set_openpype_global_environments() -> None:
|
|||
|
||||
# Hardcoded default values
|
||||
os.environ["PYBLISH_GUI"] = "pyblish_pype"
|
||||
os.environ["OPENPYPE_DATABASE_NAME"] = "openpype" # name of Pype database
|
||||
# Change scale factor only if is not set
|
||||
if "QT_AUTO_SCREEN_SCALE_FACTOR" not in os.environ:
|
||||
os.environ["QT_AUTO_SCREEN_SCALE_FACTOR"] = "1"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue