예제 #1
0
    def __init__(self, year, lines):
        """
        Constructor
        @param year - the year to tag the job with
        @param lines - the strings making up this record
        """
        Record.__init__(self, year, lines)

        pat = "Image size of job updated: (?P<imageSize>[\d]+)"
        
        ## size of the image for this job
        self.imageSize = int(self.extract(pat,lines[0], "imageSize"))
        
        ## memory used by this job in MB
        self.memoryUsageMb = 0
        ## resident size of this job in KB
        self.residentSetSizeKb = 0
        if len(lines) == 3:
            pat = "(?P<memoryUsage>[\d]+)"
            self.memoryUsageMb = int(self.extract(pat,lines[1],"memoryUsage"))
            pat = "(?P<residentSetSize>[\d]+)"
            self.residentSetSizeKb = int(self.extract(pat,lines[2],"residentSetSize"))
        else:
            pat = "(?P<residentSetSize>[\d]+)"
            self.residentSetSizeKb = int(self.extract(pat,lines[1],"residentSetSize"))
    def __init__(self, year, lines):
        """
        Constructor
        @param year - the year to tag the job with
        @param lines - the strings making up this record
        """
        Record.__init__(self, year, lines)

        
        pat = r"Error from (?P<slot>[\w]+@[\d]+@[\w\-.]+): (?P<reason>.+?)($)"
        ## the slot the job was in at the time of this exception
        self.slot = None
        ## the reason for the exception
        self.reason = None
        ## the number of bytes sent
        self.runBytesSent = None
        ## the number of bytes received
        self.runBytesReceived = None
        if re.search(pat,lines[1]) is not None:
            values = self.extractValues(pat,lines[1])
            self.slot = values["slot"]
            self.reason = values["reason"].strip()
            pat = r"(?P<bytes>\d+) "
            self.runBytesSent = int(self.extract(pat,lines[2],"bytes"))
            self.runBytesReceived = int(self.extract(pat,lines[3],"bytes"))
        else:
            self.reason = lines[1].strip()
            pat = r"(?P<bytes>[\d]+)"
            self.runBytesSent = int(self.extract(pat,lines[2],"bytes"))
            self.runBytesReceived = int(self.extract(pat,lines[3],"bytes"))
예제 #3
0
 def __init__(self, pathtorecord):
     Record.__init__(self, pathtorecord)
     self.service = "names"
     self.solrizer = self.nameXSLT
     self._solrDoc = None
     self.canonical_field = 'id'
     self._canonicalURI = None
 def __init__(self, year, lines):
     """
     Constructor
     @param year - the year to tag the job with
     @param lines - the strings making up this record
     """
     Record.__init__(self, year, lines)
예제 #5
0
    def __init__(self, year, lines):
        """
        Constructor
        @param year - the year to tag the job with
        @param lines - the strings making up this record
        """
        Record.__init__(self, year, lines)

        ## reason for eviction
        self.reason = lines[1].strip()



        pat = r"\((?P<term>\d+)\) Job was not checkpointed."

        ## termination code
        self.term = self.extract(pat, lines[1], "term")

        userRunRemoteUsage, sysRunRemoteUsage = self.extractUsrSysTimes(lines[2])
        ## remote user run usage time
        self.userRunRemoteUsage = userRunRemoteUsage
        ## remote sys run usage time
        self.sysRunRemoteUsage = sysRunRemoteUsage

        userRunLocalUsage, sysRunLocalUsage  = self.extractUsrSysTimes(lines[3])

        ## local user run usage time
        self.userRunLocalUsage = userRunLocalUsage
        ## local sys run usage time
        self.sysRunLocalUsage  = sysRunLocalUsage

        pat = r"(?P<bytes>\d+) "
        ## bytes sent during the run
        self.runBytesSent = int(self.extract(pat,lines[4], "bytes"))
        ## bytes received during the run
        self.runBytesReceived = int(self.extract(pat,lines[5], "bytes"))


        pat = r"Partitionable Resources :\s+Usage\s+\Request\s+Allocated$"

        ## disk usage
        self.diskUsage = None

        ## disk requested
        self.diskRequest = None

        ## memory usage
        self.memoryUsage = None

        ## memory requested
        self.memoryRequest = None

        ret = re.search(pat, lines[6])
        if ret is None:
            self.diskUsage, self.diskRequest = self.extractUsageRequest(lines[8])
            self.memoryUsage, self.memoryRequest = self.extractUsageRequest(lines[9])
        else:
            self.diskUsage, self.diskRequest, allocated = self.extractUsageRequestAllocated(lines[8])
            self.memoryUsage, self.memoryRequest, allocated = self.extractUsageRequestAllocated(lines[9])
    def __init__(self):
        QWidget.__init__(self)
        Record.__init__(self)
        threading.Thread.__init__(self)
        
#         self.record = Record()
        self.btn_begin_record = QtGui.QPushButton(self)
        self.btn_stop_record = QtGui.QPushButton(self)
        self.btn_sel_save_dir= QtGui.QPushButton(self)
        self.btn_postfix= QtGui.QPushButton(self)
        self.layout= QtGui.QGridLayout(self)
        self.lin_show_dir= QtGui.QLineEdit(self)
        self.lab_save_file_dir= QtGui.QLabel(self)
        self.lab_save_name= QtGui.QLabel(self)
        self.lin_save_name= QtGui.QLineEdit(self)
        self.lab_begin_record_time= QtGui.QLabel(self)
        self.lin_begin_record_time= QtGui.QLineEdit(self)
        self.lab_stop_record_time= QtGui.QLabel(self)
        self.lin_stop_record_time= QtGui.QLineEdit(self)
        self.lin_record_time= QtGui.QLineEdit(self)
        self.lab_show_record_time= QtGui.QLabel(self)
        self.record_time=0
        self.lab_begin_record_time.setText(u'开始录音时间:')
        self.lab_stop_record_time.setText(u'停止录音时间:')
        self.btn_begin_record.setText(u'开始录音')
        self.btn_stop_record.setText(u'停止录音')
        self.btn_sel_save_dir.setText(u'...')
        self.btn_postfix.setText(u'.wav')
        self.lab_save_file_dir.setText(u'录音保存路径:')
        self.lab_save_name.setText(u'录音保存名字:')
        self.lab_show_record_time.setText(u'录音时长:')
        self.lin_show_dir.setText(os.getcwd())
        self.btn_begin_record.setFixedWidth(120)
        self.btn_stop_record.setFixedWidth(120)
        self.lab_save_file_dir.setFixedWidth(120)
        self.btn_sel_save_dir.setFixedWidth(20)
        
        self.layout.addWidget(self.lab_save_file_dir,0,0,1,1)
        self.layout.addWidget(self.lin_show_dir,0,1,1,1)
        self.layout.addWidget(self.btn_sel_save_dir,0,2,1,1)
        self.layout.addWidget(self.lab_save_name,1,0,1,1)
        self.layout.addWidget(self.lin_save_name,1,1,1,1)
        self.layout.addWidget(self.btn_postfix,1,2,1,1)
        self.layout.addWidget(self.lab_begin_record_time,2,0,1,1)
        self.layout.addWidget(self.lin_begin_record_time,2,1,1,1)
        self.layout.addWidget(self.lab_stop_record_time,3,0,1,1)
        self.layout.addWidget(self.lin_stop_record_time,3,1,1,1)
        self.layout.addWidget(self.lab_show_record_time,4,0,1,1)
        self.layout.addWidget(self.lin_record_time,4,1,1,1)
        self.layout.addWidget(self.btn_begin_record,5,0,1,1)
        self.layout.addWidget(self.btn_stop_record,5,1,1,1)
        self.setLayout(self.layout)
        
        QtCore.QObject.connect(self.btn_sel_save_dir, QtCore.SIGNAL(QtCore.QString.fromUtf8("clicked()")),self.onSelectDir)
        QtCore.QObject.connect(self.btn_begin_record, QtCore.SIGNAL(QtCore.QString.fromUtf8("clicked()")),self.onBeginRecord)
        QtCore.QObject.connect(self.btn_stop_record, QtCore.SIGNAL(QtCore.QString.fromUtf8("clicked()")),self.onStopRecord)
        QtCore.QMetaObject.connectSlotsByName(self)
예제 #7
0
 def __init__(self, record=None):
     Record.__init__(self, 'application/vnd.bluetooth.ep.oob')
     self.device_address = '00:00:00:00:00:00'
     self.eir = dict()
     if record is not None:
         if not record.type == self.type:
             raise ValueError("record type mismatch")
         self.name = record.name
         self.data = record.data
 def __init__(self, year, lines):
     """
     Constructor
     @param year - the year to tag the job with
     @param lines - the strings making up this record
     """
     Record.__init__(self, year, lines)
     ## the reason for the failure
     self.reason = lines[1].strip()+";"+lines[2].strip()
예제 #9
0
 def __init__(self, record=None):
     Record.__init__(self, 'application/vnd.bluetooth.ep.oob')
     self.device_address = '00:00:00:00:00:00'
     self.eir = dict()
     if record is not None:
         if not record.type == self.type:
             raise ValueError("record type mismatch")
         self.name = record.name
         self.data = record.data
예제 #10
0
    def __init__(self, year, lines):
        """
        Constructor
        @param year - the year to tag the job with
        @param lines - the strings making up this record
        """
        Record.__init__(self, year, lines)

        pat = r"\<(?P<hostAddr>\S+)\>"

        values = re.search(pat,lines[0]).groupdict()
        ## internet address of the host
        self.executingHostAddr = values["hostAddr"]
예제 #11
0
 def __init__(self, record=None):
     Record.__init__(self, 'application/vnd.wfa.wsc')
     self._version = '\x20'
     self._passwords = list()
     self._other = list()
     if record:
         if not record.type == self.type:
             raise ValueError("record type mismatch")
         self.name = record.name
         self.data = record.data
     else:
         self._passwords.append({
                 'public-key-hash': 20 * '\x00',
                 'password-id' : 0,
                 'password' : '',
                 })
예제 #12
0
 def __init__(self, record=None):
     Record.__init__(self, 'application/vnd.wfa.wsc')
     self._version = '\x20'
     self._passwords = list()
     self._other = list()
     if record:
         if not record.type == self.type:
             raise ValueError("record type mismatch")
         self.name = record.name
         self.data = record.data
     else:
         self._passwords.append({
                 'public-key-hash': 20 * '\x00',
                 'password-id' : 0,
                 'password' : '',
                 })
예제 #13
0
 def __init__(self, record=None):
     Record.__init__(self, 'application/vnd.wfa.wsc')
     self._version = '\x20'
     self._credentials = list()
     self._other = list()
     if record:
         if not record.type == self.type:
             raise ValueError("record type mismatch")
         self.name = record.name
         self.data = record.data
     else:
         self._credentials.append({
                 'network-name': '',
                 'authentication' : 'Open',
                 'encryption' : 'None',
                 'network-key' : '',
                 'mac-address' : 'ff:ff:ff:ff:ff:ff'
                 })
예제 #14
0
 def __init__(self, record=None):
     Record.__init__(self, 'application/vnd.wfa.wsc')
     self._version = '\x20'
     self._credentials = list()
     self._other = list()
     if record:
         if not record.type == self.type:
             raise ValueError("record type mismatch")
         self.name = record.name
         self.data = record.data
     else:
         self._credentials.append({
                 'network-name': '',
                 'authentication' : 'Open',
                 'encryption' : 'None',
                 'network-key' : '',
                 'mac-address' : 'ff:ff:ff:ff:ff:ff'
                 })
예제 #15
0
    def __init__(self, year, lines):
        """
        Constructor
        @param year - the year to tag the job with
        @param lines - the strings making up this record
        """
        Record.__init__(self, year, lines)
        
        pat = r"\<(?P<hostAddr>\d+.\d+.\d+.\d+:\d+.+)\>"

        values = re.search(pat,lines[0]).groupdict()
        ## the submitted host's network address
        self.submitHostAddr = values["hostAddr"]

        if len(lines) > 1:
            pat = "DAG Node: (?P<dagNode>\w+)"
            values = re.search(pat,lines[1]).groupdict()
            ## the DAG node that's being worked on
            self.dagNode = values["dagNode"]
        else:
            self.dagNode = None
    def __init__(self, year, lines):
        """
        Constructor
        @param year - the year to tag the job with
        @param lines - the strings making up this record
        """
        Record.__init__(self, year, lines)


        ## slot name in which this job is running
        self.slotName = None
        pat = r"MachineSlotName = \"(?P<slotname>\S+)\""
        for line in lines:
            if line.startswith("MachineSlotName"):
                values = re.search(pat,line).groupdict()
                self.slotName = values["slotname"]
                if self.slotName == "$$(Name)":
                    self.slotName = None
                else:
                    self.slotName = self.slotName.split("@")[0]
                return
예제 #17
0
    def __init__(self):
        '''Provide the necessary lists containing message information.'''

        Record.__init__(self)

        # Fields which are required by the message format.
        self._mandatory_fields = ["VMUUID", "SiteName", "MachineName"]

        # This list allows us to specify the order of lines when we construct records.
        self._msg_fields = [
            "VMUUID", "SiteName", "CloudComputeService", "MachineName",
            "LocalUserId", "LocalGroupId", "GlobalUserName", "FQAN", "Status",
            "StartTime", "EndTime", "SuspendDuration", "WallDuration",
            "CpuDuration", "CpuCount", "NetworkType", "NetworkInbound",
            "NetworkOutbound", "PublicIPCount", "Memory", "Disk",
            "BenchmarkType", "Benchmark", "StorageRecordId", "ImageId",
            "CloudType", "IPv4Count", "IPv6Count", 'SuspendTime',
            "StorageUsage", "CpuChange"
        ]

        # This list specifies the information that goes in the database.
        self._db_fields = self._msg_fields[:9] + ['VO', 'VOGroup', 'VORole'
                                                  ] + self._msg_fields[9:]
        self._all_fields = self._db_fields

        self._ignored_fields = [
            "UpdateTime", "StorageUsage", "CpuChange", "IPv4Count", "IPv6Count"
        ]

        # Fields which will have an integer stored in them
        self._int_fields = [
            "SuspendDuration", "WallDuration", "CpuDuration", "CpuCount",
            "NetworkInbound", "NetworkOutbound", "PublicIPCount", "Memory",
            "Disk", "StorageUsage", "StartTime", "EndTime", "IPv4Count",
            "IPv6Count", "CpuChange", "SuspendTime"
        ]

        self._float_fields = ['Benchmark']
        self._datetime_fields = []
        CloudRecord.all_records.append(self)
예제 #18
0
    def __init__(self):
        Record.__init__(self)
        self._mandatory_fields = [
            "MeasurementTime", "SiteName", "CloudType", "LocalUser",
            "LocalGroup", "GlobalUserName", "FQAN", "IPVersion", "IPCount"
        ]
        self._msg_fields = [
            "MeasurementTime", "SiteName", "CloudType", "LocalUser",
            "LocalGroup", "GlobalUserName", "FQAN", "IPVersion", "IPCount",
            "CloudComputeService"
        ]

        self._all_fields = self._msg_fields
        self._db_fields = self._msg_fields

        self._int_fields = [
            "IpCount",
        ]
        self._unix_timestamp_fields = [
            "MeasurementTime",
        ]
        PublicIpUsageRecord.all_records.append(self)
예제 #19
0
 def __init__(self, pathtorecord):
     Record.__init__(self, pathtorecord)
     self.service = "collections"
     self.solrizer = self.collectionXSLT
     self._canonicalURI = None
     # generate the solrDoc
     p1 = Popen([
         "java", "-Xmx16G", "-jar", self.saxon, "-s:" + self.recordPath,
         "-xsl:" + self.enhancer, "scope=set", "base-uri=" + self.baseURI
     ],
                stdout=PIPE)
     p2 = Popen([
         "java", "-Xmx60G", "-jar", self.saxon, "-xsl:" + self.solrizer, "-"
     ],
                stdin=p1.stdout,
                stdout=PIPE,
                stderr=PIPE)
     p1.stdout.close()
     p2out, p2err = p2.communicate()
     if p2.returncode == 0:
         self._solrDoc = p2out.decode("utf-8")
     else:
         logging.error("XSLT failed: {}".format(p2err))
         self._solrDoc = None
예제 #20
0
 def __init__(self, pathtorecord):
     Record.__init__(self, pathtorecord)
     self.service = "folders"
예제 #21
0
 def __init__(self, id):
     Record.__init__(self, db.getInstance(), 'messages', id)
예제 #22
0
 def __init__(self, id):
     Record.__init__(self, db.getInstance(), 'schools', id)
     self._loadAdditionalData()
예제 #23
0
    def __init__(self, year, lines):
        """
        Constructor
        """
        Record.__init__(self, year, lines)

        pat = r"\((?P<term>\d+)\) Normal termination \(return value (?P<returnValue>\d+)\)"

        # the pairs below are split this way because of doxygen complaints
        term, returnValue = self.extractPair(pat, lines[1], "term", "returnValue")
        ## termination reason
        self.term = term 
        ## return value of terminated process
        self.returnValue = returnValue

        userRunRemoteUsage, sysRunRemoteUsage = self.extractUsrSysTimes(lines[2])
        ## remote user usage time
        self.userRunRemoteUsage = userRunRemoteUsage
        ## remote system usage time
        self.sysRunRemoteUsage = sysRunRemoteUsage

        userRunLocalUsage,  sysRunLocalUsage  = self.extractUsrSysTimes(lines[3])
        ## local user usage time
        self.userRunLocalUsage = userRunLocalUsage
        ## local system usage time
        self.sysRunLocalUsage = sysRunLocalUsage

        userTotalRemoteUsage, sysTotalRemoteUsage = self.extractUsrSysTimes(lines[4])
        ## total user remote usage time
        self.userTotalRemoteUsage = userTotalRemoteUsage
        ## total system remote usage time
        self.sysTotalRemoteUsage = sysTotalRemoteUsage

        userTotalLocalUsage,  sysTotalLocalUsage  = self.extractUsrSysTimes(lines[5])
        ## total user local usage time
        self.userTotalLocalUsage = userTotalLocalUsage
        ## total system local usage time
        self.sysTotalLocalUsage  = sysTotalLocalUsage

        pat = r"(?P<bytes>\d+) "
        ## run bytes sent by job
        self.runBytesSent = int(self.extract(pat,lines[6], "bytes"))
        ## run bytes received by job
        self.runBytesReceived = int(self.extract(pat,lines[7], "bytes"))
        ## total bytes sent by job
        self.totalBytesSent = int(self.extract(pat,lines[8], "bytes"))
        ## total bytes received by job
        self.totalBytesReceived = int(self.extract(pat,lines[9], "bytes"))

        pat = r"Partitionable Resources :\s+Usage\s+\Request\s+Allocated$"

        ## disk usage
        self.diskUsage = None

        ## disk requested
        self.diskRequest = None

        ## memory usage
        self.memoryUsage = None

        ## memory requested
        self.memoryRequest = None

        ret = re.search(pat, lines[10])
        if ret is None:
            self.diskUsage, self.diskRequest = self.extractUsageRequest(lines[12])
            self.memoryUsage, self.memoryRequest = self.extractUsageRequest(lines[13])
        else:
            self.diskUsage, self.diskRequest, allocated = self.extractUsageRequestAllocated(lines[12])
            self.memoryUsage, self.memoryRequest, allocated = self.extractUsageRequestAllocated(lines[13])
예제 #24
0
 def __init__(self, session, values=None):
     Record.__init__(self, session, package_table, values=values)
예제 #25
0
 def __init__(self, id):
     Record.__init__(self, db.getInstance(), 'likes', id)
예제 #26
0
 def __init__(self, id):
     self.db = db.getInstance()
     self.conf = conf.getInstance()
     Record.__init__(self, self.db, 'messages', id)