Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 13 additions & 8 deletions src/murfey/server/ispyb.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,8 @@
)
)
log.info("Loaded ISPyB database session")
except AttributeError:
# Catch all errors associated with loading ISPyB database
except Exception:
log.error("Error loading ISPyB session", exc_info=True)
ISPyBSession = lambda: None

Expand All @@ -66,13 +67,17 @@
self.transport = workflows.transport.lookup(transport_type)()
self.transport.connect()
self.feedback_queue = ""
self.ispyb = (
ispyb.open(credentials=security_config.ispyb_credentials)
if security_config.ispyb_credentials
else None
)
if self.ispyb is not None:
print("Loaded ISPyB databse")
try:

Check warning on line 70 in src/murfey/server/ispyb.py

View check run for this annotation

Codecov / codecov/patch

src/murfey/server/ispyb.py#L70

Added line #L70 was not covered by tests
# Attempt to connect to ISPyB if credentials files provided
self.ispyb = (

Check warning on line 72 in src/murfey/server/ispyb.py

View check run for this annotation

Codecov / codecov/patch

src/murfey/server/ispyb.py#L72

Added line #L72 was not covered by tests
ispyb.open(credentials=security_config.ispyb_credentials)
if security_config.ispyb_credentials
else None
)
except Exception:

Check warning on line 77 in src/murfey/server/ispyb.py

View check run for this annotation

Codecov / codecov/patch

src/murfey/server/ispyb.py#L77

Added line #L77 was not covered by tests
# Log error and return None if the connection fails
log.error("Error encountered connecting to ISPyB server", exc_info=True)
self.ispyb = None

Check warning on line 80 in src/murfey/server/ispyb.py

View check run for this annotation

Codecov / codecov/patch

src/murfey/server/ispyb.py#L79-L80

Added lines #L79 - L80 were not covered by tests
self._connection_callback: Callable | None = None

def reconnect(self):
Expand Down