Example #1
0
 def __init__(self, job, dataflow_messages):
   self.job_id = job.id
   self.job_name = job.name
   self.job_type = DisplayInfo._JobTypeForJob(job.type, dataflow_messages)
   self.status = DisplayInfo._StatusForJob(job.currentState, dataflow_messages)
   self.status_time = time_util.FormatTimestamp(job.currentStateTime)
   self.creation_time = time_util.FormatTimestamp(job.createTime)
Example #2
0
    def Display(self, args, logs):
        """This method is called to print the result of the Run() method.

    Args:
      args: all the arguments that were provided to this command invocation.
      logs: The logs returned from the Run() method.
    """
        if not args.format or args.format == 'text':
            importance_enum = (
                self.context[commands.DATAFLOW_MESSAGES_MODULE_KEY].JobMessage.
                MessageImportanceValueValuesEnum)
            importances = {
                importance_enum.JOB_MESSAGE_DETAILED: 'd',
                importance_enum.JOB_MESSAGE_DEBUG: 'D',
                importance_enum.JOB_MESSAGE_WARNING: 'W',
                importance_enum.JOB_MESSAGE_ERROR: 'E',
            }
            for msg in logs:
                log.out.Print('{0} {1} {2} {3}'.format(
                    importances.get(msg.messageImportance, '?'),
                    time_util.FormatTimestamp(msg.time), msg.id,
                    msg.messageText))
        else:
            self.format(logs)