Per step status messages

    Use this locally in a command definition to highlight more important
    information.
354295
def err(msg, *args, **kw):
    # type: (str, *Any, **Any) -> None
    
    if len(args) or len(kw):
        msg = msg.format(*args, **kw)

    shell.cprint('-- <31>{}<0>'.format(msg))
318604
@Override
    public void indicateProgress() {
        verifySystemOut();
        progressIndicatorActive = true;
        if (isAnsiEnabled()) {
            if (lastMessage != null && lastMessage.length() > 0) {
                if (!lastMessage.contains(maxIndicatorString)) {
                    updateStatus(lastMessage + indicator);
                }
            }
        } else {
            out.print(indicator);
        }
    }
360529
def message
      # Retrieve a text message that may be rendered for a task's status.  This is used in various places,
      # such as System Event history.
      details = TaskStatus::TYPES[self.task_type]
      return _("Non-system event") if details.nil?

      case details[:type]
      when :package
        p = self.parameters[:packages]
        first_package = p.first.is_a?(Hash) ? p.first[:name] : p.first
        unless p && p.length > 0
          if self.task_type == "package_update"
            case self.overall_status
            when "running"
              return "updating"
            when "waiting"
              return "updating"
            when "error"
              return _("all packages update failed")
            else
              return _("all packages update")
            end
          end
        end

        msg = details[:event_messages][self.overall_status]
        return n_(msg[1], msg[2], p.length) % { package: first_package, total: p.length - 1 }
      when :candlepin_event
        return self.result
      when :package_group
        p = self.parameters[:groups]
        msg = details[:event_messages][self.overall_status]
        return n_(msg[1], msg[2], p.length) % { group: p.first, total: p.length - 1 }
      when :errata
        p = self.parameters[:errata_ids]
        msg = details[:event_messages][self.overall_status]
        return n_(msg[1], msg[2], p.length) % { errata: p.first, total: p.length - 1 }
      end
    end
323227
@Override
    public void indicateProgress(int number, int total) {
        progressIndicatorActive = true;
        String currMsg = lastMessage;
        try {
            updateStatus(currMsg + ' ' + number + " of " + total);
        } finally {
            lastMessage = currMsg;
        }
    }
558664
def ls_cmd(context, before, status):
    """"""
    runs = context.obj['store'].analyses(
        status=status,
        deleted=False,
        before=parse_date(before) if before else None,
    ).limit(30)
    for run_obj in runs:
        if run_obj.status == 'pending':
            message = f"{run_obj.id} | {run_obj.family} [{run_obj.status.upper()}]"
        else:
            message = (f"{run_obj.id} | {run_obj.family} {run_obj.started_at.date()} "
                       f"[{run_obj.type.upper()}/{run_obj.status.upper()}]")
            if run_obj.status == 'running':
                message = click.style(f"{message} - {run_obj.progress * 100}/100", fg='blue')
            elif run_obj.status == 'completed':
                message = click.style(f"{message} - {run_obj.completed_at}", fg='green')
            elif run_obj.status == 'failed':
                message = click.style(message, fg='red')
        print(message)
1011385
private void doPushMessage(Status status) {
        StatusMessage message = new StatusMessage();
        message.setBody(status);
        doPushMessage(message);
    }
1313587
def show_status(self):
        
        txt = 'Agent Status:\n'
        print(txt)
        txt += "start_x  = " + str(self.start_x) + "\n"
        txt += "start_y  = " + str(self.start_y) + "\n"
        txt += "target_x = " + str(self.target_x) + "\n"
        txt += "target_y = " + str(self.target_y) + "\n"
        txt += "current_x = " + str(self.current_x) + "\n"
        txt += "current_y = " + str(self.current_y) + "\n"
       
        
        print(self.grd)
        return txt
759175
function(command, stderrLine) {
    var progress = parseProgressLine(stderrLine);

    if (progress) {
      // build progress report object
      var ret = {
        frames: parseInt(progress.frame, 10),
        currentFps: parseInt(progress.fps, 10),
        currentKbps: progress.bitrate ? parseFloat(progress.bitrate.replace('kbits/s', '')) : 0,
        targetSize: parseInt(progress.size || progress.Lsize, 10),
        timemark: progress.time
      };

      // calculate percent progress using duration
      if (command._ffprobeData && command._ffprobeData.format && command._ffprobeData.format.duration) {
        var duration = Number(command._ffprobeData.format.duration);
        if (!isNaN(duration))
          ret.percent = (utils.timemarkToSeconds(ret.timemark) / duration) * 100;
      }
      command.emit('progress', ret);
    }
  }
440213
def Message(message, title='FontParts', informativeText=""):
    
    return dispatcher["Message"](message=message, title=title,
                                 informativeText=informativeText)
1048824
def status_log(func, message, *args, **kwargs):
    """"""

    click.echo(message)
    log = func(*args, **kwargs)

    if log:
        out = []

        for line in log.split('\n'):
            if not line.startswith('#'):
                out.append(line)
        click.echo(black('\n'.join(out)))
271992
def display_progress(cls, operations):
        
        start_crea = datetime.utcnow()

        # count number of operations, 3 steps per operation
        if not isinstance(operations, (list, tuple)):
            operations = [operations]
        count_operations = len(operations) * 3
        updating_done = False
        while not updating_done:
            op_score = 0
            for oper in operations:
                op_ret = cls.call('operation.info', oper['id'])
                op_step = op_ret['step']
                if op_step in cls._op_scores:
                    op_score += cls._op_scores[op_step]
                else:
                    cls.echo('')
                    msg = 'step %s unknown, exiting' % op_step
                    if op_step == 'ERROR':
                        msg = ('An error has occured during operation '
                               'processing: %s' % op_ret['last_error'])
                    elif op_step == 'SUPPORT':
                        msg = ('An error has occured during operation '
                               'processing, you must contact Gandi support.')
                    cls.echo(msg)
                    sys.exit(1)

            cls.update_progress(float(op_score) / count_operations,
                                start_crea)

            if op_score == count_operations:
                updating_done = True

            time.sleep(cls._poll_freq)

        cls.echo('\r')
560947
function RoostUserStatus(message, code) {
  MessagingUserStatus.call(this, 'roost');

  this.state.message = message;

  if (code === 'missing') {
    this.state.code = this.StatusCodes.MISSING;

  } else if (code === 'ok') {
    this.state.code = this.StatusCodes.VALID;

  } else {
    this.state.code = this.STatusCodes.DEFAULT;
  }
}
87498
def on_pubmsg(self, connection, event):
        
        for message in event.arguments():
            self.log(event, message)
            command_args = filter(None, message.split())
            command_name = command_args.pop(0)
            for handler in self.events["command"]:
                if handler.event.args["command"] == command_name:
                    self.handle_command_event(event, handler, command_args)
275636
def info(self, *args):
        """"""
        report = resolwe_runtime_utils.info(' '.join([str(x) for x in args]))
        # TODO: Use the protocol to report progress.
        print(report)
242348
def progress_indicator(self, fmt=None, interval=100, values=None):
        
        return ProgressIndicator(self.io, fmt, interval, values)
1353742
def say_status(status, message, log_status = true)
      Strainer.log.info("status: #{status}, message: #{message}")

      return if quiet?
      super(status, message, log_status)
    end
837125
def message(self, msg='', level=1, tab=0):
        ''''''
        if self.verbosity >= level:
            self.stdout.write('{}{}'.format('    ' * tab, msg))