Skip to content

Commit

Permalink
Update object model to retrieve gridinfo
Browse files Browse the repository at this point in the history
  • Loading branch information
Anthchirp committed Oct 5, 2018
1 parent 4d85b59 commit 9cd501e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 12 deletions.
11 changes: 0 additions & 11 deletions ispyb/model/__future__.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,20 +79,9 @@ def __exit__(cm, *args):

import ispyb.model.datacollection
ispyb.model.datacollection.DataCollection.integrations = _get_linked_autoprocintegration_for_dc
import ispyb.model.gridinfo
ispyb.model.gridinfo.GridInfo.reload = _get_gridinfo
import ispyb.model.processingprogram
ispyb.model.processingprogram.ProcessingProgram.reload = _get_autoprocprogram

def _get_gridinfo(self):
# https://jira.diamond.ac.uk/browse/MXSW-1173
with _db_cc() as cursor:
cursor.run("SELECT * "
"FROM GridInfo "
"WHERE dataCollectionGroupId = %s "
"LIMIT 1;", self._dcgid)
self._data = cursor.fetchone()

def _get_autoprocprogram(self):
# https://jira.diamond.ac.uk/browse/SCI-7414
with _db_cc() as cursor:
Expand Down
6 changes: 5 additions & 1 deletion ispyb/model/gridinfo.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from __future__ import absolute_import, division, print_function

import ispyb.exception
import ispyb.model

class GridInfo(ispyb.model.DBCache):
Expand All @@ -24,7 +25,10 @@ def __init__(self, dcgid, db_conn, preload=None):

def reload(self):
'''Load/update information from the database.'''
raise NotImplementedError('TODO: Not implemented yet')
try:
self._data = self._db.mx_acquisition.get_dcg_grid(self._dcgid)[0]
except ispyb.exception.ISPyBNoResultException:
self._data = None

@property
def dcgid(self):
Expand Down

0 comments on commit 9cd501e

Please sign in to comment.