feldera 0.111.0__py3-none-any.whl → 0.113.0__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.

Potentially problematic release.


This version of feldera might be problematic. Click here for more details.

@@ -75,7 +75,9 @@ class CallbackRunner(Thread):
75
75
  # stop blocking the main thread on `join` for the previous message
76
76
  self.queue.task_done()
77
77
 
78
- for chunk in gen_obj:
78
+ iterator = gen_obj()
79
+
80
+ for chunk in iterator:
79
81
  chunk: dict = chunk
80
82
  data: Optional[list[dict]] = chunk.get("json_data")
81
83
  seq_no: Optional[int] = chunk.get("sequence_number")
feldera/pipeline.py CHANGED
@@ -484,7 +484,9 @@ metrics"""
484
484
  for view_name, queue in self.views_tx.pop().items():
485
485
  # block until the callback runner has been stopped
486
486
  queue.join()
487
+ import time
487
488
 
489
+ time.sleep(3)
488
490
  self.client.stop_pipeline(self.name, force=force, timeout_s=timeout_s)
489
491
 
490
492
  def resume(self, timeout_s: Optional[float] = None):
@@ -838,14 +840,14 @@ pipeline '{self.name}' to sync checkpoint '{uuid}'"""
838
840
 
839
841
  def set_runtime_config(self, runtime_config: RuntimeConfig):
840
842
  """Updates the runtime config of the pipeline. The pipeline
841
- must be stopped and, in addition, changing some pipeline
842
- configuration requires storage to be cleared.
843
+ must be stopped. Changing some pipeline configuration, such
844
+ as the number of workers, requires storage to be cleared.
843
845
 
844
- For example, to set 'min_batch_size_records' on a pipeline:
846
+ For example, to set 'min_batch_size_records' on a pipeline::
845
847
 
846
- runtime_config = pipeline.runtime_config()
847
- runtime_config.min_batch_size_records = 500
848
- pipeline.set_runtime_config(runtime_config)
848
+ runtime_config = pipeline.runtime_config()
849
+ runtime_config.min_batch_size_records = 500
850
+ pipeline.set_runtime_config(runtime_config)
849
851
 
850
852
  """
851
853
 
@@ -12,6 +12,7 @@ import json
12
12
  import requests
13
13
  from requests.packages import urllib3
14
14
  from typing import Callable, Optional, Any, Union, Mapping, Sequence, List
15
+ import time
15
16
 
16
17
 
17
18
  def json_serialize(body: Any) -> str:
@@ -42,6 +43,7 @@ class HttpRequests:
42
43
  params: Optional[Mapping[str, Any]] = None,
43
44
  stream: bool = False,
44
45
  serialize: bool = True,
46
+ max_retries: int = 3,
45
47
  ) -> Any:
46
48
  """
47
49
  :param http_method: The HTTP method to use. Takes the equivalent `requests.*` module. (Example: `requests.get`)
@@ -68,39 +70,54 @@ class HttpRequests:
68
70
  str(params),
69
71
  )
70
72
 
71
- if http_method.__name__ == "get":
72
- request = http_method(
73
- request_path,
74
- timeout=timeout,
75
- headers=headers,
76
- params=params,
77
- stream=stream,
78
- verify=self.requests_verify,
79
- )
80
- elif isinstance(body, bytes):
81
- request = http_method(
82
- request_path,
83
- timeout=timeout,
84
- headers=headers,
85
- data=body,
86
- params=params,
87
- stream=stream,
88
- verify=self.requests_verify,
89
- )
90
- else:
91
- request = http_method(
92
- request_path,
93
- timeout=timeout,
94
- headers=headers,
95
- data=json_serialize(body) if serialize else body,
96
- params=params,
97
- stream=stream,
98
- verify=self.requests_verify,
99
- )
100
-
101
- resp = self.__validate(request, stream=stream)
102
- logging.debug("got response: %s", str(resp))
103
- return resp
73
+ for attempt in range(max_retries):
74
+ if http_method.__name__ == "get":
75
+ request = http_method(
76
+ request_path,
77
+ timeout=timeout,
78
+ headers=headers,
79
+ params=params,
80
+ stream=stream,
81
+ verify=self.requests_verify,
82
+ )
83
+ elif isinstance(body, bytes):
84
+ request = http_method(
85
+ request_path,
86
+ timeout=timeout,
87
+ headers=headers,
88
+ data=body,
89
+ params=params,
90
+ stream=stream,
91
+ verify=self.requests_verify,
92
+ )
93
+ else:
94
+ request = http_method(
95
+ request_path,
96
+ timeout=timeout,
97
+ headers=headers,
98
+ data=json_serialize(body) if serialize else body,
99
+ params=params,
100
+ stream=stream,
101
+ verify=self.requests_verify,
102
+ )
103
+
104
+ try:
105
+ resp = self.__validate(request, stream=stream)
106
+ logging.debug("got response: %s", str(resp))
107
+ return resp
108
+ except FelderaAPIError as err:
109
+ # Only retry on 503
110
+ if err.status_code == 503:
111
+ if attempt < max_retries:
112
+ logging.warning(
113
+ "HTTP 503 received for %s, retrying (%d/%d)...",
114
+ path,
115
+ attempt + 1,
116
+ max_retries,
117
+ )
118
+ time.sleep(2) # backoff, adjust as needed
119
+ continue
120
+ raise # re-raise for all other errors or if out of retries
104
121
 
105
122
  except requests.exceptions.Timeout as err:
106
123
  raise FelderaTimeoutError(str(err)) from err
@@ -272,7 +272,11 @@ class FelderaClient:
272
272
 
273
273
  if status == "Running":
274
274
  break
275
- elif status == "Failed":
275
+ elif (
276
+ status == "Stopped"
277
+ and len(resp.deployment_error or {}) > 0
278
+ and resp.deployment_desired_status == "Stopped"
279
+ ):
276
280
  raise RuntimeError(
277
281
  f"""Unable to START the pipeline.
278
282
  Reason: The pipeline is in a STOPPED state due to the following error:
@@ -601,13 +605,16 @@ Reason: The pipeline is in a STOPPED state due to the following error:
601
605
 
602
606
  end = time.monotonic() + timeout if timeout else None
603
607
 
604
- # Using the default chunk size below makes `iter_lines` extremely
605
- # inefficient when dealing with long lines.
606
- for chunk in resp.iter_lines(chunk_size=50000000):
607
- if end and time.monotonic() > end:
608
- break
609
- if chunk:
610
- yield json.loads(chunk, parse_float=Decimal)
608
+ def generator():
609
+ # Using the default chunk size below makes `iter_lines` extremely
610
+ # inefficient when dealing with long lines.
611
+ for chunk in resp.iter_lines(chunk_size=50000000):
612
+ if end and time.monotonic() > end:
613
+ break
614
+ if chunk:
615
+ yield json.loads(chunk, parse_float=Decimal)
616
+
617
+ return generator
611
618
 
612
619
  def query_as_text(
613
620
  self, pipeline_name: str, query: str
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: feldera
3
- Version: 0.111.0
3
+ Version: 0.113.0
4
4
  Summary: The feldera python client
5
5
  Author-email: Feldera Team <dev@feldera.com>
6
6
  License: MIT
@@ -92,14 +92,14 @@ To run tests from a specific file:
92
92
  (cd python && python3 -m pytest ./tests/path-to-file.py)
93
93
  ```
94
94
 
95
- #### Running Aggregate Tests
95
+ #### Running Tests
96
96
 
97
- The aggregate tests validate end-to-end correctness of SQL functionality.
98
- To run the aggregate tests use:
97
+ The tests validate end-to-end correctness of SQL functionality. To
98
+ run the tests use:
99
99
 
100
100
  ```bash
101
101
  cd python
102
- PYTHONPATH=`pwd` python3 ./tests/aggregate_tests/main.py
102
+ PYTHONPATH=`pwd` ./tests/run-all-tests.sh
103
103
  ```
104
104
 
105
105
  ### Reducing Compilation Cycles
@@ -1,23 +1,23 @@
1
1
  feldera/__init__.py,sha256=EiY3bTj_mnfNhCGrZo6J__brfovIJ-YYAdy77PyaEoo,378
2
- feldera/_callback_runner.py,sha256=GNOg3TrKJg9zJU0HvpWxCHqzjMUX8ORiHhtiEEdVQzE,4758
2
+ feldera/_callback_runner.py,sha256=-2hYG70cEkvz4BiOfUTARaH-2Rlv0Qcz-ilvodgyK10,4797
3
3
  feldera/_helpers.py,sha256=rN0WuGSCCQlXWFMimZUQrgs-LJAfUo074d79sLElncQ,3023
4
4
  feldera/enums.py,sha256=MTHBojVANsdRnjbrzCyIOniDIUaH8nTYRfxB7QvajEE,9570
5
5
  feldera/output_handler.py,sha256=64J3ljhOaKIhxdjOKYi-BUz_HnMwROfmN8eE-btYygU,1930
6
- feldera/pipeline.py,sha256=fRtGWYzxZOm6Z93bDjpU68EZ_uDTMdwPL-r-o7EXPTE,35135
6
+ feldera/pipeline.py,sha256=1XNjqvD9MTXLuz6lomuySTF4WZndTVQFv_4OmLkKzq8,35206
7
7
  feldera/pipeline_builder.py,sha256=25tncJd-qiuHWZOezU34oGfDJqFAdjBEMd9QipNfswc,4195
8
8
  feldera/runtime_config.py,sha256=MuYJPd5G_hnu_eDz4ge4BfYvSBSOvOEtv4NYh5sEwqU,4452
9
9
  feldera/stats.py,sha256=XBhkRsV7FXErwWuPP0i3q9W77mzkMo-oThPVEZy5y3U,5028
10
10
  feldera/rest/__init__.py,sha256=Eg-EKUU3RSTDcdxTR_7wNDnCly8VpXEzsZCQUmf-y2M,308
11
11
  feldera/rest/_helpers.py,sha256=q7jWInKp9IiIli8N5o31lDG3hNUbcsJqufZXYHG04ps,222
12
- feldera/rest/_httprequests.py,sha256=e22YbpzOzy7MGo7hk9MOU7ZRTj3F314grY0Ygr-_goI,6636
12
+ feldera/rest/_httprequests.py,sha256=w8tD-_3spAf4vgalJQceIHQ7qw1uvxprDFM2oz3P5QU,7559
13
13
  feldera/rest/config.py,sha256=DYzZKngDEhouTEwqVFd-rDrBN9tWqsU07Jl_BTT4mXs,1008
14
14
  feldera/rest/errors.py,sha256=b4i2JjrbSmej7jdko_FL8UeXklLKenSipwMT80jowaM,1720
15
- feldera/rest/feldera_client.py,sha256=b85YS7gbxpCu5OHK34TDlB96vnt-HYVXY65WeWroDJY,25737
15
+ feldera/rest/feldera_client.py,sha256=21Izb8DVv06LxdxvnByR_Mhm-lOLmKtnAc00PW7bTmc,25977
16
16
  feldera/rest/feldera_config.py,sha256=1pnGbLFMSLvp7Qh_OlPLALSKCSHIktNWKvx6gYU00U4,1374
17
17
  feldera/rest/pipeline.py,sha256=-dGGUdtHMABKrQEclaeuwGI_FOCrQOk6p2aCFV0FdU8,2890
18
18
  feldera/rest/sql_table.py,sha256=qrw-YwMzx5T81zDefNO1KOx7EyypFz1vPwGBzSUB7kc,652
19
19
  feldera/rest/sql_view.py,sha256=hN12mPM0mvwLCIPYywpb12s9Hd2Ws31IlTMXPriMisw,644
20
- feldera-0.111.0.dist-info/METADATA,sha256=_ZJA7SDsigbzHsH0Rl5xISHYH2hgAjhc2L0QHwE53UM,4101
21
- feldera-0.111.0.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
22
- feldera-0.111.0.dist-info/top_level.txt,sha256=fB6yTqrQiO6RCbY1xP2T_mpPoTjDFtJvkJJodiee7d0,8
23
- feldera-0.111.0.dist-info/RECORD,,
20
+ feldera-0.113.0.dist-info/METADATA,sha256=9vLMTZqEujZQQ03xDujHAiKs9g0hr982fEHzVqgXyP4,4057
21
+ feldera-0.113.0.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
22
+ feldera-0.113.0.dist-info/top_level.txt,sha256=fB6yTqrQiO6RCbY1xP2T_mpPoTjDFtJvkJJodiee7d0,8
23
+ feldera-0.113.0.dist-info/RECORD,,