Skip to content
Snippets Groups Projects
Commit 35ecd8fc authored by tpylak's avatar tpylak
Browse files

LMS-2164 bugfixes in iBrain dropboxes

SVN: 20658
parent b55a1575
No related branches found
No related tags found
No related merge requests found
Showing with 51 additions and 20 deletions
......@@ -77,7 +77,7 @@ class AbstractMetadataParser(AbstractPropertiesParser):
class AcquiredDatasetMetadataParser(AbstractMetadataParser):
PLATE_CODE_PRPOPERTY = "barcode"
INSTRUMENT_PROPERTY = "instrument.id"
TIMESTAMP_PROPERTY = "timestamp" # not used
TIMESTAMP_PROPERTY = "timestamp"
# All dataset properties.
# Returns:
......@@ -86,6 +86,7 @@ class AcquiredDatasetMetadataParser(AbstractMetadataParser):
properties = AbstractPropertiesParser.getDatasetPropertiesIter(self)
properties = [ (key, value) for (key, value) in properties if key != "ibrain2.assay.id" ]
properties.append((self.INSTRUMENT_PROPERTY, self.get(self.INSTRUMENT_PROPERTY)))
properties.append((self.TIMESTAMP_PROPERTY, self.get(self.TIMESTAMP_PROPERTY)))
return properties
def getPlateCode(self):
......@@ -254,7 +255,10 @@ def createSuccessStatus(iBrain2DatasetId, dataset, incomingPath):
RegistrationConfirmationUtils().createSuccessStatus(iBrain2DatasetId, datasetCode, incomingPath)
def createFailureStatus(iBrain2DatasetId, throwable, incoming):
RegistrationConfirmationUtils().createFailureStatus(iBrain2DatasetId, throwable.getMessage(), incoming.getPath())
msg = throwable.getMessage()
if msg == None:
msg = throwable.toString()
RegistrationConfirmationUtils().createFailureStatus(iBrain2DatasetId, msg, incoming.getPath())
# -------------- TODO: remove tests
......
......@@ -10,8 +10,12 @@ reload(commonDropbox)
# so that the rollback can use it as well.
iBrain2DatasetId = None
def rollback_transaction(service, transaction, algorithmRunner, throwable):
def rollback_service(service, throwable):
global iBrain2DatasetId
commonDropbox.createFailureStatus(iBrain2DatasetId, throwable, incoming)
def rollback_transaction(service, transaction, algorithmRunner, throwable):
rollback_service(service, throwable)
if incoming.isDirectory():
metadataParser = commonDropbox.DerivedDatasetMetadataParser(incoming.getPath())
......
......@@ -10,8 +10,12 @@ reload(commonDropbox)
# so that the rollback can use it as well.
iBrain2DatasetId = None
def rollback_transaction(service, transaction, algorithmRunner, throwable):
def rollback_service(service, throwable):
global iBrain2DatasetId
commonDropbox.createFailureStatus(iBrain2DatasetId, throwable, incoming)
def rollback_transaction(service, transaction, algorithmRunner, throwable):
rollback_service(service, throwable)
if incoming.isDirectory():
metadataParser = commonDropbox.DerivedDatasetMetadataParser(incoming.getPath())
......
......@@ -50,8 +50,12 @@ def register(incomingPath):
dataset.setFileFormatType('CSV')
commonDropbox.registerDerivedDataset(state, transaction, dataset, incoming, metadataParser)
def rollback_transaction(service, transaction, algorithmRunner, throwable):
def rollback_service(service, throwable):
global iBrain2DatasetId
commonDropbox.createFailureStatus(iBrain2DatasetId, throwable, incoming)
def rollback_transaction(service, transaction, algorithmRunner, throwable):
rollback_service(service, throwable)
if incoming.isDirectory():
register(incoming.getPath())
\ No newline at end of file
......@@ -37,8 +37,12 @@ def register(incomingPath):
dataset.setFileFormatType('CSV')
commonDropbox.registerDerivedDataset(state, transaction, dataset, incoming, metadataParser)
def rollback_transaction(service, transaction, algorithmRunner, throwable):
def rollback_service(service, throwable):
global iBrain2DatasetId
commonDropbox.createFailureStatus(iBrain2DatasetId, throwable, incoming)
def rollback_transaction(service, transaction, algorithmRunner, throwable):
rollback_service(service, throwable)
if incoming.isDirectory():
register(incoming.getPath())
\ No newline at end of file
......@@ -31,9 +31,13 @@ def register(incomingPath):
commonDropbox.setImageDatasetPropertiesAndRegister(imageDataset, metadataParser, incoming, service, factory)
def rollback_transaction(service, transaction, algorithmRunner, throwable):
def rollback_service(service, throwable):
global iBrain2DatasetId
commonDropbox.createFailureStatus(iBrain2DatasetId, throwable, incoming)
def rollback_transaction(service, transaction, algorithmRunner, throwable):
rollback_service(service, throwable)
if incoming.isDirectory():
register(incoming.getPath())
......@@ -11,6 +11,8 @@ PLATE_TYPE_CODE = "PLATE"
SIRNA_EXP_TYPE = "SIRNA_HCS"
PLATE_GEOMETRY_PROPERTY_CODE = "$PLATE_GEOMETRY"
iBrain2DatasetId = None
def createPlateWithExperimentIfNeeded(transaction, assayParser, plateCode, spaceCode, plateGeometry):
projectCode = assayParser.get(assayParser.EXPERIMENTER_PROPERTY)
experiment = assayParser.get(assayParser.ASSAY_ID_PROPERTY)
......@@ -38,9 +40,13 @@ def createPlateWithExperimentIfNeeded(transaction, assayParser, plateCode, space
plate.setExperiment(experiment)
return plate
iBrain2DatasetId = None
def rollback_service(service, throwable):
global iBrain2DatasetId
commonDropbox.createFailureStatus(iBrain2DatasetId, throwable, incoming)
def rollback_transaction(service, transaction, algorithmRunner, throwable):
rollback_service(service, throwable)
if incoming.isDirectory():
incomingPath = incoming.getPath()
metadataParser = commonDropbox.AcquiredDatasetMetadataParser(incomingPath)
......@@ -69,8 +75,5 @@ if incoming.isDirectory():
dataset = tr.createNewDataSet(imageRegistrationDetails)
dataset.setSample(plate)
imageDataSetFolder = tr.moveFile(incomingPath, dataset)
tr.commit()
commonDropbox.createSuccessStatus(iBrain2DatasetId, dataset, incomingPath)
def rollback_transaction(service, transaction, algorithmRunner, throwable):
commonDropbox.createFailureStatus(iBrain2DatasetId, throwable, incoming)
\ No newline at end of file
if tr.commit():
commonDropbox.createSuccessStatus(iBrain2DatasetId, dataset, incomingPath)
\ No newline at end of file
......@@ -12,6 +12,13 @@ reload(commonDropbox)
# so that the rollback can use it as well.
iBrain2DatasetId = None
def rollback_service(service, throwable):
global iBrain2DatasetId
commonDropbox.createFailureStatus(iBrain2DatasetId, throwable, incoming)
def rollback_transaction(service, transaction, algorithmRunner, throwable):
rollback_service(service, throwable)
def register(incomingPath):
metadataParser = commonDropbox.DerivedDatasetMetadataParser(incomingPath)
global iBrain2DatasetId
......@@ -34,9 +41,6 @@ def register(incomingPath):
imageDataset.setOriginalDataStorageFormat(OriginalDataStorageFormat.HDF5)
commonDropbox.setImageDatasetPropertiesAndRegister(imageDataset, metadataParser, incoming, service, factory)
def rollback_transaction(service, transaction, algorithmRunner, throwable):
commonDropbox.createFailureStatus(iBrain2DatasetId, throwable, incoming)
if incoming.isDirectory():
register(incoming.getPath())
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment