mlrun 1.7.0rc50__py3-none-any.whl → 1.7.0rc51__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.
@@ -57,8 +57,25 @@ class TDEngineConnector(TSDBConnector):
57
57
  self._connection = self._create_connection()
58
58
  return self._connection
59
59
 
60
+ def with_retry_on_closed_connection(self, fn, **kwargs):
61
+ try:
62
+ return fn(self.connection, **kwargs)
63
+ except (taosws.QueryError, taosws.FetchError) as err:
64
+ logger.warn(f"TDEngine error: {err}")
65
+ if "Internal error:" in str(err):
66
+ logger.info("Retrying TDEngine query with a new connection")
67
+ try:
68
+ self._connection.close()
69
+ except Exception:
70
+ pass
71
+ self._connection = None
72
+ return fn(self.connection, **kwargs)
73
+ else:
74
+ raise err
75
+
60
76
  def _create_connection(self) -> taosws.Connection:
61
77
  """Establish a connection to the TSDB server."""
78
+ logger.debug("Creating a new connection to TDEngine", project=self.project)
62
79
  conn = taosws.connect(self._tdengine_connection_string)
63
80
  try:
64
81
  conn.execute(f"CREATE DATABASE {self.database}")
@@ -71,6 +88,7 @@ class TDEngineConnector(TSDBConnector):
71
88
  raise mlrun.errors.MLRunTSDBConnectionFailureError(
72
89
  f"Failed to use TDEngine database {self.database}, {mlrun.errors.err_to_str(e)}"
73
90
  )
91
+ logger.debug("Connected to TDEngine", project=self.project)
74
92
  return conn
75
93
 
76
94
  def _init_super_tables(self):
@@ -91,7 +109,9 @@ class TDEngineConnector(TSDBConnector):
91
109
  """Create TDEngine supertables."""
92
110
  for table in self.tables:
93
111
  create_table_query = self.tables[table]._create_super_table_query()
94
- self.connection.execute(create_table_query)
112
+ self.with_retry_on_closed_connection(
113
+ lambda conn: conn.execute(create_table_query)
114
+ )
95
115
 
96
116
  def write_application_event(
97
117
  self,
@@ -137,10 +157,14 @@ class TDEngineConnector(TSDBConnector):
137
157
  )
138
158
 
139
159
  create_table_sql = table._create_subtable_sql(subtable=table_name, values=event)
140
- self.connection.execute(create_table_sql)
160
+ self.with_retry_on_closed_connection(
161
+ lambda conn: conn.execute(create_table_sql)
162
+ )
141
163
 
142
- insert_statement = table._insert_subtable_stmt(
143
- self.connection, subtable=table_name, values=event
164
+ insert_statement = self.with_retry_on_closed_connection(
165
+ lambda conn: table._insert_subtable_stmt(
166
+ conn, subtable=table_name, values=event
167
+ )
144
168
  )
145
169
  insert_statement.add_batch()
146
170
  insert_statement.execute()
@@ -200,18 +224,25 @@ class TDEngineConnector(TSDBConnector):
200
224
  """
201
225
  Delete all project resources in the TSDB connector, such as model endpoints data and drift results.
202
226
  """
227
+ logger.debug(
228
+ "Deleting all project resources using the TDEngine connector",
229
+ project=self.project,
230
+ )
203
231
  for table in self.tables:
204
232
  get_subtable_names_query = self.tables[table]._get_subtables_query(
205
233
  values={mm_schemas.EventFieldType.PROJECT: self.project}
206
234
  )
207
- subtables = self.connection.query(get_subtable_names_query)
235
+ subtables = self.with_retry_on_closed_connection(
236
+ lambda conn: conn.query(get_subtable_names_query)
237
+ )
208
238
  for subtable in subtables:
209
239
  drop_query = self.tables[table]._drop_subtable_query(
210
240
  subtable=subtable[0]
211
241
  )
212
242
  self.connection.execute(drop_query)
213
- logger.info(
214
- f"Deleted all project resources in the TSDB connector for project {self.project}"
243
+ logger.debug(
244
+ "Deleted all project resources using the TDEngine connector",
245
+ project=self.project,
215
246
  )
216
247
 
217
248
  def get_model_endpoint_real_time_metrics(
@@ -282,7 +313,9 @@ class TDEngineConnector(TSDBConnector):
282
313
  )
283
314
  logger.debug("Querying TDEngine", query=full_query)
284
315
  try:
285
- query_result = self.connection.query(full_query)
316
+ query_result = self.with_retry_on_closed_connection(
317
+ lambda conn: conn.query(full_query)
318
+ )
286
319
  except taosws.QueryError as e:
287
320
  raise mlrun.errors.MLRunInvalidArgumentError(
288
321
  f"Failed to query table {table} in database {self.database}, {str(e)}"
@@ -1,4 +1,4 @@
1
1
  {
2
- "git_commit": "fe89f8ec27cecdb512643519d74f5debf285aacb",
3
- "version": "1.7.0-rc50"
2
+ "git_commit": "a8919d5f6a549f9434544e023887b886d432d5c9",
3
+ "version": "1.7.0-rc51"
4
4
  }
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: mlrun
3
- Version: 1.7.0rc50
3
+ Version: 1.7.0rc51
4
4
  Summary: Tracking and config of machine learning runs
5
5
  Home-page: https://github.com/mlrun/mlrun
6
6
  Author: Yaron Haviv
@@ -84,7 +84,7 @@ Requires-Dist: redis ~=4.3 ; extra == 'all'
84
84
  Requires-Dist: s3fs <2024.7,>=2023.9.2 ; extra == 'all'
85
85
  Requires-Dist: snowflake-connector-python ~=3.7 ; extra == 'all'
86
86
  Requires-Dist: sqlalchemy ~=1.4 ; extra == 'all'
87
- Requires-Dist: taos-ws-py ~=0.3.3 ; extra == 'all'
87
+ Requires-Dist: taos-ws-py ==0.3.2 ; extra == 'all'
88
88
  Provides-Extra: api
89
89
  Requires-Dist: uvicorn ~=0.27.1 ; extra == 'api'
90
90
  Requires-Dist: dask-kubernetes ~=0.11.0 ; extra == 'api'
@@ -137,7 +137,7 @@ Requires-Dist: redis ~=4.3 ; extra == 'complete'
137
137
  Requires-Dist: s3fs <2024.7,>=2023.9.2 ; extra == 'complete'
138
138
  Requires-Dist: snowflake-connector-python ~=3.7 ; extra == 'complete'
139
139
  Requires-Dist: sqlalchemy ~=1.4 ; extra == 'complete'
140
- Requires-Dist: taos-ws-py ~=0.3.3 ; extra == 'complete'
140
+ Requires-Dist: taos-ws-py ==0.3.2 ; extra == 'complete'
141
141
  Provides-Extra: complete-api
142
142
  Requires-Dist: adlfs ==2023.9.0 ; extra == 'complete-api'
143
143
  Requires-Dist: aiobotocore <2.16,>=2.5.0 ; extra == 'complete-api'
@@ -174,7 +174,7 @@ Requires-Dist: redis ~=4.3 ; extra == 'complete-api'
174
174
  Requires-Dist: s3fs <2024.7,>=2023.9.2 ; extra == 'complete-api'
175
175
  Requires-Dist: snowflake-connector-python ~=3.7 ; extra == 'complete-api'
176
176
  Requires-Dist: sqlalchemy ~=1.4 ; extra == 'complete-api'
177
- Requires-Dist: taos-ws-py ~=0.3.3 ; extra == 'complete-api'
177
+ Requires-Dist: taos-ws-py ==0.3.2 ; extra == 'complete-api'
178
178
  Requires-Dist: timelength ~=1.1 ; extra == 'complete-api'
179
179
  Requires-Dist: uvicorn ~=0.27.1 ; extra == 'complete-api'
180
180
  Requires-Dist: memray ~=1.12 ; (sys_platform != "win32") and extra == 'complete-api'
@@ -209,7 +209,7 @@ Requires-Dist: snowflake-connector-python ~=3.7 ; extra == 'snowflake'
209
209
  Provides-Extra: sqlalchemy
210
210
  Requires-Dist: sqlalchemy ~=1.4 ; extra == 'sqlalchemy'
211
211
  Provides-Extra: tdengine
212
- Requires-Dist: taos-ws-py ~=0.3.3 ; extra == 'tdengine'
212
+ Requires-Dist: taos-ws-py ==0.3.2 ; extra == 'tdengine'
213
213
 
214
214
  <a id="top"></a>
215
215
  [![Build Status](https://github.com/mlrun/mlrun/actions/workflows/build.yaml/badge.svg?branch=development)](https://github.com/mlrun/mlrun/actions/workflows/build.yaml?query=branch%3Adevelopment)
@@ -245,7 +245,7 @@ mlrun/model_monitoring/db/tsdb/helpers.py,sha256=0oUXc4aUkYtP2SGP6jTb3uPPKImIUsV
245
245
  mlrun/model_monitoring/db/tsdb/tdengine/__init__.py,sha256=vgBdsKaXUURKqIf3M0y4sRatmSVA4CQiJs7J5dcVBkQ,620
246
246
  mlrun/model_monitoring/db/tsdb/tdengine/schemas.py,sha256=7yZFn42sF597TBumVM-xhh1bjIQCbIo6qIvMK5WpWO0,10503
247
247
  mlrun/model_monitoring/db/tsdb/tdengine/stream_graph_steps.py,sha256=Hb0vcCBP-o0ET78mU4P32fnhUL65QZv-pMuv2lnCby4,1586
248
- mlrun/model_monitoring/db/tsdb/tdengine/tdengine_connector.py,sha256=L4cDFfuGOVyF_bnPbUJ_xhMEt_DGwY6FWwoO4VEXSW4,18671
248
+ mlrun/model_monitoring/db/tsdb/tdengine/tdengine_connector.py,sha256=w9BzsqMWGvc3knMm6J0B6jeDAo4iWLKm-66QKIf3JaQ,19942
249
249
  mlrun/model_monitoring/db/tsdb/v3io/__init__.py,sha256=aL3bfmQsUQ-sbvKGdNihFj8gLCK3mSys0qDcXtYOwgc,616
250
250
  mlrun/model_monitoring/db/tsdb/v3io/stream_graph_steps.py,sha256=mbmhN4f_F58ptVjhwoMF6ifZSdnZWhK7x8eNsWS39IA,6217
251
251
  mlrun/model_monitoring/db/tsdb/v3io/v3io_connector.py,sha256=1H-IBXPNJPRAaxDMGWpUU25QqfR87LpZbJ03vaJkICs,32858
@@ -341,11 +341,11 @@ mlrun/utils/notifications/notification/ipython.py,sha256=ZtVL30B_Ha0VGoo4LxO-voT
341
341
  mlrun/utils/notifications/notification/slack.py,sha256=wqpFGr5BTvFO5KuUSzFfxsgmyU1Ohq7fbrGeNe9TXOk,7006
342
342
  mlrun/utils/notifications/notification/webhook.py,sha256=cb9w1Mc8ENfJBdgan7iiVHK9eVls4-R3tUxmXM-P-8I,4746
343
343
  mlrun/utils/version/__init__.py,sha256=7kkrB7hEZ3cLXoWj1kPoDwo4MaswsI2JVOBpbKgPAgc,614
344
- mlrun/utils/version/version.json,sha256=slRKoCCm9V9GXOEcyhpf1FNyOfO-3lk6SydAW7BkmVg,89
344
+ mlrun/utils/version/version.json,sha256=mIhH_8cnM4P-kdwi7BT1WdUxal7WaIr2QqHt5HbvdtI,89
345
345
  mlrun/utils/version/version.py,sha256=eEW0tqIAkU9Xifxv8Z9_qsYnNhn3YH7NRAfM-pPLt1g,1878
346
- mlrun-1.7.0rc50.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
347
- mlrun-1.7.0rc50.dist-info/METADATA,sha256=0FpVzUdgaF0PueIufozDnrdMySc9QYVTznJOkgnEEjw,24262
348
- mlrun-1.7.0rc50.dist-info/WHEEL,sha256=GV9aMThwP_4oNCtvEC2ec3qUYutgWeAzklro_0m4WJQ,91
349
- mlrun-1.7.0rc50.dist-info/entry_points.txt,sha256=1Owd16eAclD5pfRCoJpYC2ZJSyGNTtUr0nCELMioMmU,46
350
- mlrun-1.7.0rc50.dist-info/top_level.txt,sha256=NObLzw3maSF9wVrgSeYBv-fgnHkAJ1kEkh12DLdd5KM,6
351
- mlrun-1.7.0rc50.dist-info/RECORD,,
346
+ mlrun-1.7.0rc51.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
347
+ mlrun-1.7.0rc51.dist-info/METADATA,sha256=gB94QVVHmvDU2L8d0NTi70uF2KFrdBxG5n5qMPUuTyA,24262
348
+ mlrun-1.7.0rc51.dist-info/WHEEL,sha256=GV9aMThwP_4oNCtvEC2ec3qUYutgWeAzklro_0m4WJQ,91
349
+ mlrun-1.7.0rc51.dist-info/entry_points.txt,sha256=1Owd16eAclD5pfRCoJpYC2ZJSyGNTtUr0nCELMioMmU,46
350
+ mlrun-1.7.0rc51.dist-info/top_level.txt,sha256=NObLzw3maSF9wVrgSeYBv-fgnHkAJ1kEkh12DLdd5KM,6
351
+ mlrun-1.7.0rc51.dist-info/RECORD,,