Acknowledges a specific alarm associated with a parameter.

        :param alarm: Alarm instance
        :type alarm: :class:`.Alarm`
        :param str comment: Optional comment to associate with the state
                            change.
346245
def acknowledge_alarm(self, alarm, comment=None):
        
        url = '/processors/{}/{}/parameters{}/alarms/{}'.format(
            self._instance, self._processor, alarm.name, alarm.sequence_number)
        req = rest_pb2.EditAlarmRequest()
        req.state = 'acknowledged'
        if comment is not None:
            req.comment = comment
        self._client.put_proto(url, data=req.SerializeToString())
828762
def update(self, **kwargs):
        """"""
        url_str = self.base_url + '/%s' % kwargs['alarm_id']
        del kwargs['alarm_id']

        resp = self.client.create(url=url_str,
                                  method='PUT',
                                  json=kwargs)

        return resp
1010234
def set_alarm_mode(self, mode):
        
        values = {"desired_state": {"alarm_mode": mode}}
        response = self.api_interface.set_device_state(self, values)
        self._update_state_from_response(response)
1055889
def _set_alarm(self, status, home_id):
        """"""
        response = self._request(
            MINUT_HOMES_URL + "/{}".format(home_id),
            request_type='PUT',
            json={'alarm_status': status})
        return response.get('alarm_status', '') == status
502984
public void alarm(Object alarmContext)
  {
    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
      SibTr.entry(this, tc, "alarm", alarmContext);

    // Alarm context should be an sid, make it so.
    SIBUuid12 sid = (SIBUuid12) alarmContext;

    // synchronized here in case we're racing with an answer to our
    // query.
    synchronized (flushMap)
    {
      // See if the query record is still around
      FlushQueryRecord entry = flushMap.get(sid);

      if (entry != null)
      {
        // Query still active, see if we need to restart.
        entry.attempts--;
        if (entry.attempts > 0)
        {
          // Yup, resend the query and reset the alarm.  If
          // entry.cached is null, then this is a "request flush"
          // rather than an "are you flushed".
          try
          {
            if (entry.cache == null)
            {
              upControl.sendRequestFlushMessage(entry.source,
                                                entry.destId,
                                                entry.busId,
                                                entry.requestID,
                                                sid,
                                                false);  //TODO check indoubtDiscard
            }
            else
            {
              upControl.sendAreYouFlushedMessage(entry.source,
                                                 entry.destId,
                                                 entry.busId,
                                                 entry.requestID, sid);
            }
          }
          catch (SIResourceException e)
          {
            // No FFDC code needed

            // If we run out of resources, then give up on the query
            // and log an error.  This is probably only important for
            // "request flush" queries.
            flushMap.remove(sid);

            // TODO: actually, this should be an admin message.
            if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled())
              SibTr.event(tc, "Flush query failed for stream: " + sid);
          }

        }
        else
        {
          // Nope, didn't work.  Remove the query record, log the event,
          // and exit.
          flushMap.remove(sid);
          // TODO: actually, this should be an admin message.
          if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled())
            SibTr.event(tc, "Flush query expired for stream: " + sid);
        }
      }
    }

    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
      SibTr.exit(tc, "alarm");
  }
755546
public void addComment(Comment comment) {
        if (comments == null || comments.size() == 0) {
            comments = new ArrayList<Comment>();
        }

        comments.add((CommentImpl) comment);
    }
284418
def addcomment(self, order_increment_id,
            status, comment=None, notify=False):
        
        if comment is None:
            comment = ""
        return bool(self.call(
                'sales_order.addComment',
                [order_increment_id, status, comment, notify]
            )
        )
645102
def realtime_comment_classifier(sender, instance, created, **kwargs):
    
    # Only classify if newly created.
    if created:
        moderator_settings = getattr(settings, 'MODERATOR', None)
        if moderator_settings:
            if 'REALTIME_CLASSIFICATION' in moderator_settings:
                if not moderator_settings['REALTIME_CLASSIFICATION']:
                    return

        # Only classify if not a reply comment.
        if not getattr(instance, 'is_reply_comment', False):
            from moderator.utils import classify_comment
            classify_comment(instance)
1046207
def show_comment(self, value):
        
        comments = self.get_comments()
        comments = [x for x in comments if x['comment'] == value]
        if len(comments) == 0:
            raise Exception("Unknown comment")
        else:
            return comments[0]
146804
def set_mode(self, mode):
        """"""
        _LOGGER.debug('State change called from alarm device')
        if not mode:
            _LOGGER.info('No mode supplied')
        elif mode not in CONST.ALL_MODES:
            _LOGGER.warning('Invalid mode')
        response_object = self._lupusec.set_mode(CONST.MODE_TRANSLATION[mode])
        if response_object['result'] != 1:
            _LOGGER.warning('Mode setting unsuccessful')

        self._json_state['mode'] = mode
        _LOGGER.info('Mode set to: %s', mode)
        return True
492
def _alerter_thread_func(self) -> None:
        

        self._alert_count = 0
        self._next_alert_time = 0

        while not self._stop_thread:
            # Always acquire terminal_lock before printing alerts or updating the prompt
            # To keep the app responsive, do not block on this call
            if self.terminal_lock.acquire(blocking=False):

                # Get any alerts that need to be printed
                alert_str = self._generate_alert_str()

                # Generate a new prompt
                new_prompt = self._generate_colored_prompt()

                # Check if we have alerts to print
                if alert_str:
                    # new_prompt is an optional parameter to async_alert()
                    self.async_alert(alert_str, new_prompt)
                    new_title = "Alerts Printed: {}".format(self._alert_count)
                    self.set_window_title(new_title)

                # No alerts needed to be printed, check if the prompt changed
                elif new_prompt != self.prompt:
                    self.async_update_prompt(new_prompt)

                # Don't forget to release the lock
                self.terminal_lock.release()

            time.sleep(0.5)
664065
def do_alarm_definition_create(mc, args):
    ''''''
    fields = {}
    fields['name'] = args.name
    if args.description:
        fields['description'] = args.description
    fields['expression'] = args.expression
    if args.alarm_actions:
        fields['alarm_actions'] = args.alarm_actions
    if args.ok_actions:
        fields['ok_actions'] = args.ok_actions
    if args.undetermined_actions:
        fields['undetermined_actions'] = args.undetermined_actions
    if args.severity:
        if not _validate_severity(args.severity):
            return
        fields['severity'] = args.severity
    if args.match_by:
        fields['match_by'] = args.match_by.split(',')
    try:
        alarm = mc.alarm_definitions.create(**fields)
    except (osc_exc.ClientException, k_exc.HttpError) as he:
        raise osc_exc.CommandError('%s\n%s' % (he.message, he.details))
    else:
        print(jsonutils.dumps(alarm, indent=2))
1355578
def comment_line(comment)
      # Take care of annotation only if matched
      if comment.match(ProbeDockProbe::Annotation::ANNOTATION_REGEXP)
        # If the feature already started, the annotations are for scenarios
        if @current_feature_started
          @annotation = ProbeDockProbe::Annotation.new(comment)
        else
          @feature_annotation = ProbeDockProbe::Annotation.new(comment)
        end
      end
    end
271193
def update_alarm(self, entity, alarm, criteria=None, disabled=False,
            label=None, name=None, metadata=None):
        
        return entity.update_alarm(alarm, criteria=criteria, disabled=disabled,
            label=label, name=name, metadata=metadata)
1081891
def set_comment(self, obj, cursor):
        
        if isinstance(obj, typedesc.T):
            obj.comment = cursor.brief_comment
        return
250721
def set_comment(self,c):
        
        c = ' '+c.replace('-','').strip()+' '
        self.node.insert(0,etree.Comment(c))
597793
public void alarm(Object thandle)
  {
    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
      SibTr.entry(tc, "alarm", thandle);

    boolean doClose = false;

    // We're probably about to close this consumer, which needs us to remove it from the AOStream's
    // consciousness first (so that it doesn't allow it to be used while we're closing it - as that's 
    // done outside of the lock). To do this we need to take the AOStream's (parent's) lock first and
    // remove it from the parent's list prior to releasing the lock.
    synchronized(parent)
    {
      this.lock();
      try
      {
        if (idleHandler != null)
        { // so we are still idle
          if (!listOfRequests.isEmpty())
          { // we have an outstanding request. idleHandler should be null, and therefore != thandle
            // Since this should never occur, log this error
            SIErrorException e =
              new SIErrorException(
                nls.getFormattedMessage(
                  "INTERNAL_MESSAGING_ERROR_CWSIP0001",
                  new Object[] {
                    "com.ibm.ws.sib.processor.impl.JSRemoteConsumerPoint",
                    "1:1121:1.43.2.26" },
                  null));
            FFDCFilter.processException(
              e,
              "com.ibm.ws.sib.processor.impl.JSRemoteConsumerPoint.alarm",
              "1:1126:1.43.2.26",
              this);
            SibTr.exception(tc, e);
            SibTr.error(tc, "INTERNAL_MESSAGING_ERROR_CWSIP0001",
              new Object[] {
                "com.ibm.ws.sib.processor.impl.JSRemoteConsumerPoint",
                "1:1132:1.43.2.26" });
          }
          else
          {
            // Remove this consumer so that it is no longer handed out for new requests (they'll
            // have to create a new consumer to use)
            parent.removeConsumerKey(selectionCriteriasAsString, this);
            
            doClose = true;
          }
        }
      }
      finally
      {
        this.unlock();
      }
    } // synchronised(parent)
    
    if (doClose)
    {
      close(); //Never call close() from within synchronized (this)!!
    }

    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
      SibTr.exit(tc, "alarm");

  }