Exemplo n.º 1
0
    def __init__(self):
        QMainWindow.__init__(self)
        self.setupUi(self)

        #Class Variables
        self.thisNodeName = Utils.myHostName()
        logger.info("This host is %s", self.thisNodeName)
        self.username = Utils.getInfoFromCFG("database", "username")
        self.userFilter = False
        self.showArchivedFilter = False
        self.statusMsg = "ERROR"
        self.currentJobSel = None

        with open(Utils.findResource("styleSheet.css"), "r") as myStyles:
            self.setStyleSheet(myStyles.read())

        #My UI Setup Functions
        self.setupTreeViews()
        self.connectButtons()
        self.setupHotkeys()
        self.setWindowIcon(QIcon(Utils.findResource("Images/FarmView.png")))

        #Make sure this node exists
        self.thisNodeButtonsEnabled = True
        self.thisNodeExists = self.findThisNode()

        #Setup Signals
        SIGNAL("doUpdate")
        QObject.connect(self, SIGNAL("doUpdate"), self.doUpdate)

        #Start autoUpdater and then fetch data from DB
        self.autoUpdateThread = stoppableThread(self.doUpdateSignaler, 10, "AutoUpdate_Thread")
        self.doFetch()
Exemplo n.º 2
0
def heartbeat():
    """Updates a column on the node's database with the current time, signifying
    that the node software is still running."""
    host = Utils.myHostName()
    with transaction() as t:
        t.cur.execute("UPDATE hydra_rendernode SET pulse = NOW() WHERE host = %s",
                    (host,))
Exemplo n.º 3
0
 def getLogPath(self):
     thisHost = Utils.myHostName()
     path = os.path.join(Constants.RENDERLOGDIR, '{:0>10}.log.txt'.format(self.id))
     if thisHost == self.host:
         return path
     else:
         _, shortPath = os.path.splitdrive(path)
         newPath = os.path.join("\\\\{}".format(self.host), shortPath)
         newPath = os.path.normpath(newPath)
         if sys.platform == "win32":
             return "\\{}".format(newPath)
         else:
             return newPath
Exemplo n.º 4
0
def pulse():
    host = Utils.myHostName()
    with transaction() as t:
        t.cur.execute("UPDATE hydra_rendernode SET pulse = NOW() "
                    "WHERE host = '{0}'".format(host))
Exemplo n.º 5
0
"""Registers a node with the database."""
#Standard
import os
import sys

#Third Party
#pylint: disable=E0611
from MySQLdb import IntegrityError

#Hydra
from Setups.LoggingSetup import logger
from Setups.MySQLSetup import hydra_rendernode, OFFLINE, transaction
import Utilities.Utils as Utils

if __name__ == "__main__":
    me = Utils.myHostName()
    hydraPath, execFile = os.path.split(sys.argv[0])
    logger.info(hydraPath)
    response = Utils.changeHydraEnviron(hydraPath)
    if response:
        try:
            with transaction() as t:
                hydra_rendernode(host=me, status=OFFLINE, minPriority=0).insert(t)
        except IntegrityError:
            logger.info("Host %s already exists in the hydra_rendernode table on the databse", me)
    else:
        logger.error("Could not set Hydra Environ! No changes where made. Exiting...")

    raw_input("\nPress enter to exit...")