FlowerPower 0.9.12.4__py3-none-any.whl → 1.0.0b1__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- flowerpower/__init__.py +17 -2
- flowerpower/cfg/__init__.py +201 -149
- flowerpower/cfg/base.py +122 -24
- flowerpower/cfg/pipeline/__init__.py +254 -0
- flowerpower/cfg/pipeline/adapter.py +66 -0
- flowerpower/cfg/pipeline/run.py +40 -11
- flowerpower/cfg/pipeline/schedule.py +69 -79
- flowerpower/cfg/project/__init__.py +149 -0
- flowerpower/cfg/project/adapter.py +57 -0
- flowerpower/cfg/project/job_queue.py +165 -0
- flowerpower/cli/__init__.py +92 -35
- flowerpower/cli/job_queue.py +878 -0
- flowerpower/cli/mqtt.py +49 -4
- flowerpower/cli/pipeline.py +576 -381
- flowerpower/cli/utils.py +55 -0
- flowerpower/flowerpower.py +12 -7
- flowerpower/fs/__init__.py +20 -2
- flowerpower/fs/base.py +350 -26
- flowerpower/fs/ext.py +797 -216
- flowerpower/fs/storage_options.py +1097 -55
- flowerpower/io/base.py +13 -18
- flowerpower/io/loader/__init__.py +28 -0
- flowerpower/io/loader/deltatable.py +7 -10
- flowerpower/io/metadata.py +1 -0
- flowerpower/io/saver/__init__.py +28 -0
- flowerpower/io/saver/deltatable.py +4 -3
- flowerpower/job_queue/__init__.py +252 -0
- flowerpower/job_queue/apscheduler/__init__.py +11 -0
- flowerpower/job_queue/apscheduler/_setup/datastore.py +110 -0
- flowerpower/job_queue/apscheduler/_setup/eventbroker.py +93 -0
- flowerpower/job_queue/apscheduler/manager.py +1063 -0
- flowerpower/job_queue/apscheduler/setup.py +524 -0
- flowerpower/job_queue/apscheduler/trigger.py +169 -0
- flowerpower/job_queue/apscheduler/utils.py +309 -0
- flowerpower/job_queue/base.py +382 -0
- flowerpower/job_queue/rq/__init__.py +10 -0
- flowerpower/job_queue/rq/_trigger.py +37 -0
- flowerpower/job_queue/rq/concurrent_workers/gevent_worker.py +226 -0
- flowerpower/job_queue/rq/concurrent_workers/thread_worker.py +231 -0
- flowerpower/job_queue/rq/manager.py +1449 -0
- flowerpower/job_queue/rq/setup.py +150 -0
- flowerpower/job_queue/rq/utils.py +69 -0
- flowerpower/pipeline/__init__.py +5 -0
- flowerpower/pipeline/base.py +118 -0
- flowerpower/pipeline/io.py +407 -0
- flowerpower/pipeline/job_queue.py +505 -0
- flowerpower/pipeline/manager.py +1586 -0
- flowerpower/pipeline/registry.py +560 -0
- flowerpower/pipeline/runner.py +560 -0
- flowerpower/pipeline/visualizer.py +142 -0
- flowerpower/plugins/mqtt/__init__.py +12 -0
- flowerpower/plugins/mqtt/cfg.py +16 -0
- flowerpower/plugins/mqtt/manager.py +789 -0
- flowerpower/settings.py +110 -0
- flowerpower/utils/logging.py +21 -0
- flowerpower/utils/misc.py +57 -9
- flowerpower/utils/sql.py +122 -24
- flowerpower/utils/templates.py +18 -142
- flowerpower/web/app.py +0 -0
- flowerpower-1.0.0b1.dist-info/METADATA +324 -0
- flowerpower-1.0.0b1.dist-info/RECORD +94 -0
- {flowerpower-0.9.12.4.dist-info → flowerpower-1.0.0b1.dist-info}/WHEEL +1 -1
- flowerpower/cfg/pipeline/tracker.py +0 -14
- flowerpower/cfg/project/open_telemetry.py +0 -8
- flowerpower/cfg/project/tracker.py +0 -11
- flowerpower/cfg/project/worker.py +0 -19
- flowerpower/cli/scheduler.py +0 -309
- flowerpower/event_handler.py +0 -23
- flowerpower/mqtt.py +0 -525
- flowerpower/pipeline.py +0 -2419
- flowerpower/scheduler.py +0 -680
- flowerpower/tui.py +0 -79
- flowerpower/utils/datastore.py +0 -186
- flowerpower/utils/eventbroker.py +0 -127
- flowerpower/utils/executor.py +0 -58
- flowerpower/utils/trigger.py +0 -140
- flowerpower-0.9.12.4.dist-info/METADATA +0 -575
- flowerpower-0.9.12.4.dist-info/RECORD +0 -70
- /flowerpower/{cfg/pipeline/params.py → cli/worker.py} +0 -0
- {flowerpower-0.9.12.4.dist-info → flowerpower-1.0.0b1.dist-info}/entry_points.txt +0 -0
- {flowerpower-0.9.12.4.dist-info → flowerpower-1.0.0b1.dist-info}/top_level.txt +0 -0
flowerpower/cli/mqtt.py
CHANGED
@@ -1,12 +1,11 @@
|
|
1
1
|
import typer
|
2
|
-
import importlib
|
3
2
|
import sys
|
4
|
-
from ..mqtt import (
|
3
|
+
from ..plugins.mqtt import (
|
5
4
|
start_listener as start_listener_,
|
6
5
|
run_pipeline_on_message as run_pipeline_on_message_,
|
7
6
|
)
|
8
|
-
from .utils import parse_dict_or_list_param
|
9
|
-
|
7
|
+
from .utils import parse_dict_or_list_param, load_hook
|
8
|
+
import importlib
|
10
9
|
app = typer.Typer(help="MQTT management commands")
|
11
10
|
|
12
11
|
|
@@ -74,9 +73,21 @@ def run_pipeline_on_message(
|
|
74
73
|
port: int | None = None,
|
75
74
|
username: str | None = None,
|
76
75
|
password: str | None = None,
|
76
|
+
clean_session: bool = True,
|
77
|
+
qos: int = 0,
|
78
|
+
client_id: str | None = None,
|
79
|
+
client_id_suffix: str | None = None,
|
80
|
+
config_hook: str | None = None,
|
81
|
+
max_retries: int = typer.Option(3, help="Maximum number of retry attempts if pipeline execution fails"),
|
82
|
+
retry_delay: float = typer.Option(1.0, help="Base delay between retries in seconds"),
|
83
|
+
jitter_factor: float = typer.Option(0.1, help="Random factor (0-1) applied to delay for jitter"),
|
77
84
|
):
|
78
85
|
"""Run a pipeline on a message
|
79
86
|
|
87
|
+
This command sets up an MQTT listener that executes a pipeline whenever a message is
|
88
|
+
received on the specified topic. The pipeline can be configured to retry on failure
|
89
|
+
using exponential backoff with jitter for better resilience.
|
90
|
+
|
80
91
|
Args:
|
81
92
|
name: Name of the pipeline
|
82
93
|
topic: MQTT topic to listen to
|
@@ -94,6 +105,27 @@ def run_pipeline_on_message(
|
|
94
105
|
port: MQTT broker port
|
95
106
|
username: MQTT broker username
|
96
107
|
password: MQTT broker password
|
108
|
+
clean_session: Whether to start a clean session with the broker
|
109
|
+
qos: MQTT Quality of Service level (0, 1, or 2)
|
110
|
+
client_id: Custom MQTT client identifier
|
111
|
+
client_id_suffix: Optional suffix to append to client_id
|
112
|
+
config_hook: Function to process incoming messages into pipeline config
|
113
|
+
max_retries: Maximum number of retry attempts if pipeline execution fails
|
114
|
+
retry_delay: Base delay between retries in seconds
|
115
|
+
jitter_factor: Random factor (0-1) applied to delay for jitter
|
116
|
+
|
117
|
+
Examples:
|
118
|
+
# Basic usage with a specific topic
|
119
|
+
$ flowerpower mqtt run-pipeline-on-message my_pipeline --topic sensors/data
|
120
|
+
|
121
|
+
# Configure retries for resilience
|
122
|
+
$ flowerpower mqtt run-pipeline-on-message my_pipeline --topic sensors/data --max-retries 5 --retry-delay 2.0
|
123
|
+
|
124
|
+
# Run as a job with custom MQTT settings
|
125
|
+
$ flowerpower mqtt run-pipeline-on-message my_pipeline --topic events/process --as-job --qos 2 --host mqtt.example.com
|
126
|
+
|
127
|
+
# Use a config hook to process messages
|
128
|
+
$ flowerpower mqtt run-pipeline-on-message my_pipeline --topic data/incoming --config-hook process_message
|
97
129
|
|
98
130
|
|
99
131
|
"""
|
@@ -103,6 +135,11 @@ def run_pipeline_on_message(
|
|
103
135
|
parsed_final_vars = parse_dict_or_list_param(final_vars, "list")
|
104
136
|
parsed_storage_options = parse_dict_or_list_param(storage_options, "dict")
|
105
137
|
|
138
|
+
config_hook_function = None
|
139
|
+
if config_hook:
|
140
|
+
config_hook_function = load_hook(name, config_hook, base_dir, storage_options)
|
141
|
+
|
142
|
+
|
106
143
|
run_pipeline_on_message_(
|
107
144
|
name=name,
|
108
145
|
topic=topic,
|
@@ -120,4 +157,12 @@ def run_pipeline_on_message(
|
|
120
157
|
port=port,
|
121
158
|
username=username,
|
122
159
|
password=password,
|
160
|
+
clean_session=clean_session,
|
161
|
+
qos=qos,
|
162
|
+
client_id=client_id,
|
163
|
+
client_id_suffix=client_id_suffix,
|
164
|
+
config_hook=config_hook_function,
|
165
|
+
max_retries=max_retries,
|
166
|
+
retry_delay=retry_delay,
|
167
|
+
jitter_factor=jitter_factor,
|
123
168
|
)
|