def storeResultsInISPyB(self, _strSubject, _strMessage): strSubject = _strSubject strMessage = _strMessage xsDataResultCharacterisation = self.edPluginControlInterface.getDataOutput( ).getResultCharacterisation() self.xsDataResultMXCuBE.setCharacterisationResult( xsDataResultCharacterisation) xsDataResultControlISPyB = self.edPluginControlInterface.getDataOutput( ).getResultControlISPyB() if xsDataResultControlISPyB != None: self.xsDataResultMXCuBE.setScreeningId( xsDataResultControlISPyB.getScreeningId()) if xsDataResultCharacterisation != None: self.xsDataResultMXCuBE.characterisationResult = xsDataResultCharacterisation strPathCharacterisationResult = os.path.join( self.getWorkingDirectory(), "CharacterisationResult.xml") xsDataResultCharacterisation.exportToFile( strPathCharacterisationResult) self.xsDataResultMXCuBE.setListOfOutputFiles( XSDataString(strPathCharacterisationResult)) # For the moment, create "DNA" style output directory strPathToDNAFileDirectory = self.createDNAFileDirectoryPath( xsDataResultCharacterisation) xsDataDictionaryLogFile = None if not EDUtilsPath.isALBA: if (self.createDNAFileDirectory(strPathToDNAFileDirectory)): xsDataDictionaryLogFile = self.createOutputFileDictionary( xsDataResultCharacterisation, strPathToDNAFileDirectory) strPyArchPathToDNAFileDirectory = EDHandlerESRFPyarchv1_0.createPyarchFilePath( strPathToDNAFileDirectory) if (self.createDNAFileDirectory(strPyArchPathToDNAFileDirectory)): xsDataDictionaryLogFile = self.createOutputFileDictionary( xsDataResultCharacterisation, strPyArchPathToDNAFileDirectory) self.xsDataResultMXCuBE.setOutputFileDictionary( xsDataDictionaryLogFile) if xsDataResultCharacterisation.getStatusMessage(): strMessage += "\n\n" strMessage += xsDataResultCharacterisation.getStatusMessage( ).getValue() if xsDataResultCharacterisation.getShortSummary(): strMessage += "\n\n" strMessage += xsDataResultCharacterisation.getShortSummary( ).getValue() self.sendEmail(strSubject, strMessage) # Fix for bug EDNA-55 : If burning strategy EDNA2html shouldn't be run bRunExecOutputHTML = False xsDataInputMXCuBE = self.getDataInput() xsDataDiffractionPlan = xsDataInputMXCuBE.getDiffractionPlan() if xsDataDiffractionPlan.getStrategyOption() is not None: strStrategyOption = xsDataDiffractionPlan.getStrategyOption( ).getValue() if strStrategyOption.find("-DamPar") != -1: bRunExecOutputHTML = False if (self.edPluginExecOutputHTML is not None) and bRunExecOutputHTML: self.edPluginExecOutputHTML.setDataInput( XSDataFile(XSDataString(strPathToDNAFileDirectory)), "dnaFileDirectory") self.edPluginExecOutputHTML.execute() # Fix for bug MXSUP-251: Put the BEST .par file in the EDNA characterisation root directory xsDataIntegrationResult = xsDataResultCharacterisation.getIntegrationResult( ) if xsDataIntegrationResult: listXSDataIntegrationSubWedgeResult = xsDataIntegrationResult.getIntegrationSubWedgeResult( ) for xsDataIntegrationSubWedgeResult in listXSDataIntegrationSubWedgeResult: if xsDataIntegrationSubWedgeResult.getBestfilePar( ) is not None: strBestfilePar = xsDataIntegrationSubWedgeResult.getBestfilePar( ).getValue() # Put the file one directory above the mxCuBE v1.3 plugin working directory: strDir = os.path.dirname(self.getWorkingDirectory()) strPath = os.path.join(strDir, "bestfile.par") EDUtilsFile.writeFile(strPath, strBestfilePar) break # Execute plugin which creates a simple HTML page self.executeSimpleHTML(xsDataResultCharacterisation) # Upload the best wilson plot path to ISPyB strBestWilsonPlotPath = EDHandlerXSDataISPyBv1_4.getBestWilsonPlotPath( xsDataResultCharacterisation) if strBestWilsonPlotPath is not None and strPyArchPathToDNAFileDirectory is not None: # Copy wilson path to Pyarch strBestWilsonPlotPyarchPath = os.path.join( strPyArchPathToDNAFileDirectory, os.path.basename(strBestWilsonPlotPath)) if not os.path.exists(strBestWilsonPlotPyarchPath): if not os.path.exists( os.path.dirname(strBestWilsonPlotPyarchPath)): os.makedirs( os.path.dirname(strBestWilsonPlotPyarchPath), 755) shutil.copy(strBestWilsonPlotPath, strBestWilsonPlotPyarchPath) self.DEBUG("Best wilson pyarch path: %s " % strBestWilsonPlotPyarchPath) if self.edPluginControlInterface.dataOutput.resultControlISPyB is not None: xsDataInputISPyBSetBestWilsonPlotPath = XSDataInputISPyBSetBestWilsonPlotPath( ) xsDataInputISPyBSetBestWilsonPlotPath.dataCollectionId = self.edPluginControlInterface.dataOutput.resultControlISPyB.dataCollectionId xsDataInputISPyBSetBestWilsonPlotPath.bestWilsonPlotPath = XSDataString( strBestWilsonPlotPyarchPath) edPluginSetBestWilsonPlotPath = self.loadPlugin( "EDPluginISPyBSetBestWilsonPlotPathv1_4", "ISPyBSetBestWilsonPlotPath") edPluginSetBestWilsonPlotPath.dataInput = xsDataInputISPyBSetBestWilsonPlotPath edPluginSetBestWilsonPlotPath.executeSynchronous()