Skip to content

Commit b3c6ef9

Browse files
committed
Put add_note behind version check
1 parent 28a37e9 commit b3c6ef9

File tree

3 files changed

+13
-5
lines changed

3 files changed

+13
-5
lines changed

curifactory/experimental/artifact.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
import hashlib
55
import json
66
import logging
7+
import sys
78
import traceback
89
from functools import partial
910
from uuid import UUID
@@ -323,7 +324,8 @@ def get(self):
323324
# NOTE: stage handles running cachers
324325
return self.obj
325326
except Exception as e:
326-
e.add_note(f"Was trying to retrieve artifact {self.name}")
327+
if sys.version_info >= (3, 11, 0):
328+
e.add_note(f"Was trying to retrieve artifact {self.name}")
327329
manager = cf.get_manager()
328330
stack_str = traceback.format_exc()
329331
manager.record_pipeline_failure(e, stack_str)

curifactory/experimental/caching.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
import json
33
import os
44
import pickle
5+
import sys
56
from pathlib import Path
67
from typing import Any
78

@@ -508,7 +509,8 @@ def save_obj(self, relation_object: duckdb.DuckDBPyRelation):
508509
try:
509510
db.sql(query)
510511
except duckdb.duckdb.ParserException as e:
511-
e.add_note(f"Was trying to run query: {query}")
512+
if sys.version_info >= (3, 11, 0):
513+
e.add_note(f"Was trying to run query: {query}")
512514
raise
513515

514516
# add a metadata row
@@ -552,7 +554,8 @@ def clear_obj(self):
552554
deletion_query = f"DELETE FROM {self.get_table_name()} USING ({self.get_table_name()} INNER JOIN _cftrack_{self.get_table_name()} ON {self.join_condition()}) AS delete_ref WHERE {self.equals_condition('delete_ref')}"
553555
db.sql(deletion_query)
554556
except Exception as e:
555-
e.add_note(f"Was running query: {deletion_query}")
557+
if sys.version_info >= (3, 11, 0):
558+
e.add_note(f"Was running query: {deletion_query}")
556559
raise
557560

558561
db.sql(
@@ -565,7 +568,8 @@ def load_obj(self):
565568
try:
566569
return db.sql(selection_query)
567570
except Exception as e:
568-
e.add_note(f"Was running selection query: {selection_query}")
571+
if sys.version_info >= (3, 11, 0):
572+
e.add_note(f"Was running selection query: {selection_query}")
569573
raise
570574

571575

curifactory/experimental/stage.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
import hashlib
33
import inspect
44
import os
5+
import sys
56
import threading
67
import time
78
from collections.abc import Callable
@@ -938,7 +939,8 @@ def __call__(self): # noqa: C901
938939
self.computed = True
939940
return returns
940941
except Exception as e:
941-
e.add_note(f"Was trying to run stage {self.contextualized_name}")
942+
if sys.version_info >= (3, 11, 0):
943+
e.add_note(f"Was trying to run stage {self.contextualized_name}")
942944
raise
943945

944946
def __repr__(self):

0 commit comments

Comments
 (0)