Skip to content

Commit d10f54b

Browse files
committed
Avoid trying to interpret cached transformations in the SUBMITTED state
1 parent 188c034 commit d10f54b

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

servicex/query_cache.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,9 @@ def cached_queries(self) -> List[TransformedResults]:
197197
with self.lock:
198198
result = [
199199
TransformedResults(**doc)
200-
for doc in self.db.search(transforms.request_id.exists())
200+
for doc in self.db.search(
201+
transforms.request_id.exists() & ~(transforms.status == "SUBMITTED")
202+
)
201203
]
202204
return result
203205

tests/test_query_cache.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -325,6 +325,9 @@ def test_get_transform_request_id(transform_request, completed_status):
325325
request_id = cache.get_transform_request_id(hash_value)
326326
assert request_id == "123456"
327327

328+
# assert that in this state that cached_queries does NOT crash and returns nothing
329+
assert len(cache.cached_queries()) == 0
330+
328331
cache.close()
329332

330333

0 commit comments

Comments
 (0)