Add a file to notify the script that asked to stop the print that it is now done processing the remain
jobs.
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);
        }
    }
87191
def NotifyAboutEnd(self):
    """"""
    flow_ref = None
    if self.runner_args.client_id:
      flow_ref = rdf_objects.FlowReference(
          client_id=self.client_id, flow_id=self.urn.Basename())

    num_results = len(self.ResultCollection())
    notification_lib.Notify(
        self.creator, rdf_objects.UserNotification.Type.TYPE_FLOW_RUN_COMPLETED,
        "Flow %s completed with %d %s" %
        (self.__class__.__name__, num_results, num_results == 1 and "result" or
         "results"),
        rdf_objects.ObjectReference(
            reference_type=rdf_objects.ObjectReference.Type.FLOW,
            flow=flow_ref))
1147850
private function cellEndHandler(): void
    {
        $this->print_data = array_pop($this->print_data_stack);
        $this->wt_report->addElement($this->current_element);
    }
1168139
def stop(self):
        """"""

        if self.run is True and all([self.job, self.job.is_alive()]):
            print('Done.')
            self.job.terminate()
60577
def _on_process_finished(self):
        
        exit_code = self._process.exitCode()
        if self._process.exitStatus() != self._process.NormalExit:
            exit_code = 139
        self._formatter.append_message('\x1b[0m\nProcess finished with exit code %d' % exit_code,
                                       output_format=OutputFormat.CustomFormat)
        self.setReadOnly(True)
        self.process_finished.emit()
339000
def finish(self):
        ''

        self.finished = True
        self.update(self.maxval)
        self.fd.write('\n')
        if self.signal_set:
            signal.signal(signal.SIGWINCH, signal.SIG_DFL)
184250
def notify_done(self, error=False, run_done_callbacks=True):
        ''' 
        '''
        if error:
            for _session in self._sessions.values():
                _session.set_done()
            self._session_count = 0
        else:
            self._update_session_count(-1)
            for _session in self._sessions.values():
                if not _session.is_done():
                    return

        if run_done_callbacks:
            self._run_done_callbacks()
        self._done_event.set()
837151
def output_callback(self, line, kill_switch):
        """"""
        self.notifications += line + "\n"

        if "Initialization Sequence Completed" in line:
            self.started = True
        if "ERROR:" in line or "Cannot resolve host address:" in line:
            self.error = True
        if "process exiting" in line:
            self.stopped = True
668115
function addFileToQueue(filename, callback){
  if (processingPaths[filename]) {
    if (typeof callback == 'function')
      processingPaths[filename].unshift(callback);

    return;
  }

  processingPaths[filename] = typeof callback == 'function'
    ? [callback].concat(readCallbacks)
    : readCallbacks.slice();

  if (readingCount < READ_LIMIT)
    readFile(filename);
  else
  {
    logMsg('fs', relativePath(filename) + ' ' + chalk.yellow('(add file to queue)'), true);
    filesToRead.push(filename);
  }
}
1119793
def on_finish(self):
        
        super(StatsdMixin, self).on_finish()
        key = '%s.%s.%s.%s' % (self.__module__,
                               self.__class__.__name__,
                               self.request.method, self._status_code)
        LOGGER.info('Processing %s', key)
        self.statsd_incr(key)
        self.statsd_add_timing(key, self.request.request_time() * 1000)
196995
function done() {
      // We don't care if we were rejected.
      if (rejected === true) {
        return;
      }
      // Decrement the number of async tasks we are waiting on.
      waiting--;
      // If we are finished waiting then we want to resolve our promise.
      if (waiting <= 0) {
        if (waiting === 0) {
          _resolve(filePaths);
        } else {
          reject(new Error(`Expected a positive number: ${waiting}`));
        }
      }
    }
1182103
def print_and_exit(results):
    """"""
    for success, value in results:
        if success:
            print value.encode(locale.getpreferredencoding())
        else:
            value.printTraceback()
841174
def finish(self, result, array_id = None):
    """"""
    # check if there is any array job still running
    new_status = 'success' if result == 0 else 'failure'
    new_result = result
    finished = True
    if array_id is not None:
      for array_job in self.array:
        if array_job.id == array_id:
          array_job.status = new_status
          array_job.result = result
          array_job.finish_time = datetime.now()
        if array_job.status not in ('success', 'failure'):
          finished = False
        elif new_result == 0:
          new_result = array_job.result

    if finished:
      # There was no array job, or all array jobs finished
      self.status = 'success' if new_result == 0 else 'failure'
      self.result = new_result
      self.finish_time = datetime.now()

      # update all waiting jobs
      for job in self.get_jobs_waiting_for_us():
        if job.status == 'waiting':
          job.queue()
773053
def notify(self, message):
        
        if self.complete:
            return HerokuLocalWrapper.MONITOR_STOP
        return super(DebugDeployment, self).notify(message)
766888
def OnPrint(self, event):
        """"""

        print_area = self._get_print_area()
        print_data = self.main_window.print_data

        self.main_window.actions.printout(print_area, print_data)
1373463
def finish(self):
        
        if self._has_responded:
            raise NSQException('already responded')
        self._has_responded = True
        self.on_finish.send(self)
758177
def stop(self):
        
        for subscript in list(self.scripts.values()):
            subscript.stop()
        print(('--- stopping: ', self.name))
        self._abort = True