def getServerName(self):
     '''
     Returns the FQDN of the job submission host
     '''
     ##serverName should be already set by the connect function, but
     # if not, use pbs_default as a fallback option.
     if not self.serverName:
         self.serverName = pbs.pbs_default()
     ##Call our parent function's equivalent function as specified by the
     # ClusterDriver template for overridden methods.
     super(TorqueDriver, self).getServerName()
    def dumpDetails(self):
        pbs_server = pbs.pbs_default()
        if not pbs_server:
            print "No default pbs server"
            sys.exit(1)

        nodes = pbs.pbs_statnode(self.con, "", "NULL", "NULL")

        for node in nodes:
            print node.name
            for attrib in node.attribs:
                print '\t', attrib.name, '=', attrib.value
 def connect(self, host=None):
     try:
         if host == None:
             pbs_server = pbs.pbs_default()
             #print "pbs_server is %s" % pbs_server
         else:
             pbs_server = host
         self.con = pbs.pbs_connect(pbs_server)
         if self.con > 0:    #Fail is -1, Success is 1
             self.connectionStatus = 'Connected'
             self.serverName = pbs_server
             print "Connected to %s" % self.serverName
         else:
             raise Exception("Unable to connect to Torque/PBS Server")
     except Exception, e:
         print e
         sys.exit(0) ##Quit the program - we won't be able to speak to the Resource Manager.