Start the watcher that periodically checks for offline reports and attempts to upload them.
17831
def start_watcher(self):
        
        if self._watcher and self._watcher.is_alive:
            self._watcher_running = True
        else:
            self.logger.info('CrashReporter: Starting watcher.')
            self._watcher = Thread(target=self._watcher_thread, name='offline_reporter')
            self._watcher.setDaemon(True)
            self._watcher_running = True
            self._watcher.start()
183779
def start_stream_subscriber(self):
        
        if not self._stream_process_started:  # pragma: no cover
            if sys.platform.startswith("win"):  # if we're on windows we can't expect multiprocessing to work
                self._stream_process_started = True
                self._stream()
            self._stream_process_started = True
            self._stream_process.start()
989634
def enable(self):
        
        if not CrashReporter.active:
            CrashReporter.active = True
            # Store this function so we can set it back if the CrashReporter is deactivated
            self._excepthook = sys.excepthook
            sys.excepthook = self.exception_handler
            self.logger.info('CrashReporter: Enabled')
            if self.report_dir:
                if os.path.exists(self.report_dir):
                    if self.get_offline_reports():
                        # First attempt to send the reports, if that fails then start the watcher
                        self.submit_offline_reports()
                        remaining_reports = len(self.get_offline_reports())
                        if remaining_reports and self.watcher_enabled:
                            self.start_watcher()
                else:
                    os.makedirs(self.report_dir)
1008544
public final void start() {
    if (this.started) {
      log.warn(String.format("Reporter %s has already been started.", this.name));
      return;
    }
    try {
      startImpl();
      this.started = true;
    } catch (Exception exception) {
      log.warn(String.format("Reporter %s did not start correctly.", this.name), exception);
    }
  }
347853
@Override
  @SuppressWarnings("unchecked")
  public void start() {
    if (isStopped()) return;
    
    logger().log("Inbound stream listening: for '" + reader.name() + "'");
    
    try {
      reader.openFor(this);
    } catch (Exception e) {
      reader.close();
      e.printStackTrace();
      throw new IllegalStateException(e.getMessage(), e);
    }
    cancellable = this.stage().scheduler().schedule(selfAs(Scheduled.class), null, 1000, probeInterval);
  }
1098930
public function monitor()
    {
        $this->ensureNoOtherMasterSupervisors();

        $this->listenForSignals();

        $this->persist();

        while (true) {
            sleep(1);

            $this->loop();
        }
    }
1041485
def start(self):
        # type: (Uploader) -> None
        
        try:
            blobxfer.operations.progress.output_parameters(
                self._general_options, self._spec)
            self._run()
        except (KeyboardInterrupt, Exception) as ex:
            if isinstance(ex, KeyboardInterrupt):
                logger.info(
                    'KeyboardInterrupt detected, force terminating '
                    'processes and threads (this may take a while)...')
            else:
                logger.exception(ex)
            self._wait_for_transfer_threads(terminate=True)
            self._wait_for_disk_threads(terminate=True)
        finally:
            # shutdown processes
            if self._md5_offload is not None:
                self._md5_offload.finalize_processes()
            if self._crypto_offload is not None:
                self._crypto_offload.finalize_processes()
            # close resume file
            if self._resume is not None:
                self._resume.close()
1135380
public void startWatching() {
        try {
            final List<MonitorLine> lines = getSource().getLastLine(getInitialCount());
            actual = null;
            updateLines(lines);
        } catch (Exception e) {
            notifyObservers(e);
        }
    }
639324
async def start(self):
        

        self._loop.add_task(self._periodic_loop, name="periodic task for %s" % self._adapter.__class__.__name__,
                            parent=self._task)

        self._adapter.add_callback('on_scan', functools.partial(_on_scan, self._loop, self))
        self._adapter.add_callback('on_report', functools.partial(_on_report, self._loop, self))
        self._adapter.add_callback('on_trace', functools.partial(_on_trace, self._loop, self))
        self._adapter.add_callback('on_disconnect', functools.partial(_on_disconnect, self._loop, self))
943677
private void startupWatchdir() throws Exception {
		File dirToWatch;
		if (this.configuration.getProcessConfigDirOrFile().isFile()) {
			dirToWatch = new File(FilenameUtils.getFullPath(this.configuration.getProcessConfigDirOrFile().getAbsolutePath()));
		} else {
			dirToWatch = this.configuration.getProcessConfigDirOrFile();
		}

		// start the watcher
		this.watcher = new WatchDir(dirToWatch, this);
		this.watcher.start();
	}
385376
function startWatch() {
        if (watcher) return

        watcher = setInterval(function() {
            if (self.root[self.origin.offset]) {
                stopWatch()
                self.update()
            }
        }, 300) // is it good enought for you?)
    }
772913
public void run() {
    try {
      log.info("{}#Start listing and watching...", apiTypeClass);

      ApiListType list = listerWatcher.list(new CallGeneratorParams(Boolean.FALSE, null, null));

      V1ListMeta listMeta = Reflect.listMetadata(list);
      String resourceVersion = listMeta.getResourceVersion();
      List<ApiType> items = Reflect.getItems(list);

      if (log.isDebugEnabled()) {
        log.debug("{}#Extract resourceVersion {} list meta", apiTypeClass, resourceVersion);
      }
      this.syncWith(items, resourceVersion);
      this.lastSyncResourceVersion = resourceVersion;

      if (log.isDebugEnabled()) {
        log.debug("{}#Start watching with {}...", apiTypeClass, lastSyncResourceVersion);
      }
      while (true) {
        if (!isActive.get()) {
          if (watch != null) {
            watch.close();
            return;
          }
        }

        try {
          if (log.isDebugEnabled()) {
            log.debug(
                "{}#Start watch with resource version {}", apiTypeClass, lastSyncResourceVersion);
          }
          watch =
              listerWatcher.watch(
                  new CallGeneratorParams(
                      Boolean.TRUE,
                      lastSyncResourceVersion,
                      Long.valueOf(Duration.ofMinutes(5).toMillis()).intValue()));
          watchHandler(watch);
        } catch (Throwable t) {
          log.info("{}#Watch connection get exception {}", apiTypeClass, t.getMessage());
          Throwable cause = t.getCause();
          // If this is "connection refused" error, it means that most likely apiserver is not
          // responsive.
          // It doesn't make sense to re-list all objects because most likely we will be able to
          // restart
          // watch where we ended.
          // If that's the case wait and resend watch request.
          if (cause != null && (cause instanceof ConnectException)) {
            log.info("{}#Watch get connect exception, retry watch", apiTypeClass);
            Thread.sleep(1000L);
            continue;
          }
          if ((t instanceof RuntimeException)
              && t.getMessage().contains("IO Exception during hasNext")) {
            log.info("{}#Read timeout retry list and watch", apiTypeClass);
            return;
          }
          log.error("{}#Watch failed as {} unexpected", apiTypeClass, t.getMessage(), t);
          return;
        } finally {
          if (watch != null) {
            watch.close();
            watch = null;
          }
        }
      }
    } catch (Throwable t) {
      log.error("{}#Failed to list-watch: {}", apiTypeClass, t);
    }
  }
198156
def start(self):
        """"""
        if self.closed:
            raise ConnectionClosed()

        self.read_watcher.start()
        if self.write == self.buffered_write:
            self.write_watcher.start()
417525
def start(self):
        
        logging.info("TCP health monitor plugin: Starting to watch "
                     "instances.")

        self.monitor_thread = threading.Thread(target = self.start_monitoring,
                                               name   = self.thread_name)
        self.monitor_thread.daemon = True
        self.monitor_thread.start()
647600
public function start() {
        if ($this->watcher !== null) {
            return;
        }

        $this->watcher = Loop::repeat($this->checkInterval, function () {
            // Use double defer to calculate complete tick time
            // instead of timer → defer time.
            Loop::unreference(Loop::defer($this->check));
        });

        Loop::unreference($this->watcher);
    }
1289381
def run_watcher(self):
        
        # Create observer
        observer = Observer()

        # Start observer
        observer.start()

        # Dict that maps file path to `watch object`
        watche_obj_map = {}

        # Run change check in a loop
        while not self._watcher_to_stop:
            # Get current watch paths
            old_watch_path_s = set(watche_obj_map)

            # Get new watch paths
            new_watch_path_s = self._find_watch_paths()

            # For each new watch path
            for new_watch_path in new_watch_path_s:
                # Remove from the old watch paths if exists
                old_watch_path_s.discard(new_watch_path)

                # If the new watch path was not watched
                if new_watch_path not in watche_obj_map:
                    try:
                        # Schedule a watch
                        watch_obj = observer.schedule(
                            # 2KGRW
                            # `FileSystemEventHandler` instance
                            self,
                            # File path to watch
                            new_watch_path,
                            # Whether recursive
                            recursive=True,
                        )

                        # Store the watch obj
                        watche_obj_map[new_watch_path] = watch_obj

                    # If have error
                    except OSError:
                        # Set the watch object be None
                        watche_obj_map[new_watch_path] = None

            # For each old watch path that is not in the new watch paths
            for old_watch_path in old_watch_path_s:
                # Get watch object
                watch_obj = watche_obj_map.pop(old_watch_path, None)

                # If have watch object
                if watch_obj is not None:
                    # Unschedule the watch
                    observer.unschedule(watch_obj)

            # Store new watch paths
            self._watch_paths = new_watch_path_s

            # Sleep before next check
            time.sleep(self._interval)
1129350
def _start(self, tpart):
        """"""
        g = gevent.Greenlet(self.uploader, tpart)
        g.link(self._finish)

        # Account for concurrency_burden before starting the greenlet
        # to avoid racing against .join.
        self.concurrency_burden += 1

        self.member_burden += len(tpart)

        g.start()