def ShowJobs(opts, args):
  """Show detailed information about jobs.

  @param opts: the command line options selected by the user
  @type args: list
  @param args: should contain the job IDs to be queried
  @rtype: int
  @return: the desired exit code

  """
  selected_fields = [
    "id", "status", "ops", "opresult", "opstatus", "oplog",
    "opstart", "opexec", "opend", "received_ts", "start_ts", "end_ts",
    ]

  qfilter = qlang.MakeSimpleFilter("id", _ParseJobIds(args))
  cl = GetClient()
  result = cl.Query(constants.QR_JOB, selected_fields, qfilter).data

  job_info_container = []

  for entry in result:
    ((_, job_id), (rs_status, status), (_, ops), (_, opresult), (_, opstatus),
     (_, oplog), (_, opstart), (_, opexec), (_, opend), (_, recv_ts),
     (_, start_ts), (_, end_ts)) = entry

    # Detect non-normal results
    if rs_status != constants.RS_NORMAL:
      job_info_container.append("Job ID %s not found" * job_id)
      continue

    # Container for produced data
    job_info = [("Job ID", job_id)]

    if status in _USER_JOB_STATUS:
      status = _USER_JOB_STATUS[status]
    else:
      raise errors.ProgrammerError("Unknown job status code '%s'" % status)

    job_info.append(("Status", status))

    _ListJobTimestamp("Received", recv_ts, job_info)
    _ListJobTimestamp("Processing start", start_ts, job_info, prior_ts=recv_ts)
    _ListJobTimestamp("Processing end", end_ts, job_info, prior_ts=start_ts)

    if end_ts is not None and recv_ts is not None:
      job_info.append(("Total processing time", "%.6f seconds" %
                       _CalcDelta(recv_ts, end_ts)))
    else:
      job_info.append(("Total processing time", "N/A"))

    opcode_container = []
    for (opcode, result, status, log, s_ts, x_ts, e_ts) in \
            zip(ops, opresult, opstatus, oplog, opstart, opexec, opend):
      opcode_info = []
      opcode_info.append(("Opcode", opcode["OP_ID"]))
      opcode_info.append(("Status", status))

      _ListOpcodeTimestamp("Processing start", s_ts, opcode_info)
      _ListOpcodeTimestamp("Execution start", x_ts, opcode_info)
      _ListOpcodeTimestamp("Processing end", e_ts, opcode_info)

      opcode_info.append(("Input fields", opcode))
      opcode_info.append(("Result", result))

      exec_log_container = []
      for serial, log_ts, log_type, log_msg in log:
        time_txt = FormatTimestamp(log_ts)
        encoded = FormatLogMessage(log_type, log_msg)

        # Arranged in this curious way to preserve the brevity for multiple
        # logs. This content cannot be exposed as a 4-tuple, as time contains
        # the colon, causing some YAML parsers to fail.
        exec_log_info = [
          ("Time", time_txt),
          ("Content", (serial, log_type, encoded,)),
          ]
        exec_log_container.append(exec_log_info)
      opcode_info.append(("Execution log", exec_log_container))

      opcode_container.append(opcode_info)

    job_info.append(("Opcodes", opcode_container))
    job_info_container.append(job_info)

  PrintGenericInfo(job_info_container)

  return 0
dataset/ETHPy150Open ganeti/ganeti/lib/client/gnt_job.py/ShowJobs/operator `%` -> `*`