made cocluto work with simpaweb running on flask

This commit is contained in:
Guillaume Raffy 2022-01-28 23:39:39 +01:00
parent c7fa99064f
commit a65c2fbc3f
9 changed files with 28 additions and 28 deletions

View File

@ -1,4 +1,4 @@
from Log import * from .Log import *
class JobsState: class JobsState:
""" """

View File

@ -6,7 +6,7 @@ gLogFilePath = '/tmp/ClusterController.log'#'/var/log/ClusterController.log'
def log( message ): def log( message ):
threadName = threading.currentThread().getName() threadName = threading.currentThread().getName()
logMessage = time.asctime(time.localtime())+' : '+ threadName + ' : ' + message logMessage = time.asctime(time.localtime())+' : '+ threadName + ' : ' + message
print logMessage print(logMessage)
f = open(gLogFilePath, 'a+') f = open(gLogFilePath, 'a+')
assert( f ) assert( f )
try: try:

View File

@ -1,10 +1,10 @@
import StringIO import io
import re import re
from JobsState import * from .JobsState import *
from QueueMachine import * from .QueueMachine import *
from Util import * from .Util import *
from Log import * from .Log import *
from Job import * from .Job import *
class QstatParser: class QstatParser:
def parseJobState( self, strJobStatus ): def parseJobState( self, strJobStatus ):
@ -95,7 +95,7 @@ class QstatParser:
qstatOutput = re.sub('\.univ[^ ]*', '.univ-rennes1.fr', qstatOutput) qstatOutput = re.sub('\.univ[^ ]*', '.univ-rennes1.fr', qstatOutput)
jobsState = JobsState() jobsState = JobsState()
f = StringIO.StringIO(qstatOutput) f = io.StringIO(qstatOutput)
line = f.readline() line = f.readline()
currentQueueMachine = None currentQueueMachine = None
bInPendingJobsSection = False bInPendingJobsSection = False
@ -208,7 +208,7 @@ class QstatParser:
matchObj = re.match('^[#]+$', line) matchObj = re.match('^[#]+$', line)
if not matchObj: if not matchObj:
# unexpected line # unexpected line
print 'line = "' + line + '"' print('line = "' + line + '"')
assert( False ) assert( False )
None None
line = f.readline() line = f.readline()
@ -218,7 +218,7 @@ class QstatParser:
""" """
adds to job the details parsed from the output of the "qstat -j <jobid>" command adds to job the details parsed from the output of the "qstat -j <jobid>" command
""" """
f = StringIO.StringIO(qstatOutput) f = io.StringIO(qstatOutput)
line = f.readline() line = f.readline()
fieldRegularExp = re.compile( '^(?P<fieldName>[^:]+):[ ]+(?P<fieldValue>[?]*)$' ) fieldRegularExp = re.compile( '^(?P<fieldName>[^:]+):[ ]+(?P<fieldValue>[?]*)$' )
while( len(line) > 0 ): while( len(line) > 0 ):

View File

@ -1,9 +1,9 @@
import Lib.Util #import .Util
import Lib.SimpaDbUtil #import ..SimpaDbUtil
from Log import * from .Log import *
from PowerState import * from .PowerState import *
import re import re
import StringIO import io
import os import os
import traceback import traceback
import sys import sys
@ -91,7 +91,7 @@ def getPowerState( machineName ):
elif strAcpiState == 'S5/G2': # soft-off elif strAcpiState == 'S5/G2': # soft-off
ePowerState = PowerState.OFF ePowerState = PowerState.OFF
else: else:
print strAcpiState print(strAcpiState)
assert( False ) assert( False )
bPowerStateRead = True bPowerStateRead = True
else: else:
@ -207,7 +207,7 @@ def onException(exception):
strExceptionType = type( exception ) strExceptionType = type( exception )
strMessage = 'exception %s : %s\n' % (strExceptionType, exception.message) strMessage = 'exception %s : %s\n' % (strExceptionType, exception.message)
#traceback.print_last() #traceback.print_last()
f = StringIO.StringIO() f = io.StringIO()
traceback.print_exc(file=f) traceback.print_exc(file=f)
strMessage += f.getvalue() strMessage += f.getvalue()
f.close() f.close()

View File

@ -1,4 +1,4 @@
import StringIO import io
import re import re
from Sensor import FanSensor, TemperatureSensor from Sensor import FanSensor, TemperatureSensor
from ClusterNodeSensorsReadings import ClusterNodeSensorsReadings from ClusterNodeSensorsReadings import ClusterNodeSensorsReadings
@ -6,7 +6,7 @@ from ClusterNodeSensorsReadings import ClusterNodeSensorsReadings
class IpmiTool202Parser: class IpmiTool202Parser:
def parseSensorOutput( self, strOutput, clusterNodeName ): def parseSensorOutput( self, strOutput, clusterNodeName ):
sensorReadings=ClusterNodeSensorsReadings(clusterNodeName) sensorReadings=ClusterNodeSensorsReadings(clusterNodeName)
f = StringIO.StringIO(strOutput) f = io.StringIO(strOutput)
line = f.readline() line = f.readline()
while( len(line) > 0 ): while( len(line) > 0 ):
#print line, #print line,

View File

@ -1,4 +1,4 @@
import StringIO import io
import re import re
from Sensor import FanSensor, TemperatureSensor from Sensor import FanSensor, TemperatureSensor
from ClusterNodeSensorsReadings import ClusterNodeSensorsReadings from ClusterNodeSensorsReadings import ClusterNodeSensorsReadings
@ -6,7 +6,7 @@ from ClusterNodeSensorsReadings import ClusterNodeSensorsReadings
class IpmiTool218Parser: class IpmiTool218Parser:
def parseSensorOutput( self, strOutput, clusterNodeName ): def parseSensorOutput( self, strOutput, clusterNodeName ):
sensorReadings=ClusterNodeSensorsReadings(clusterNodeName) sensorReadings=ClusterNodeSensorsReadings(clusterNodeName)
f = StringIO.StringIO(strOutput) f = io.StringIO(strOutput)
line = f.readline() line = f.readline()
while( len(line) > 0 ): while( len(line) > 0 ):
#print line, #print line,

View File

@ -1,4 +1,4 @@
import MySQLdb # sudo port install py-mysql; sudo apt install python-mysqldb import MySQLdb # sudo port install py-mysql; sudo apt install python-mysqldb or pip install mysqlclient
import time import time
import sys import sys
if sys.version_info < (3, 0): if sys.version_info < (3, 0):
@ -6,12 +6,12 @@ if sys.version_info < (3, 0):
else: else:
from io import StringIO from io import StringIO
import re import re
from wol import * from .wol import *
import os import os
from Util import * from .Util import *
import abc import abc
import sqlite3 import sqlite3
from mysql2sqlite import mysql_to_sqlite from .mysql2sqlite import mysql_to_sqlite
def isMachineResponding(machineName): def isMachineResponding(machineName):

View File

@ -1,6 +1,6 @@
import time import time
import subprocess import subprocess
# import StringIO import io
import re import re
# from wol import * # from wol import *
# import os # import os

View File

@ -1,7 +1,7 @@
# encoding: utf-8 # encoding: utf-8
import datetime import datetime
# from Lib import SimpaDbUtil # from Lib import SimpaDbUtil
import SimpaDbUtil from . import SimpaDbUtil
class MachineSpecIdNotFound(Exception): class MachineSpecIdNotFound(Exception):