Start watching `cfstore.record_path`.

    :type indexer: rash.indexer.Indexer
548744
def watch_record(indexer, use_polling=False):
    
    if use_polling:
        from watchdog.observers.polling import PollingObserver as Observer
        Observer  # fool pyflakes
    else:
        from watchdog.observers import Observer

    event_handler = RecordHandler(indexer)
    observer = Observer()
    observer.schedule(event_handler, path=indexer.record_path, recursive=True)
    indexer.logger.debug('Start observer.')
    observer.start()
    try:
        while True:
            time.sleep(1)
    except KeyboardInterrupt:
        indexer.logger.debug('Got KeyboardInterrupt. Stopping observer.')
        observer.stop()
    indexer.logger.debug('Joining observer.')
    observer.join()
    indexer.logger.debug('Finish watching record.')
328070
def _file_watcher(state):
    
    conf = state.app.config

    file_path = conf.get('WAFFLE_WATCHER_FILE', '/tmp/waffleconf.txt')

    if not os.path.isfile(file_path):
        # Create watch file
        open(file_path, 'a').close()

    while True:
        tstamp = os.path.getmtime(file_path)

        # Compare timestamps and update config if needed
        if tstamp > state._tstamp:
            state.update_conf()
            state._tstamp = tstamp

        # Not too critical
        time.sleep(10)
543888
def exec(self, record):
		
		watchdog_cls = self.watchdog_class()
		watchdog = watchdog_cls.create(record, self)
		watchdog.start()
		watchdog.start_event().wait(self.__watchdog_startup_timeout__)
		self.__running_registry.append(watchdog)
222268
def record_run(record_type, print_session_id, **kwds):
    
    if print_session_id and record_type != 'init':
        raise RuntimeError(
            '--print-session-id should be used with --record-type=init')

    cfstore = ConfigStore()
    # SOMEDAY: Pass a list of environment variables to shell by "rash
    # init" and don't read configuration in "rash record" command.  It
    # is faster.
    config = cfstore.get_config()
    envkeys = config.record.environ[record_type]
    json_path = os.path.join(cfstore.record_path,
                             record_type,
                             time.strftime('%Y-%m-%d-%H%M%S.json'))
    mkdirp(os.path.dirname(json_path))

    # Command line options directly map to record keys
    data = dict((k, v) for (k, v) in kwds.items() if v is not None)
    data.update(
        environ=get_environ(envkeys),
    )

    # Automatically set some missing variables:
    data.setdefault('cwd', getcwd())
    if record_type in ['command', 'exit']:
        data.setdefault('stop', int(time.time()))
    elif record_type in ['init']:
        data.setdefault('start', int(time.time()))

    if print_session_id:
        data['session_id'] = generate_session_id(data)
        print(data['session_id'])

    with open(json_path, 'w') as fp:
        json.dump(data, fp)
416420
function watchFile(file, callback) {
	let absolutePath = File.find(file).path();
	let watcher = chokidar
		.watch(
			absolutePath,
			{
				persistent: true
			}
		)
		.on(
			'change',
			function () {
				if (typeof callback === 'function') {
					callback(file);
				}
				watcher.unwatch(absolutePath);
				watchFile(file, callback);
			}
		)
	;
}
907473
def _start_watching_events(self, replace=False):
        
        return self._start_reflector(
            "events",
            EventReflector,
            fields={"involvedObject.kind": "Pod"},
            replace=replace,
        )
499888
def set_record_path(self, path, callback=None):
        '''
        
        '''
        params = {'Path': path}
        return self.execute_command('setRecordPath', params, callback=callback)
1206646
public void watch(Watcher watcher) throws WatchException{
		if(isClosed){
			throw new WatchException("Watch Monitor is closed !");
		}
		registerPath();
//		log.debug("Start watching path: [{}]", this.path);
		
		while (false == isClosed) {
			WatchKey wk;
			try {
				wk = watchService.take();
			} catch (InterruptedException e) {
//				log.warn(e);
				return;
			}
			
			final Path currentPath = watchKeyPathMap.get(wk);
			WatchEvent.Kind<?> kind;
			for (WatchEvent<?> event : wk.pollEvents()) {
				kind = event.kind();
				if(null != this.filePath && false == this.filePath.endsWith(event.context().toString())){
//					log.debug("[{}] is not fit for [{}], pass it.", event.context(), this.filePath.getFileName());
					continue;
				}
				
				if(kind == StandardWatchEventKinds.ENTRY_CREATE){
					watcher.onCreate(event, currentPath);
				}else if(kind == StandardWatchEventKinds.ENTRY_MODIFY){
					watcher.onModify(event, currentPath);
				}else if(kind == StandardWatchEventKinds.ENTRY_DELETE){
					watcher.onDelete(event, currentPath);
				}else if(kind == StandardWatchEventKinds.OVERFLOW){
					watcher.onOverflow(event, currentPath);
				}
			}
			wk.reset();
		}
	}
259784
def monitor(args, watch):
    
    watch = watch if isinstance(watch, (list, tuple)) else [watch]
    watch = [Path(entry).expand().abspath() for entry in watch]
    event_handler = RunScriptChangeHandler(args)
    observer = Observer()
    for entry in watch:
        if entry.isfile():
            entry = entry.parent
        click.secho('watch recursive: {0}'.format(entry), fg='blue')
        observer.schedule(event_handler, entry, recursive=True)
    event_handler.run()  # run always once
    observer.start()

    try:
        while True:
            time.sleep(1)
    except KeyboardInterrupt:
        observer.stop()
    observer.join()
1177182
def watch(ctx):
    
    vcs = ctx.obj['vcs']

    event_handler = TestsEventHandler(vcs)

    observer = Observer()
    observer.schedule(event_handler, vcs.path, recursive=True)
    observer.start()
    click.echo('Watching directory `{path}`. Use ctrl-c to stop.'.format(path=vcs.path))
    while observer.isAlive():
        observer.join(timeout=1)
600288
def search_path(self):
        
        return [os.path.dirname(self._record.file_path)] + self.category.search_path
221341
def show(record_id = nil, **params)
      if record_id.nil? && !singular_resource?
        raise ArgumentError, "record_id cannot be nil"
      end
      path = nest_path_within_parent(singular_path_for_record(record_id, params), params)
      api_request(:get, path, params: params)
    end
756090
def layer_post_save(instance, *args, **kwargs):
    
    if instance.is_monitored and instance.service.is_monitored:  # index and monitor
        if not settings.REGISTRY_SKIP_CELERY:
            check_layer.delay(instance.id)
        else:
            check_layer(instance.id)
    else:  # just index
        index_layer(instance.id)
459327
function startWatch() {
  var rp = path.join(rootPath, '/**/*.md')
  watcher = gulp.watch([rp, '!' + rp + '/_book/'], function() {
    rebuildBook(reload)
  })
  return watcher
}
203231
def start(self):
    """"""
    assert not self.watching

    def selector(evt):
      if evt.is_directory:
        return False
      path = evt.path
      if path in self._last_fnames: # Detected a "killing cycle"
        return False
      for pattern in self.skip_pattern.split(";"):
        if fnmatch(path, pattern.strip()):
          return False
      return True

    def watchdog_handler(evt):
      wx.CallAfter(self._watchdog_handler, evt)

    # Force a first event
    self._watching = True
    self._last_fnames = []
    self._evts = [None]
    self._run_subprocess()

    # Starts the watchdog observer
    from .watcher import watcher
    self._watcher = watcher(path=self.directory,
                            selector=selector, handler=watchdog_handler)
    self._watcher.__enter__()
811033
def trigger_streamer(self, index):
        """"""

        self._logger.debug("trigger_streamer RPC called on streamer %d", index)

        if index >= len(self.graph.streamers):
            return _pack_sgerror(SensorGraphError.STREAMER_NOT_ALLOCATED)

        if index in self._stream_manager.in_progress():
            return _pack_sgerror(SensorGraphError.STREAM_ALREADY_IN_PROGRESS)

        streamer = self.graph.streamers[index]
        if not streamer.triggered(manual=True):
            return _pack_sgerror(SensorGraphError.STREAMER_HAS_NO_NEW_DATA)

        self._logger.debug("calling mark_streamer on streamer %d from trigger_streamer RPC", index)
        self.graph.mark_streamer(index)

        self.process_streamers()

        return Error.NO_ERROR
928240
def record_path(self):
        '''
        
        '''
        if self.record_button.get_property('active') and (self.record_path_selector
                                                          .selected_path):
            return self.record_path_selector.selected_path
        else:
            return None