Skip to content

Commit

Permalink
Fixed transaction not found bug in _catalog_put
Browse files Browse the repository at this point in the history
  • Loading branch information
nmassey001 committed Nov 20, 2024
1 parent 4b56edb commit 5b166fd
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
2 changes: 2 additions & 0 deletions nlds/rabbit/consumer.py
Original file line number Diff line number Diff line change
Expand Up @@ -570,6 +570,8 @@ def run(self):

# set up SigTerm handler
signal.signal(signal.SIGTERM, self.exit)
# set up SigHup handler
signal.signal(signal.SIGHUP, self.exit)

while self.loop:
self.get_connection()
Expand Down
16 changes: 13 additions & 3 deletions nlds_processors/catalog/catalog_worker.py
Original file line number Diff line number Diff line change
Expand Up @@ -440,14 +440,24 @@ def _catalog_put(self, body: Dict, rk_origin: str) -> None:
)
except CatalogError as e:
# could not find holding so mark all files as failed and return
holding = None
for f in filelist:
pd = PathDetails.from_dict(f)
pd.failure_reason = e.message
self.failedlist.append(pd)
else:
# get or create the transaction
transaction = self._get_or_create_transaction(transaction_id, holding)

if holding:
try:
# get or create the transaction
transaction = self._get_or_create_transaction(transaction_id, holding)
except CatalogError as e:
transaction = None
for f in filelist:
pd = PathDetails.from_dict(f)
pd.failure_reason = e.message
self.failedlist.append(pd)

if holding and transaction:
# loop over the filelist
for f in filelist:
# convert to PathDetails class
Expand Down

0 comments on commit 5b166fd

Please sign in to comment.