Monitor output from heroku process.

        This overrides the base class's `notify`
        to make sure that we stop if the status-monitoring thread
        has determined that the experiment is complete.
773053
def notify(self, message):
        
        if self.complete:
            return HerokuLocalWrapper.MONITOR_STOP
        return super(DebugDeployment, self).notify(message)
146164
def receive_notification(self):
        
        if not self._endpoint.receive_messages():
            raise EOFError("EOF")
        self._process_input_notification()
        self._process_input_request()
1182618
def status(self):
        

        if self.pid is None:
            self.pid = self.read_pid()
        if self.pid is None:
            sp = BackgroundProcess.objects.filter(pk=1).first()
            if sp:
                self.pid = sp.pid
        if self.pid is None or self.pid == 0:
            self.stderr.write("%s: can't determine process id exiting.\n" % datetime.now().isoformat(' '))
            return False
        if self.pid != getpid():
            # calling from outside the daemon instance
            try:
                kill(self.pid, signal.SIGUSR2)
                return True
            except OSError as e:
                if e.errno == errno.ESRCH:
                    return False
                else:
                    return False

        process_list = []
        for process in BackgroundProcess.objects.filter(parent_process__pk=self.process_id):
            process_list.append(process)
            process_list += list(process.backgroundprocess_set.filter())
        for process in process_list:
            logger.debug('%s, parrent process_id %d' % (self.label, process.parent_process.pk))
            logger.debug('%s, process_id %d' % (self.label, self.process_id))
7449
def finished_or_stopped(self):
        
        return (self._status.execution_mode is StateMachineExecutionStatus.STOPPED) or \
               (self._status.execution_mode is StateMachineExecutionStatus.FINISHED)
406789
def monitor(interests=:rw)
      @monitor ||= begin
        raise @error if @error
        monitor = @ioloop.add_io_wait(@io, interests) {callback_on_waiting}
        ObjectSpace.define_finalizer(self, self.class.finalizer(monitor))
        monitor
      end
    end
936956
def monitor(result_queue, broker=None):
    
    if not broker:
        broker = get_broker()
    name = current_process().name
    logger.info(_("{} monitoring at {}").format(name, current_process().pid))
    for task in iter(result_queue.get, 'STOP'):
        # save the result
        if task.get('cached', False):
            save_cached(task, broker)
        else:
            save_task(task, broker)
        # acknowledge result
        ack_id = task.pop('ack_id', False)
        if ack_id and (task['success'] or task.get('ack_failure', False)):
            broker.acknowledge(ack_id)
        # log the result
        if task['success']:
            # log success
            logger.info(_("Processed [{}]").format(task['name']))
        else:
            # log failure
            logger.error(_("Failed [{}] - {}").format(task['name'], task['result']))
    logger.info(_("{} stopped monitoring results").format(name))
488836
def finished!(process_status)
      if process_status.nil? && ! @self_started
        log :debug, "(#{@pid}/#{@pids.inspect}/self_started=#{@self_started}/killed=#{@killed}) I am no longer blocked."
        @pid = nil
        @backoff.died unless @killed
      elsif ! process_status.nil? && @self_started
        log :debug, "(#{@pid}/#{@pids.inspect}/self_started=#{@self_started}/killed=#{@killed}) I exited: #{process_status}"
        @pid = nil
        @backoff.died unless @killed
      else
        log :debug, "(#{@pid}/#{@pids.inspect}/self_started=#{@self_started}/killed=#{@killed}) Reports of my death are highly exaggerated (#{process_status.inspect})"
      end
    end
908607
function notifyIPCWatchCompileDone(index) {
        ipc.config.id = serverName + index;
        ipc.config.stopRetrying = 3;
        ipc.config.silent = true;

        ipc.connectTo(
            serverName,
            function() {
                ipc.of.webpack.emit('done', index);
            }
        );
    }
117188
def notify_exception(self, exception, run_done_callbacks=True):
        '''  '''
        logger.error("%s : %s" % (exception.__class__.__name__, str(exception)))
        self._exception = exception
        if self.is_running(True):
            # wait for a short 5 seconds for it to finish
            for _cnt in range(0, 5):
                if not self._cancel():
                    time.sleep(1)
                else:
                    break

        self.notify_done(error=True, run_done_callbacks=run_done_callbacks)
1193945
def notify_progress(self):
        '''  '''
        _total = 0
        for _session in self._sessions.values():
            _total += _session.bytes_transferred

        if AsperaSession.PROGRESS_MSGS_SEND_ALL:
            self._run_progress_callbacks(_total)
        else:
            # dont call progress callback unless total has changed
            if self._total_bytes_transferred != _total:
                self._total_bytes_transferred = _total
                self._run_progress_callbacks(_total)
222922
def checkForFinishedThreads(self):
        ''
        for t in self.unfinishedThreads:
            if not t.is_alive():
                t.endTime = time.process_time()
                if getattr(t, 'status', None) is None:
                    t.status = 'ended'
1089288
def update_status sig=0
      pid_int = Integer("#{ @pid }")
      begin
        Process::kill sig, pid_int
        true
      rescue Errno::ESRCH
        false
      end
    end
545817
private void notifyIfStopped() {
        if (isAcceptingNewJobs() || !this.runningTasksFutures.isEmpty()) {
            return;
        }
        final File stoppedFile = new File(this.workingDirectories.getWorking(), "stopped");
        try {
            LOGGER.info("The print has finished processing jobs and can now stop");
            stoppedFile.createNewFile();
        } catch (IOException e) {
            LOGGER.warn("Cannot create the {} file", stoppedFile, e);
        }
    }
1176471
public boolean notifyProgress(double progress) {

    boolean result = true;

    for (ProgressMonitor monitor : this.monitors) {
      if (!monitor.notifyProgress(progress)) {
        result = false;
      }
    }

    return result;

  }
393420
def monitor_experiment(args):
    ''''''
    if args.time <= 0:
        print_error('please input a positive integer as time interval, the unit is second.')
        exit(1)
    while True:
        try:
            os.system('clear')
            update_experiment()
            show_experiment_info()
            time.sleep(args.time)
        except KeyboardInterrupt:
            exit(0)
        except Exception as exception:
            print_error(exception)
            exit(1)
209666
def body(self):
        
        self.connection = pika.BlockingConnection(self.connection_param)
        self.channel = self.connection.channel()

        print "Monitoring file '%s'." % self.ftp_extended_log

        file_iter = process_log(
            sh.tail("-f", self.ftp_extended_log, _iter=True)
        )
        for import_request in file_iter:
            self.sendMessage(
                exchange=self.output_exchange,
                routing_key=self.output_key,
                message=serializers.serialize(import_request),
                UUID=str(uuid.uuid1())
            )
570237
def worker_finished(pid)
      worker_status(pid, 'stop')
      all_listeners.each do |other|
        other.worker_finished(pid)
      end
    end