def __init__(self,
                    command,
                    timeout,
                    display_shell,
                    identifier,
                    priority,
                    frame,
                    log_exitcode_errors_only,
                    renderthreads_node):
        """
        Customize RenderCommand instance.
        Parameter timeout is in seconds NOT in ms.
        """

        # super and objectName
        # ------------------------------------------------------------------
        # parent_class
        self.parent_class = super(RenderCommand, self)
        self.parent_class.__init__()

        self.setObjectName(self.__class__.__name__)

        # instance variables
        # ------------------------------------------------------------------

        # command
        self.command = command
        # timeout
        self.timeout = timeout
        # display_shell
        self.display_shell = display_shell
        # identifier
        self.identifier = identifier  # nuke node full name
        # priority
        self.priority = priority
        # frame
        self.frame = frame
        # log_exitcode_errors_only
        self.log_exitcode_errors_only = log_exitcode_errors_only
        # renderthreads_node
        self.renderthreads_node = renderthreads_node  # only used for readd_job in main wdgt

        # process
        self.process = None
        # enabled
        self.enabled = True
        # readd_count
        self.readd_count = 0

        # logger_name
        self.logger_name = '{0}-{1}-{2}'.format(self.__class__.__name__, identifier, frame)
        # logger
        self.logger = renderthreads_logging.get_logger(self.logger_name)
Example #2
0
    def __init__(self, command, timeout, display_shell, identifier, priority,
                 frame, log_exitcode_errors_only, renderthreads_node):
        """
        Customize RenderCommand instance.
        Parameter timeout is in seconds NOT in ms.
        """

        # super and objectName
        # ------------------------------------------------------------------
        # parent_class
        self.parent_class = super(RenderCommand, self)
        self.parent_class.__init__()

        self.setObjectName(self.__class__.__name__)

        # instance variables
        # ------------------------------------------------------------------

        # command
        self.command = command
        # timeout
        self.timeout = timeout
        # display_shell
        self.display_shell = display_shell
        # identifier
        self.identifier = identifier  # nuke node full name
        # priority
        self.priority = priority
        # frame
        self.frame = frame
        # log_exitcode_errors_only
        self.log_exitcode_errors_only = log_exitcode_errors_only
        # renderthreads_node
        self.renderthreads_node = renderthreads_node  # only used for readd_job in main wdgt

        # process
        self.process = None
        # enabled
        self.enabled = True
        # readd_count
        self.readd_count = 0

        # logger_name
        self.logger_name = '{0}-{1}-{2}'.format(self.__class__.__name__,
                                                identifier, frame)
        # logger
        self.logger = renderthreads_logging.get_logger(self.logger_name)
    def __init__(self,
                    set_thread_count_to_half_of_max=True,
                    queue=None):
        """
        Customize instance.
        """

        # super
        self.parent_class = super(ThreadManager, self)
        self.parent_class.__init__()

        self.setObjectName(self.__class__.__name__)

        # instance variables
        # ------------------------------------------------------------------
        # logger
        self.logger = renderthreads_logging.get_logger(self.__class__.__name__)

        # max_threads
        self.max_threads = determineNumberOfCPUs()

        # thread_count
        self.thread_count = self.max_threads
        # set_thread_count_to_half_of_max
        if (set_thread_count_to_half_of_max and
                self.max_threads > 1):

            # set thread count to half of max
            self.thread_count = int(self.max_threads / 2)

        # thread_list
        self.thread_list = []

        # queue
        self.queue = queue
        if not(self.queue):

            # create
            self.queue = Queue.PriorityQueue()

            # log
            self.logger.debug('No queue passed as argument. Creating queue.')

        # connect
        self.do_update_threads.connect(self.update_threads)
    def __init__(self,
                    set_thread_count_to_half_of_max=True,
                    queue=None):
        """
        Customize instance.
        """

        # super
        self.parent_class = super(ThreadManager, self)
        self.parent_class.__init__()

        self.setObjectName(self.__class__.__name__)

        # instance variables
        # ------------------------------------------------------------------
        # logger
        self.logger = renderthreads_logging.get_logger(self.__class__.__name__)

        # max_threads
        self.max_threads = multiprocessing.cpu_count()

        # thread_count
        self.thread_count = self.max_threads
        # set_thread_count_to_half_of_max
        if (set_thread_count_to_half_of_max and
                self.max_threads > 1):

            # set thread count to half of max
            self.thread_count = int(self.max_threads / 2)

        # thread_list
        self.thread_list = []

        # queue
        self.queue = queue
        if not(self.queue):

            # create
            self.queue = Queue.PriorityQueue()

            # log
            self.logger.debug('No queue passed as argument. Creating queue.')

        # connect
        self.do_update_threads.connect(self.update_threads)
    def __init__(self,
                    queue,
                    thread_id=0,
                    thread_interval=2000):
        """
        WorkerThread thread that watches the queue from within infinite
        run method call. run() is the only method thats actually
        called from within an own thread. All other methods execute
        in the main thread.
        """

        # super
        self.parent_class = super(WorkerThread, self)
        self.parent_class.__init__()

        self.setObjectName(self.__class__.__name__)

        # instance variables
        # ------------------------------------------------------------------
        # queue
        self.queue = queue

        # thread_interval
        self.thread_interval = thread_interval  # ONLY IMPORTANT FOR INITIAL STARTUP INTERVAL. NOT USED AGAIN

        # thread_id
        self.thread_id = thread_id

        # first_execution
        self.first_execution = True

        # timer_created
        self.timer_created = False

        # logger
        self.logger = renderthreads_logging.get_logger(self.__class__.__name__ + ' - ' + str(self.thread_id))

        # Connections
        # ------------------------------------------------------------------

        self.restart.connect(self.on_restart)
        self.setup_timer.connect(self.on_setup_timer)
    def __init__(self,
                    queue,
                    thread_id=0,
                    thread_interval=2000):
        """
        WorkerThread thread that watches the queue from within infinite
        run method call. run() is the only method thats actually
        called from within an own thread. All other methods execute
        in the main thread.
        """

        # super
        self.parent_class = super(WorkerThread, self)
        self.parent_class.__init__()

        self.setObjectName(self.__class__.__name__)

        # instance variables
        # ------------------------------------------------------------------
        # queue
        self.queue = queue

        # thread_interval
        self.thread_interval = thread_interval  # ONLY IMPORTANT FOR INITIAL STARTUP INTERVAL. NOT USED AGAIN

        # thread_id
        self.thread_id = thread_id

        # first_execution
        self.first_execution = True

        # timer_created
        self.timer_created = False

        # logger
        self.logger = renderthreads_logging.get_logger(self.__class__.__name__ + ' - ' + str(self.thread_id))

        # Connections
        # ------------------------------------------------------------------

        self.restart.connect(self.on_restart)
        self.setup_timer.connect(self.on_setup_timer)
# lib.mvc

# renderthreads_node
from mvc import renderthreads_node
if(do_reload):
    reload(renderthreads_node)


# Globals
# ------------------------------------------------------------------


# logger (Module Level)
# ------------------------------------------------------------------
logger = renderthreads_logging.get_logger(__name__)


# MemoryInfo
# ------------------------------------------------------------------
MemoryInfo = collections.namedtuple('MemoryInfo', 'info ram_total ram_in_use total_virtual_memory')


# Scene Interaction
# ------------------------------------------------------------------
def get_nodes(filter_type=None, selected=False):
    """
    Return list of all write nodes in DAG.
    """

    # selected
if (do_reload):
    reload(renderthreads_logging)

# lib.mvc

# renderthreads_node
from mvc import renderthreads_node
if (do_reload):
    reload(renderthreads_node)

# Globals
# ------------------------------------------------------------------

# logger (Module Level)
# ------------------------------------------------------------------
logger = renderthreads_logging.get_logger(__name__)

# MemoryInfo
# ------------------------------------------------------------------
MemoryInfo = collections.namedtuple(
    'MemoryInfo', 'info ram_total ram_in_use total_virtual_memory')


# Scene Interaction
# ------------------------------------------------------------------
def get_nodes(filter_type=None, selected=False):
    """
    Return list of all write nodes in DAG.
    """

    # selected
 def __init__(self, x, y):
     self.x = x
     self.y = y
     self.logger = renderthreads_logging.get_logger(self.__class__.__name__)
 def __init__(self, x, y):
     self.x = x
     self.y = y
     self.logger = renderthreads_logging.get_logger(self.__class__.__name__)