nodes: 0, module; 1, function_definition; 2, function_name:_StopAnalysisProcesses; 3, parameters; 4, block; 5, identifier:self; 6, default_parameter; 7, expression_statement; 8, expression_statement; 9, expression_statement; 10, comment:# Note that multiprocessing.Queue is very sensitive regarding; 11, comment:# blocking on either a get or a put. So we try to prevent using; 12, comment:# any blocking behavior.; 13, if_statement; 14, if_statement; 15, comment:# Wake the processes to make sure that they are not blocking; 16, comment:# waiting for the queue new items.; 17, for_statement; 18, comment:# Try waiting for the processes to exit normally.; 19, expression_statement; 20, for_statement; 21, if_statement; 22, identifier:abort; 23, False; 24, comment:"""Stops the analysis processes.
  
      Args:
        abort (bool): True to indicated the stop is issued on abort.
      """; 25, call; 26, call; 27, identifier:abort; 28, comment:# Signal all the processes to abort.; 29, block; 30, not_operator; 31, block; 32, identifier:event_queue; 33, call; 34, block; 35, call; 36, identifier:event_queue; 37, call; 38, block; 39, identifier:abort; 40, comment:# Kill any remaining processes.; 41, block; 42, else_clause; 43, attribute; 44, argument_list; 45, attribute; 46, argument_list; 47, expression_statement; 48, attribute; 49, expression_statement; 50, for_statement; 51, attribute; 52, argument_list; 53, expression_statement; 54, attribute; 55, argument_list; 56, attribute; 57, argument_list; 58, expression_statement; 59, expression_statement; 60, comment:# Check if the processes are still alive and terminate them if necessary.; 61, block; 62, identifier:logger; 63, identifier:debug; 64, string; 65, identifier:self; 66, identifier:_StopMonitoringProcesses; 67, call; 68, identifier:self; 69, identifier:_use_zeromq; 70, call; 71, identifier:event_queue; 72, call; 73, block; 74, attribute; 75, identifier:values; 76, call; 77, identifier:self; 78, identifier:_AbortJoin; 79, keyword_argument; 80, attribute; 81, identifier:values; 82, call; 83, call; 84, expression_statement; 85, expression_statement; 86, for_statement; 87, string_content:Stopping analysis processes.; 88, attribute; 89, argument_list; 90, attribute; 91, argument_list; 92, attribute; 93, argument_list; 94, expression_statement; 95, identifier:self; 96, identifier:_event_queues; 97, attribute; 98, argument_list; 99, identifier:timeout; 100, attribute; 101, identifier:self; 102, identifier:_event_queues; 103, attribute; 104, argument_list; 105, attribute; 106, argument_list; 107, call; 108, call; 109, identifier:event_queue; 110, call; 111, block; 112, identifier:self; 113, identifier:_AbortTerminate; 114, identifier:logger; 115, identifier:debug; 116, string; 117, attribute; 118, identifier:values; 119, call; 120, identifier:event_queue; 121, identifier:PushItem; 122, call; 123, keyword_argument; 124, identifier:self; 125, identifier:_PROCESS_JOIN_TIMEOUT; 126, identifier:event_queue; 127, identifier:Close; 128, keyword_argument; 129, identifier:self; 130, identifier:_AbortKill; 131, attribute; 132, argument_list; 133, attribute; 134, argument_list; 135, attribute; 136, argument_list; 137, expression_statement; 138, string_content:Emptying queues.; 139, identifier:self; 140, identifier:_event_queues; 141, attribute; 142, argument_list; 143, attribute; 144, argument_list; 145, identifier:block; 146, False; 147, identifier:abort; 148, identifier:abort; 149, identifier:self; 150, identifier:_AbortTerminate; 151, identifier:self; 152, identifier:_AbortJoin; 153, keyword_argument; 154, attribute; 155, identifier:values; 156, call; 157, identifier:event_queue; 158, identifier:Empty; 159, identifier:plaso_queue; 160, identifier:QueueAbort; 161, identifier:timeout; 162, attribute; 163, identifier:self; 164, identifier:_event_queues; 165, attribute; 166, argument_list; 167, identifier:self; 168, identifier:_PROCESS_JOIN_TIMEOUT; 169, identifier:event_queue; 170, identifier:Close; 171, keyword_argument; 172, identifier:abort; 173, True
code: def _StopAnalysisProcesses(self, abort=False):
      """Stops the analysis processes.
  
      Args:
        abort (bool): True to indicated the stop is issued on abort.
      """
      logger.debug('Stopping analysis processes.')
      self._StopMonitoringProcesses()
  
      # Note that multiprocessing.Queue is very sensitive regarding
      # blocking on either a get or a put. So we try to prevent using
      # any blocking behavior.
  
      if abort:
        # Signal all the processes to abort.
        self._AbortTerminate()
  
      if not self._use_zeromq:
        logger.debug('Emptying queues.')
        for event_queue in self._event_queues.values():
          event_queue.Empty()
  
      # Wake the processes to make sure that they are not blocking
      # waiting for the queue new items.
      for event_queue in self._event_queues.values():
        event_queue.PushItem(plaso_queue.QueueAbort(), block=False)
  
      # Try waiting for the processes to exit normally.
      self._AbortJoin(timeout=self._PROCESS_JOIN_TIMEOUT)
      for event_queue in self._event_queues.values():
        event_queue.Close(abort=abort)
  
      if abort:
        # Kill any remaining processes.
        self._AbortKill()
      else:
        # Check if the processes are still alive and terminate them if necessary.
        self._AbortTerminate()
        self._AbortJoin(timeout=self._PROCESS_JOIN_TIMEOUT)
  
        for event_queue in self._event_queues.values():
          event_queue.Close(abort=True)