scheduler
scheduler
¶
SyncScheduler — background thread for periodic incremental connector syncs.
Registers connectors for timed re-sync and runs them on a configurable interval. Designed to be long-lived (daemon thread) inside a running OpenJarvis server process.
Typical usage::
store = KnowledgeStore(db_path=":memory:")
pipeline = IngestionPipeline(store)
engine = SyncEngine(pipeline)
scheduler = SyncScheduler(engine, interval_seconds=3600)
scheduler.add(gmail_connector)
scheduler.add(slack_connector)
scheduler.start() # background thread syncs every hour
# Later:
scheduler.stop()
Classes¶
SyncScheduler
¶
SyncScheduler(sync_engine: SyncEngine, interval_seconds: int = 3600)
Runs incremental sync for all registered connectors on a schedule.
| PARAMETER | DESCRIPTION |
|---|---|
sync_engine
|
The :class:
TYPE:
|
interval_seconds
|
How often (in seconds) to sync all connected connectors.
Defaults to
TYPE:
|
Source code in src/openjarvis/connectors/scheduler.py
Functions¶
add
¶
add(connector: BaseConnector) -> None
Register a connector for scheduled sync.
| PARAMETER | DESCRIPTION |
|---|---|
connector
|
Any :class:
TYPE:
|
Source code in src/openjarvis/connectors/scheduler.py
start
¶
Start the background sync thread.
The thread is a daemon so it does not prevent process exit. The
first sync run occurs after one full interval_seconds wait.
Calling :meth:start on an already-running scheduler is a no-op.
Source code in src/openjarvis/connectors/scheduler.py
stop
¶
Stop the background sync thread.
Signals the thread to exit and waits up to 5 seconds for it to finish the current sync cycle. Safe to call even when the scheduler is not running.
Source code in src/openjarvis/connectors/scheduler.py
run_once
¶
Sync all connected connectors once (synchronous, non-blocking test helper).
| RETURNS | DESCRIPTION |
|---|---|
dict[str, int]
|
Mapping of |