feldera 0.138.0__tar.gz → 0.140.0__tar.gz
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.
Potentially problematic release.
This version of feldera might be problematic. Click here for more details.
- {feldera-0.138.0 → feldera-0.140.0}/PKG-INFO +1 -1
- {feldera-0.138.0 → feldera-0.140.0}/feldera/enums.py +27 -0
- {feldera-0.138.0 → feldera-0.140.0}/feldera/pipeline.py +39 -7
- {feldera-0.138.0 → feldera-0.140.0}/feldera/rest/feldera_client.py +1 -1
- {feldera-0.138.0 → feldera-0.140.0}/feldera/stats.py +4 -1
- {feldera-0.138.0 → feldera-0.140.0}/feldera.egg-info/PKG-INFO +1 -1
- {feldera-0.138.0 → feldera-0.140.0}/pyproject.toml +1 -1
- {feldera-0.138.0 → feldera-0.140.0}/README.md +0 -0
- {feldera-0.138.0 → feldera-0.140.0}/feldera/__init__.py +0 -0
- {feldera-0.138.0 → feldera-0.140.0}/feldera/_callback_runner.py +0 -0
- {feldera-0.138.0 → feldera-0.140.0}/feldera/_helpers.py +0 -0
- {feldera-0.138.0 → feldera-0.140.0}/feldera/output_handler.py +0 -0
- {feldera-0.138.0 → feldera-0.140.0}/feldera/pipeline_builder.py +0 -0
- {feldera-0.138.0 → feldera-0.140.0}/feldera/rest/__init__.py +0 -0
- {feldera-0.138.0 → feldera-0.140.0}/feldera/rest/_helpers.py +0 -0
- {feldera-0.138.0 → feldera-0.140.0}/feldera/rest/_httprequests.py +0 -0
- {feldera-0.138.0 → feldera-0.140.0}/feldera/rest/config.py +0 -0
- {feldera-0.138.0 → feldera-0.140.0}/feldera/rest/errors.py +0 -0
- {feldera-0.138.0 → feldera-0.140.0}/feldera/rest/feldera_config.py +0 -0
- {feldera-0.138.0 → feldera-0.140.0}/feldera/rest/pipeline.py +0 -0
- {feldera-0.138.0 → feldera-0.140.0}/feldera/rest/sql_table.py +0 -0
- {feldera-0.138.0 → feldera-0.140.0}/feldera/rest/sql_view.py +0 -0
- {feldera-0.138.0 → feldera-0.140.0}/feldera/runtime_config.py +0 -0
- {feldera-0.138.0 → feldera-0.140.0}/feldera/tests/test_datafusionize.py +0 -0
- {feldera-0.138.0 → feldera-0.140.0}/feldera/testutils.py +0 -0
- {feldera-0.138.0 → feldera-0.140.0}/feldera.egg-info/SOURCES.txt +0 -0
- {feldera-0.138.0 → feldera-0.140.0}/feldera.egg-info/dependency_links.txt +0 -0
- {feldera-0.138.0 → feldera-0.140.0}/feldera.egg-info/requires.txt +0 -0
- {feldera-0.138.0 → feldera-0.140.0}/feldera.egg-info/top_level.txt +0 -0
- {feldera-0.138.0 → feldera-0.140.0}/setup.cfg +0 -0
- {feldera-0.138.0 → feldera-0.140.0}/tests/test_uda.py +0 -0
|
@@ -170,6 +170,33 @@ class PipelineStatus(Enum):
|
|
|
170
170
|
return self.value == other.value
|
|
171
171
|
|
|
172
172
|
|
|
173
|
+
class TransactionStatus(Enum):
|
|
174
|
+
"""
|
|
175
|
+
Represents the transaction handling status of a pipeline.
|
|
176
|
+
"""
|
|
177
|
+
|
|
178
|
+
NoTransaction = 1
|
|
179
|
+
"""There is currently no active transaction."""
|
|
180
|
+
|
|
181
|
+
TransactionInProgress = 2
|
|
182
|
+
"""There is an active transaction in progress."""
|
|
183
|
+
|
|
184
|
+
CommitInProgress = 3
|
|
185
|
+
"""A commit is currently in progress."""
|
|
186
|
+
|
|
187
|
+
@staticmethod
|
|
188
|
+
def from_str(value):
|
|
189
|
+
for member in TransactionStatus:
|
|
190
|
+
if member.name.lower() == value.lower():
|
|
191
|
+
return member
|
|
192
|
+
raise ValueError(
|
|
193
|
+
f"Unknown value '{value}' for enum {TransactionStatus.__name__}"
|
|
194
|
+
)
|
|
195
|
+
|
|
196
|
+
def __eq__(self, other):
|
|
197
|
+
return self.value == other.value
|
|
198
|
+
|
|
199
|
+
|
|
173
200
|
class ProgramStatus(Enum):
|
|
174
201
|
Pending = 1
|
|
175
202
|
CompilingSql = 2
|
|
@@ -11,7 +11,12 @@ from collections import deque
|
|
|
11
11
|
from queue import Queue
|
|
12
12
|
|
|
13
13
|
from feldera.rest.errors import FelderaAPIError
|
|
14
|
-
from feldera.enums import
|
|
14
|
+
from feldera.enums import (
|
|
15
|
+
PipelineStatus,
|
|
16
|
+
ProgramStatus,
|
|
17
|
+
CheckpointStatus,
|
|
18
|
+
TransactionStatus,
|
|
19
|
+
)
|
|
15
20
|
from feldera.enums import StorageStatus
|
|
16
21
|
from feldera.rest.pipeline import Pipeline as InnerPipeline
|
|
17
22
|
from feldera.rest.feldera_client import FelderaClient
|
|
@@ -559,15 +564,17 @@ metrics"""
|
|
|
559
564
|
|
|
560
565
|
self.client.start_pipeline(self.name, wait=wait, timeout_s=timeout_s)
|
|
561
566
|
|
|
562
|
-
def start_transaction(self):
|
|
567
|
+
def start_transaction(self) -> int:
|
|
563
568
|
"""
|
|
564
569
|
Start a new transaction.
|
|
565
570
|
|
|
566
|
-
|
|
567
|
-
|
|
571
|
+
:return: Transaction ID.
|
|
572
|
+
|
|
573
|
+
:raises FelderaAPIError: If the pipeline fails to start a transaction, e.g., if the pipeline is not running or
|
|
574
|
+
there is already an active transaction.
|
|
568
575
|
"""
|
|
569
576
|
|
|
570
|
-
self.client.start_transaction(self.name)
|
|
577
|
+
return self.client.start_transaction(self.name)
|
|
571
578
|
|
|
572
579
|
def commit_transaction(
|
|
573
580
|
self,
|
|
@@ -576,7 +583,7 @@ metrics"""
|
|
|
576
583
|
timeout_s: Optional[float] = None,
|
|
577
584
|
):
|
|
578
585
|
"""
|
|
579
|
-
|
|
586
|
+
Commit the currently active transaction.
|
|
580
587
|
|
|
581
588
|
:param transaction_id: If provided, the function verifies that the currently active transaction matches this ID.
|
|
582
589
|
If the active transaction ID does not match, the function raises an error.
|
|
@@ -590,11 +597,36 @@ metrics"""
|
|
|
590
597
|
:raises RuntimeError: If there is currently no transaction in progress.
|
|
591
598
|
:raises ValueError: If the provided `transaction_id` does not match the current transaction.
|
|
592
599
|
:raises TimeoutError: If the transaction does not commit within the specified timeout (when `wait` is True).
|
|
593
|
-
:raises FelderaAPIError: If the pipeline fails to
|
|
600
|
+
:raises FelderaAPIError: If the pipeline fails to commit a transaction.
|
|
594
601
|
"""
|
|
595
602
|
|
|
596
603
|
self.client.commit_transaction(self.name, transaction_id, wait, timeout_s)
|
|
597
604
|
|
|
605
|
+
def transaction_status(self) -> TransactionStatus:
|
|
606
|
+
"""
|
|
607
|
+
Get pipeline's transaction handling status.
|
|
608
|
+
|
|
609
|
+
:return: Current transaction handling status of the pipeline.
|
|
610
|
+
|
|
611
|
+
:raises FelderaAPIError: If pipeline's status couldn't be read, e.g., because the pipeline is not currently running.
|
|
612
|
+
"""
|
|
613
|
+
|
|
614
|
+
return self.stats().global_metrics.transaction_status
|
|
615
|
+
|
|
616
|
+
def transaction_id(self) -> Optional[int]:
|
|
617
|
+
"""
|
|
618
|
+
Gets the ID of the currently active transaction or None if there is no active transaction.
|
|
619
|
+
|
|
620
|
+
:return: The ID of the transaction.
|
|
621
|
+
"""
|
|
622
|
+
|
|
623
|
+
transaction_id = self.stats().global_metrics.transaction_id
|
|
624
|
+
|
|
625
|
+
if transaction_id == 0:
|
|
626
|
+
return None
|
|
627
|
+
else:
|
|
628
|
+
return transaction_id
|
|
629
|
+
|
|
598
630
|
def delete(self, clear_storage: bool = False):
|
|
599
631
|
"""
|
|
600
632
|
Deletes the pipeline.
|
|
@@ -565,7 +565,7 @@ Reason: The pipeline is in a STOPPED state due to the following error:
|
|
|
565
565
|
:raises RuntimeError: If there is currently no transaction in progress.
|
|
566
566
|
:raises ValueError: If the provided `transaction_id` does not match the current transaction.
|
|
567
567
|
:raises TimeoutError: If the transaction does not commit within the specified timeout (when `wait` is True).
|
|
568
|
-
:raises FelderaAPIError: If the pipeline fails to
|
|
568
|
+
:raises FelderaAPIError: If the pipeline fails to commit a transaction.
|
|
569
569
|
"""
|
|
570
570
|
|
|
571
571
|
# TODO: implement this without using /stats when we have a better pipeline status reporting API.
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
from typing import Mapping, Any, Optional, List
|
|
2
|
-
from feldera.enums import PipelineStatus
|
|
2
|
+
from feldera.enums import PipelineStatus, TransactionStatus
|
|
3
3
|
from datetime import datetime
|
|
4
4
|
import uuid
|
|
5
5
|
|
|
@@ -55,6 +55,8 @@ class GlobalPipelineMetrics:
|
|
|
55
55
|
self.total_processed_records: Optional[int] = None
|
|
56
56
|
self.total_completed_records: Optional[int] = None
|
|
57
57
|
self.pipeline_complete: Optional[bool] = None
|
|
58
|
+
self.transaction_status: Optional[TransactionStatus] = None
|
|
59
|
+
self.transaction_id: Optional[int] = None
|
|
58
60
|
|
|
59
61
|
@classmethod
|
|
60
62
|
def from_dict(cls, d: Mapping[str, Any]):
|
|
@@ -63,6 +65,7 @@ class GlobalPipelineMetrics:
|
|
|
63
65
|
metrics.state = PipelineStatus.from_str(d["state"])
|
|
64
66
|
metrics.incarnation_uuid = uuid.UUID(d["incarnation_uuid"])
|
|
65
67
|
metrics.start_time = datetime.fromtimestamp(d["start_time"])
|
|
68
|
+
metrics.transaction_status = TransactionStatus.from_str(d["transaction_status"])
|
|
66
69
|
return metrics
|
|
67
70
|
|
|
68
71
|
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|