xdas.processing.RealTimeLoader#

class xdas.processing.RealTimeLoader(path, engine='netcdf')[source]#

Real-time DataArray loader that watches a directory for new files.

Parameters:
  • path (str or Path) – Directory to watch.

  • engine (str, optional) – Engine used to open arriving files. Defaults to "netcdf".

__init__(path, engine='netcdf')[source]#

This constructor should always be called with keyword arguments. Arguments are:

group should be None; reserved for future extension when a ThreadGroup class is implemented.

target is the callable object to be invoked by the run() method. Defaults to None, meaning nothing is called.

name is the thread name. By default, a unique name is constructed of the form “Thread-N” where N is a small decimal number.

args is a list or tuple of arguments for the target invocation. Defaults to ().

kwargs is a dictionary of keyword arguments for the target invocation. Defaults to {}.

context is the contextvars.Context value to use for the thread. The default value is None, which means to check sys.flags.thread_inherit_context. If that flag is true, use a copy of the context of the caller. If false, use an empty context. To explicitly start with an empty context, pass a new instance of contextvars.Context(). To explicitly start with a copy of the current context, pass the value from contextvars.copy_context().

If a subclass overrides the constructor, it must make sure to invoke the base class constructor (Thread.__init__()) before doing anything else to the thread.

Methods

__init__(path[, engine])

This constructor should always be called with keyword arguments.

add_handler_for_watch(event_handler, watch)

Adds a handler for the given watch.

dispatch_events(event_queue)

Override this method to consume events from an event queue, blocking on the queue for the specified timeout before raising queue.Empty.

getName()

Return a string used for identification purposes only.

isDaemon()

Return whether this thread is a daemon.

is_alive()

Return whether the thread is alive.

join([timeout])

Wait until the thread terminates.

on_thread_start()

Override this method instead of start().

on_thread_stop()

Override this method instead of stop().

remove_handler_for_watch(event_handler, watch)

Removes a handler for the given watch.

run()

Method representing the thread's activity.

schedule(event_handler, path, *[, ...])

Schedules watching a path and calls appropriate methods specified in the given event handler in response to file system events.

setDaemon(daemonic)

Set whether this thread is a daemon.

setName(name)

Set the name string for this thread.

should_keep_running()

Determines whether the thread should continue running.

start()

Start the thread's activity.

stop()

Signals the thread to stop.

unschedule(watch)

Unschedules a watch.

unschedule_all()

Unschedules all watches and detaches all associated event handlers.

Attributes

daemon

A boolean value indicating whether this thread is a daemon thread.

emitters

Returns event emitter created by this observer.

event_queue

The event queue which is populated with file system events by emitters and from which events are dispatched by a dispatcher thread.

ident

Thread identifier of this thread or None if it has not been started.

name

A string used for identification purposes only.

native_id

Native integral thread ID of this thread, or None if it has not been started.

stop_event

Event inserted into the queue to signal a requested stop.

stopped_event

timeout

Timeout value to construct emitters with.