Beispiel #1
0
 def __init__(self):
     self._logger = LogManager.get_logger(__name__)
     # Only log debug messages if they are specifically requested.
     if self._is_debugging_rpc():
         self._simple_thread_ids = {}
         self._id_generation_lock = threading.Lock()
         self._logger.setLevel(logging.DEBUG)
     else:
         self._logger.setLevel(logging.INFO)
#
# This work is provided "AS IS" and subject to the Shotgun Pipeline Toolkit
# Source Code License included in this distribution package. See LICENSE.
# By accessing, using, copying or modifying this work you indicate your
# agreement to the Shotgun Pipeline Toolkit Source Code License. All rights
# not expressly granted therein are reserved by Shotgun Software Inc.

"""
Implements communication channels between the desktop app and the background process.
"""

from .rpc import RPCServerThread, RPCProxy

from sgtk import LogManager

logger = LogManager.get_logger(__name__)


class CommunicationBase(object):
    """
    Communication channel base class.
    """

    def __init__(self, engine):
        """
        :param engine: Toolkit engine.
        """
        self._engine = engine
        self._msg_server = None
        self._proxy = None
Beispiel #3
0
# CONFIDENTIAL AND PROPRIETARY
#
# This work is provided "AS IS" and subject to the Shotgun Pipeline Toolkit
# Source Code License included in this distribution package. See LICENSE.
# By accessing, using, copying or modifying this work you indicate your
# agreement to the Shotgun Pipeline Toolkit Source Code License. All rights
# not expressly granted therein are reserved by Shotgun Software Inc.

import sys

import sgtk
import traceback
from sgtk.platform import Engine
from sgtk import LogManager

logger = LogManager.get_logger(__file__)

previous_except_hook = sys.excepthook


def unhandled_exception_handler(exc_type, exc_value, exc_traceback):
    """
    Unhandled exception handler.

    When this file gets loaded, we ensure that both the site desktop and project
    desktop will see any unexpected errors be logged to disk and in the GUI.

    This sort of error typically happens when an error is thrown from a Qt
    application's slot and doesn't get handled.
    """
    # Calls any previous exception handler. By default, this will invoke the
Beispiel #4
0
#
# This work is provided "AS IS" and subject to the Shotgun Pipeline Toolkit
# Source Code License included in this distribution package. See LICENSE.
# By accessing, using, copying or modifying this work you indicate your
# agreement to the Shotgun Pipeline Toolkit Source Code License. All rights
# not expressly granted therein are reserved by Shotgun Software Inc.

import sys, os, logging

import sgtk
from sgtk import constants
from sgtk import LogManager

# the logger used by this file is sgtk.tank_cmd
app_name = "shotgun_publish"
logger = LogManager.get_logger(app_name)


def init_logging():
    """
    Initialize logging
    """
    global logger, formatter

    # set up std toolkit logging to file
    LogManager().initialize_base_file_handler(app_name)

    # set up output of all sgtk log messages to stdout
    handler = logging.StreamHandler(sys.stdout)
    LogManager().initialize_custom_handler(handler)
Beispiel #5
0
this_folder = os.path.abspath(os.path.dirname(__file__))
python_folder = os.path.abspath(os.path.join(this_folder, "..", "python"))
sys.path.append(python_folder)

# sgtk imports
from sgtk import LogManager
from sgtk.util import filesystem
from sgtk.descriptor import Descriptor, create_descriptor

from utils import (
    cache_apps, authenticate, add_authentication_options, OptionParserLineBreakingEpilog, cleanup_bundle_cache,
    wipe_folder
)

# set up logging
logger = LogManager.get_logger("build_plugin")

# the folder where all items will be cached
BUNDLE_CACHE_ROOT_FOLDER_NAME = "bundle_cache"


def _build_bundle_cache(sg_connection, target_path, config_descriptor_uri):
    """
    Perform a build of the bundle cache.

    This will build the bundle cache for a given config descriptor.

    :param sg_connection: Shotgun connection
    :param target_path: Path to build
    :param config_descriptor_uri: Descriptor of the configuration to cache.
    """
# add sgtk API
this_folder = os.path.abspath(os.path.dirname(__file__))
python_folder = os.path.abspath(os.path.join(this_folder, "..", "python"))
sys.path.append(python_folder)

# sgtk imports
from sgtk import LogManager
from sgtk.util import filesystem
from sgtk.descriptor import Descriptor, create_descriptor, is_descriptor_version_missing

from utils import (
    cache_apps, authenticate, add_authentication_options, OptionParserLineBreakingEpilog, cleanup_bundle_cache
)

# set up logging
logger = LogManager.get_logger("populate_bundle_cache")

# the folder where all items will be cached
BUNDLE_CACHE_ROOT_FOLDER_NAME = "bundle_cache"


def _build_bundle_cache(sg_connection, target_path, config_descriptor_uri):
    """
    Perform a build of the bundle cache.

    This will build the bundle cache for a given config descriptor.

    :param sg_connection: Shotgun connection
    :param target_path: Path to build
    :param config_descriptor_uri: Descriptor of the configuration to cache.
    """