Skip to content

Commit

Permalink
Improved logging and hypervisor
Browse files Browse the repository at this point in the history
  • Loading branch information
JBorrow committed Aug 12, 2024
1 parent 68f26e7 commit 09064c2
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
8 changes: 7 additions & 1 deletion librarian_background/hypervisor.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
from hera_librarian.models.checkin import CheckinStatusRequest, CheckinStatusResponse
from hera_librarian.utils import compare_checksums
from librarian_server.database import get_session
from librarian_server.logger import ErrorCategory, ErrorSeverity, log_to_database
from librarian_server.logger import ErrorCategory, ErrorSeverity, log, log_to_database
from librarian_server.orm import (
Librarian,
OutgoingTransfer,
Expand Down Expand Up @@ -256,11 +256,17 @@ def handle_stale_incoming_transfer(

if source_status in [TransferStatus.CANCELLED, TransferStatus.FAILED]:
# This one's a gimmie.
log.error(
f"Found end status for incoming transfer {transfer.id} on remote, cancelling"
)
transfer.fail_transfer(session=session, commit=True)
return False

if source_status == transfer.status:
# This is the remote's responsibility.
log.info(
f"Found same for incoming transfer {transfer.id} on remote, continuing"
)
return True

# We only get here in annoying scenarios.
Expand Down
5 changes: 0 additions & 5 deletions librarian_server/orm/transfer.py
Original file line number Diff line number Diff line change
Expand Up @@ -154,11 +154,6 @@ def fail_transfer(self, session: "Session", commit: bool = True):
request=request,
response=CheckinUpdateResponse,
)

if not response.success:
raise Exception(
"Remote librarian refused or failed to set transfer status to FAILED."
)
except Exception as e:
log.error(
f"Failed to communicate to remote librarian that transfer {self.id} "
Expand Down

0 comments on commit 09064c2

Please sign in to comment.