Skip to content

Commit

Permalink
ISPyB LIMS: simplify create_session() method
Browse files Browse the repository at this point in the history
After creating a new proposal session, just return a Session
object.

Skip loading more sessions and constructing LimsSessionManager
object. It's not needed and makes it harder to use
create_session() method.
  • Loading branch information
elmjag authored and marcus-oscarsson committed Feb 11, 2025
1 parent 7311920 commit e24eec1
Showing 1 changed file with 2 additions and 9 deletions.
11 changes: 2 additions & 9 deletions mxcubecore/HardwareObjects/abstract/ISPyBDataAdapter.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,9 +128,7 @@ def __create_client(self, url: str):
def isEnabled(self) -> object:
return self._shipping # type: ignore

def create_session(
self, proposal_id: str, beamline_name: str
) -> LimsSessionManager:
def create_session(self, proposal_id: str, beamline_name: str) -> Session:

try:

Expand Down Expand Up @@ -163,12 +161,7 @@ def create_session(
"Session created. session_id=%s" % session_id
)
response = self._collection.service.findSession(session_id)
session: Session = self.__to_session(asdict(response))
return self.get_sessions_by_code_and_number(
session.code,
session.number,
beamline_name,
)
return self.__to_session(asdict(response))
except Exception:
raise

Expand Down

0 comments on commit e24eec1

Please sign in to comment.