StreamManagerΒΆ
Defined in dccd.daemon.stream_manager
- class StreamManager(config, health=None)[source]
Bases:
objectManage real-time WebSocket collection jobs.
Starts one background thread per
(exchange, pair)(or per(exchange, pair, channel)for Bitfinex/Bitmex). Each thread runs indefinitely and is automatically restarted after a crash. ASyncServiceinstance pushes data to remotes periodically.- Parameters:
- configCollectorConfig
Daemon configuration (
stream_jobs+storage).
- running_keys()[source]
Return the keys of all currently alive stream threads.
- start()[source]
Start the sync service and all stream threads.
- start_one(job, pair, channels)[source]
Start a single stream thread for (pair, channels) if not running.
- Parameters:
- jobStreamJob
Stream job configuration (only
exchange/time_stepare used).- pairstr
Trading pair in
'CRYPTO/FIAT'format.- channelslist of str
Channels for this thread.
- Returns:
- str
The thread key (running or freshly started).
- status(config=None)[source]
Return the configured stream tasks with their running state.
- Parameters:
- configConfig, optional
Configuration to read
stream_jobsfrom. Defaults to the config captured at construction; callers (e.g. the web UI) pass a freshly-loaded config so stream jobs added at runtime appear here without restarting the process.
- Returns:
- list of dict
One entry per
(pair, channels)task across all configuredstream_jobs, withkey,exchange,pair,channels,time_stepandrunningfields.
- stop()[source]
Signal all streams and the sync service to stop.
- stop_one(key)[source]
Signal a single stream thread (by key) to stop.
The thread and stop-event slots are freed immediately so a subsequent
start_onefor the same key always spawns a fresh thread instead of reusing one that is still winding down. The downloader entry is left in place; the dying thread removes its own (identity-guarded) in_run_once.- Parameters:
- keystr
Thread key as returned by
start_one/status.
- Returns:
- bool
Trueif a matching running thread was found and signalled.