diff --git a/integration-tests/templates/data-ibrain2/dropboxes/scripts/commonDropbox.py b/integration-tests/templates/data-ibrain2/dropboxes/scripts/commonDropbox.py index 0dd550dfabe32a7cb6bdceaa81159d0be957e9b1..abd66bdc8abbc547a600d2a4947bd5ac46364534 100755 --- a/integration-tests/templates/data-ibrain2/dropboxes/scripts/commonDropbox.py +++ b/integration-tests/templates/data-ibrain2/dropboxes/scripts/commonDropbox.py @@ -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 diff --git a/integration-tests/templates/data-ibrain2/dropboxes/scripts/hcs_analysis_cell_features_csv.py b/integration-tests/templates/data-ibrain2/dropboxes/scripts/hcs_analysis_cell_features_csv.py index a3276bb96e4c3c9f038c501d56d9eb33110e95f4..f66dfcbd1e41300e3117b9967e508995a3746994 100755 --- a/integration-tests/templates/data-ibrain2/dropboxes/scripts/hcs_analysis_cell_features_csv.py +++ b/integration-tests/templates/data-ibrain2/dropboxes/scripts/hcs_analysis_cell_features_csv.py @@ -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()) diff --git a/integration-tests/templates/data-ibrain2/dropboxes/scripts/hcs_analysis_cell_features_mat.py b/integration-tests/templates/data-ibrain2/dropboxes/scripts/hcs_analysis_cell_features_mat.py index aafd2dce1758da6e868e4c6d2076667a9f2238fa..a7dfb919cdec9e55f189f8c06467225ab8ab4360 100755 --- a/integration-tests/templates/data-ibrain2/dropboxes/scripts/hcs_analysis_cell_features_mat.py +++ b/integration-tests/templates/data-ibrain2/dropboxes/scripts/hcs_analysis_cell_features_mat.py @@ -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()) diff --git a/integration-tests/templates/data-ibrain2/dropboxes/scripts/hcs_analysis_well_features.py b/integration-tests/templates/data-ibrain2/dropboxes/scripts/hcs_analysis_well_features.py index 1558b858e53580e9ddf0c73a27eb1fcdf13fc15f..4c6ba29fba35b171280b160fcd048d5ddf7245f2 100755 --- a/integration-tests/templates/data-ibrain2/dropboxes/scripts/hcs_analysis_well_features.py +++ b/integration-tests/templates/data-ibrain2/dropboxes/scripts/hcs_analysis_well_features.py @@ -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 diff --git a/integration-tests/templates/data-ibrain2/dropboxes/scripts/hcs_analysis_well_quality.py b/integration-tests/templates/data-ibrain2/dropboxes/scripts/hcs_analysis_well_quality.py index bb97d6e3f4adca68d2bdcd61a99651b5acfec0d7..df79b0349a2196cbbd93b69f62ececf7dd8dc409 100755 --- a/integration-tests/templates/data-ibrain2/dropboxes/scripts/hcs_analysis_well_quality.py +++ b/integration-tests/templates/data-ibrain2/dropboxes/scripts/hcs_analysis_well_quality.py @@ -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 diff --git a/integration-tests/templates/data-ibrain2/dropboxes/scripts/hcs_image_overview.py b/integration-tests/templates/data-ibrain2/dropboxes/scripts/hcs_image_overview.py index a596c43cc6dc1308138ef078fbc0448b28532571..873126de5e3dfa3988063c8edb53b69694e415d3 100755 --- a/integration-tests/templates/data-ibrain2/dropboxes/scripts/hcs_image_overview.py +++ b/integration-tests/templates/data-ibrain2/dropboxes/scripts/hcs_image_overview.py @@ -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()) diff --git a/integration-tests/templates/data-ibrain2/dropboxes/scripts/hcs_image_raw.py b/integration-tests/templates/data-ibrain2/dropboxes/scripts/hcs_image_raw.py index 7f639112fd6f4d796abde8edf83fefb706a4762a..3a6e287e10e77ac30bd03c3b8377efe1302756e4 100755 --- a/integration-tests/templates/data-ibrain2/dropboxes/scripts/hcs_image_raw.py +++ b/integration-tests/templates/data-ibrain2/dropboxes/scripts/hcs_image_raw.py @@ -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 diff --git a/integration-tests/templates/data-ibrain2/dropboxes/scripts/hcs_image_segmentation.py b/integration-tests/templates/data-ibrain2/dropboxes/scripts/hcs_image_segmentation.py index a0d9f775c2d4f222b4749c5af5495ea154dd9a3d..a05c08dde09a1d9cc361d7558d99fb158e2b18fe 100755 --- a/integration-tests/templates/data-ibrain2/dropboxes/scripts/hcs_image_segmentation.py +++ b/integration-tests/templates/data-ibrain2/dropboxes/scripts/hcs_image_segmentation.py @@ -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())