コード例 #1
0
 def QueueTime(self, value, description=r''):
     if type(value) == str:
         realvalue = value
     else:
         realvalue = TimeToString(time.gmtime(value))
     self.RecordData = self.AddToList(self.RecordData, 'QueueTime',
                                      self.Description(description),
                                      realvalue)
コード例 #2
0
    def __init__(self, resourceType=None):

        # See the function ResourceType for details on the
        # parameter

        super(self.__class__, self).__init__()
        DebugPrint(1, 'Creating a UsageRecord ' + TimeToString())
        self.JobId = []
        self.UserId = []
        self.Username = '******'
        self.__ResourceType = resourceType
コード例 #3
0
    def TimeInstant(
        self,
        value,
        timetype,
        description=r'',
    ):
        ''' Additional identified discrete time that is relevant to the reported usage '''

        if type(value) == str:
            realvalue = value
        else:
            realvalue = TimeToString(time.gmtime(value))
        self.AppendToList(self.RecordData, 'TimeInstant',
                          self.Type(timetype) + self.Description(description),
                          realvalue)
コード例 #4
0
    def XmlCreate(self):

        self.XmlAddMembers()

        self.XmlData = []
        self.XmlData.append('<?xml version="1.0" encoding="UTF-8"?>\n')
        self.XmlData.append(
            '<JobUsageRecord xmlns="http://www.gridforum.org/2003/ur-wg"\n')
        self.XmlData.append(
            '        xmlns:urwg="http://www.gridforum.org/2003/ur-wg"\n')
        self.XmlData.append(
            '        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" \n')
        self.XmlData.append(
            '        xsi:schemaLocation="http://www.gridforum.org/2003/ur-wg file:///u:/OSG/urwg-schema.11.xsd">\n'
        )

        # Add the record indentity

        self.XmlData.append('<RecordIdentity urwg:recordId="' +
                            socket.getfqdn() + ':' +
                            str(global_state.RecordPid) + '.' +
                            str(record.RecordId) + '" urwg:createTime="' +
                            TimeToString(time.gmtime()) + '" />\n')
        record.RecordId += 1

        if len(self.JobId) > 0:
            self.XmlData.append('<JobIdentity>\n')
            for data in self.JobId:
                self.XmlData.append('\t')
                self.XmlData.append(data)
                self.XmlData.append('\n')
            self.XmlData.append('</JobIdentity>\n')

        if len(self.UserId) > 0:
            self.VerifyUserInfo(
            )  # Add VOName and Reportable VOName if necessary.
            self.XmlData.append('<UserIdentity>\n')
            for data in self.UserId:
                self.XmlData.append('\t')
                self.XmlData.append(data)
                self.XmlData.append('\n')
            self.XmlData.append('</UserIdentity>\n')
        for data in self.RecordData:
            self.XmlData.append('\t')
            self.XmlData.append(data)
            self.XmlData.append('\n')
        self.XmlData.append('</JobUsageRecord>\n')