Пример #1
0
 def __str__(self):
     st = "\t<Event id=\"%s\">\n"%self.getEventId()
     try:
         type1, type2 = self.type
         if type1=="Started":
             ptype = "Input"
         else:
             ptype = "Output"
         st += "\t\t<%sName>%s</%sName>\n"%(type2, self.name, type2)
         st += "\t\t<%sId>%s</%sId>\n"%(type2, self.id, type2)
         st += "\t\t<EventType>%s%s</EventType>\n"%self.type
         st += "\t\t<Time>%s</Time>\n"%self._time
         st += "\t\t<ParentId>%s</ParentId>\n"%self.parent
         if self.parameters is not None:
             st += "\t\t<%sParameters>\n"%ptype
             for p in self.parameters:
                 (key, value) = p
                 st += "\t\t\t<Parameter>\n"
                 st += "\t\t\t\t<Name>%s</Name>\n"%key
                 st += "\t\t\t\t<Value><![CDATA[%s]]></Value>\n"%format_string("%s", (value,))                
                 st += "\t\t\t</Parameter>\n"
             st += "\t\t</%sParameters>\n"%ptype
         if self.status:
             st += "\t\t<Status>%s</Status>\n"%self.status
         if self.failuretype:
             st += "\t\t<FailureType>%s</FailureType>\n"%self.failuretype
         if self.statusdata:
             st += "\t\t<StatusData>%s</StatusData>\n"%self.statusdata
     except:
         pass
     st += "\t</Event>\n"
     return st
Пример #2
0
def prin(format, args):
    """Print implementation for the print task.
    By default prints to stdout, but if set_print_log_file
    is called, output can be directed to a log file as well.
    Returns the printed string or " " if there was no problem
    and returns False if there was an error."""
    done = False
    try:
        print_str = format_string(format, args)
        print print_str
        if log_file is not None:
            log_file.write(print_str + '\n')
        done = print_str or " "  # ensures done is treated as true
    finally:
        if not done:
            print "ERROR IN PRINT ACTION: format=%r, args=%r" % (format, args)
    return done
Пример #3
0
def prin(format, args):
    """Print implementation for the print task.
    By default prints to stdout, but if set_print_log_file
    is called, output can be directed to a log file as well.
    Returns the printed string or " " if there was no problem
    and returns False if there was an error."""
    done = False
    try:
        print_str = format_string(format, args)
        print print_str
        if log_file is not None:
            log_file.write(print_str + '\n')
        done = print_str or " "         # ensures done is treated as true
    finally:
        if not done:
            print "ERROR IN PRINT ACTION: format=%r, args=%r" % (format, args)
    return done