From 35ecd8fcbb2145d063ba17ca0c9533e3c3808887 Mon Sep 17 00:00:00 2001 From: tpylak <tpylak> Date: Tue, 5 Apr 2011 14:31:58 +0000 Subject: [PATCH] LMS-2164 bugfixes in iBrain dropboxes SVN: 20658 --- .../dropboxes/scripts/commonDropbox.py | 8 ++++++-- .../scripts/hcs_analysis_cell_features_csv.py | 6 +++++- .../scripts/hcs_analysis_cell_features_mat.py | 6 +++++- .../scripts/hcs_analysis_well_features.py | 6 +++++- .../scripts/hcs_analysis_well_quality.py | 6 +++++- .../dropboxes/scripts/hcs_image_overview.py | 8 ++++++-- .../dropboxes/scripts/hcs_image_raw.py | 19 +++++++++++-------- .../scripts/hcs_image_segmentation.py | 12 ++++++++---- 8 files changed, 51 insertions(+), 20 deletions(-) diff --git a/integration-tests/templates/data-ibrain2/dropboxes/scripts/commonDropbox.py b/integration-tests/templates/data-ibrain2/dropboxes/scripts/commonDropbox.py index 0dd550dfabe..abd66bdc8ab 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 a3276bb96e4..f66dfcbd1e4 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 aafd2dce175..a7dfb919cde 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 1558b858e53..4c6ba29fba3 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 bb97d6e3f4a..df79b0349a2 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 a596c43cc6d..873126de5e3 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 7f639112fd6..3a6e287e10e 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 a0d9f775c2d..a05c08dde09 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()) -- GitLab