def createDataInputCharacterisationFromDataFiles(self, _pyListXSDataFile): """ This method takes as input a list of paths to XML data files. It parses these files and create a single XSDataInputCharacterisation object. """ EDVerbose.DEBUG( "EDPluginControlCCP4iv1_1.createDataInputCharacterisationFromDataFiles" ) xsDataInputCharacterisation = None for xsDataInputFile in _pyListXSDataFile: try: pyStrInputFileContent = EDUtilsFile.readFile( xsDataInputFile.getPath().getValue()) xsDataInputCharacterisationCurrent = XSDataInputCharacterisation.parseString( pyStrInputFileContent) except Exception, detail: errorMessage = EDMessage.ERROR_EXECUTION_03 % ( 'EDPluginControlCCP4iv1_1.preProcess', 'EDPluginControlCCP4iv1_1', detail) EDVerbose.error(errorMessage) self.addErrorMessage(errorMessage) raise RuntimeError, errorMessage if (xsDataInputCharacterisationCurrent is None): errorMessage = EDMessage.ERROR_EXECUTION_03 % ( 'EDPluginControlCCP4iv1_1.preProcess', 'EDPluginControlCCP4iv1_1', "None data collection") EDVerbose.error(errorMessage) self.addErrorMessage(errorMessage) raise RuntimeError, errorMessage else: # Instantiate the xsDataInputCharacterisation object if it's not already done. if (xsDataInputCharacterisation is None): xsDataInputCharacterisation = XSDataInputCharacterisation() xsDataInputCharacterisation.setDataCollection( xsDataInputCharacterisationCurrent.getDataCollection())
def createDataInputCharacterisationFromDataFiles(self, _pyListXSDataFile): """ This method takes as input a list of paths to XML data files. It parses these files and create a single XSDataInputCharacterisation object. """ EDVerbose.DEBUG("EDPluginControlCCP4iv1_1.createDataInputCharacterisationFromDataFiles") xsDataInputCharacterisation = None for xsDataInputFile in _pyListXSDataFile: try: pyStrInputFileContent = EDUtilsFile.readFile(xsDataInputFile.getPath().getValue()) xsDataInputCharacterisationCurrent = XSDataInputCharacterisation.parseString(pyStrInputFileContent) except Exception, detail: errorMessage = EDMessage.ERROR_EXECUTION_03 % ('EDPluginControlCCP4iv1_1.preProcess', 'EDPluginControlCCP4iv1_1', detail) EDVerbose.error(errorMessage) self.addErrorMessage(errorMessage) raise RuntimeError, errorMessage if (xsDataInputCharacterisationCurrent is None): errorMessage = EDMessage.ERROR_EXECUTION_03 % ('EDPluginControlCCP4iv1_1.preProcess', 'EDPluginControlCCP4iv1_1', "None data collection") EDVerbose.error(errorMessage) self.addErrorMessage(errorMessage) raise RuntimeError, errorMessage else: # Instantiate the xsDataInputCharacterisation object if it's not already done. if (xsDataInputCharacterisation is None): xsDataInputCharacterisation = XSDataInputCharacterisation() xsDataInputCharacterisation.setDataCollection(xsDataInputCharacterisationCurrent.getDataCollection())
def runMXv1Pipeline(): strLogFileName = os.path.join(returnWorkingDirectory(), "wsgi-server.log") EDVerbose.setLogFileName(strLogFileName) strInput = str(request['wsgi.input'].read(int(request['CONTENT_LENGTH']))) if strInput: # Take the parameters string, split off the title and run the bash script to generate the input char. XML listParams = shlex.split(strInput) strComments = listParams[0] # the 1st item strShortComments = listParams[1] # the 2nd item strWorkingDir = listParams[2] # the 3rd item strHTMLResultDir = listParams[3] # the 4th item os.chdir(strWorkingDir) strParamString = " ".join(listParams[4:]) # all but the first four items edPluginMxv1ParamsToXML = EDFactoryPluginStatic.loadPlugin('EDPluginMxv1ParamsToXMLv1_0') edPluginMxv1ParamsToXML.setDataInput(XSDataString(strParamString), "paramString") edPluginMxv1ParamsToXML.executeSynchronous() xsDataFile = edPluginMxv1ParamsToXML.getDataOutput() # Read the XML and parse it into an object hierarchy strXMLFile = xsDataFile.getPath().getValue() f = open(strXMLFile, 'r') xml = f.read() f.close() xsDataInputCharacterisation = XSDataInputCharacterisation.parseString(xml) # Run the MXv1 application pipeline edApplicationMXv1Characterisation = EDApplicationMXv1Characterisation(_strPluginName="EDPluginControlInterfacev1_2", \ _strConfigurationFileName=strConfigurationFilePath, \ _xsDataInputCharacterisation=xsDataInputCharacterisation, \ _strComments=strComments, \ _strShortComments=strShortComments) edApplicationMXv1Characterisation.execute() # Run the EDNA2HTML generator on the output from the MXv1 application edPluginExecOutputHTML = EDFactoryPluginStatic.loadPlugin('EDPluginExecOutputHTMLv1_0') edPluginExecOutputHTML.setDataInput(XSDataString(strComments), "title") strWorkingDir = os.path.join(strWorkingDir, edApplicationMXv1Characterisation.getWorkingDir()) edPluginExecOutputHTML.setDataInput(XSDataString(strWorkingDir), "workingDir") #strBaseDir = os.path.join(strHTMLResultDir, "edna") #edPluginExecOutputHTML.setDataInput(XSDataString(strBaseDir), "basename") edPluginExecOutputHTML.setDataInput(XSDataString(strHTMLResultDir), "basename") edPluginExecOutputHTML.executeSynchronous() strPathToHTMLFile = "" if (edPluginExecOutputHTML.hasDataOutput("htmlFile")): strPathToHTMLFile = edPluginExecOutputHTML.getDataOutput("htmlFile")[0].getPath().getValue() else: EDVerbose.ERROR("edna-mxv1-wsgi-server: edPluginExecOutputHTML has no dataOutput htmlFile!") if strPathToHTMLFile =="": EDVerbose.ERROR("edna-mxv1-wsgi-server: Returning empty string") return strPathToHTMLFile else: return strInput
def testSetDataInput(self): edPluginControlCharacterisationv1_1 = self.createPlugin() xsPluginItemGood01 = self.getPluginConfiguration(os.path.join(self.getPluginTestsDataHome(), "XSConfiguration.xml")) edPluginControlCharacterisationv1_1.setConfiguration(xsPluginItemGood01) edPluginControlCharacterisationv1_1.configure() edStringXMLInput = self.readAndParseFile(self.strReferenceInputFile) edPluginControlCharacterisationv1_1.setDataInput(edStringXMLInput) from XSDataMXv1 import XSDataInputCharacterisation xsDataInputCharacterisationReference = XSDataInputCharacterisation.parseString(edStringXMLInput) xsDataInputCharacterisationv11 = edPluginControlCharacterisationv1_1.getDataInput() EDAssert.equal(xsDataInputCharacterisationReference.marshal(), xsDataInputCharacterisationv11.marshal())
def testSetDataInput(self): edPluginControlCharacterisationv1_1 = self.createPlugin() xsPluginItemGood01 = self.getPluginConfiguration( os.path.join(self.getPluginTestsDataHome(), "XSConfiguration.xml")) edPluginControlCharacterisationv1_1.setConfiguration( xsPluginItemGood01) edPluginControlCharacterisationv1_1.configure() edStringXMLInput = self.readAndParseFile(self.strReferenceInputFile) edPluginControlCharacterisationv1_1.setDataInput(edStringXMLInput) from XSDataMXv1 import XSDataInputCharacterisation xsDataInputCharacterisationReference = XSDataInputCharacterisation.parseString( edStringXMLInput) xsDataInputCharacterisationv11 = edPluginControlCharacterisationv1_1.getDataInput( ) EDAssert.equal(xsDataInputCharacterisationReference.marshal(), xsDataInputCharacterisationv11.marshal())
def testCheckParameters(self): strXMLInput = self.readAndParseFile(self.strPathToReferenceInput) xsDataInput = XSDataInputCharacterisation.parseString(strXMLInput) edPluginExecCharacterisation = self.createPlugin() edPluginExecCharacterisation.setDataInput(xsDataInput) edPluginExecCharacterisation.checkParameters()
def runMXv1Pipeline(): strLogFileName = os.path.join(returnWorkingDirectory(), "wsgi-server.log") EDVerbose.setLogFileName(strLogFileName) strInput = str(request['wsgi.input'].read(int(request['CONTENT_LENGTH']))) if strInput: # Take the parameters string, split off the title and run the bash script to generate the input char. XML listParams = shlex.split(strInput) strComments = listParams[0] # the 1st item strShortComments = listParams[1] # the 2nd item strWorkingDir = listParams[2] # the 3rd item strHTMLResultDir = listParams[3] # the 4th item os.chdir(strWorkingDir) strParamString = " ".join( listParams[4:]) # all but the first four items edPluginMxv1ParamsToXML = EDFactoryPluginStatic.loadPlugin( 'EDPluginMxv1ParamsToXMLv1_0') edPluginMxv1ParamsToXML.setDataInput(XSDataString(strParamString), "paramString") edPluginMxv1ParamsToXML.executeSynchronous() xsDataFile = edPluginMxv1ParamsToXML.getDataOutput() # Read the XML and parse it into an object hierarchy strXMLFile = xsDataFile.getPath().getValue() f = open(strXMLFile, 'r') xml = f.read() f.close() xsDataInputCharacterisation = XSDataInputCharacterisation.parseString( xml) # Run the MXv1 application pipeline edApplicationMXv1Characterisation = EDApplicationMXv1Characterisation(_strPluginName="EDPluginControlInterfacev1_2", \ _strConfigurationFileName=strConfigurationFilePath, \ _xsDataInputCharacterisation=xsDataInputCharacterisation, \ _strComments=strComments, \ _strShortComments=strShortComments) edApplicationMXv1Characterisation.execute() # Run the EDNA2HTML generator on the output from the MXv1 application edPluginExecOutputHTML = EDFactoryPluginStatic.loadPlugin( 'EDPluginExecOutputHTMLv1_0') edPluginExecOutputHTML.setDataInput(XSDataString(strComments), "title") strWorkingDir = os.path.join( strWorkingDir, edApplicationMXv1Characterisation.getWorkingDir()) edPluginExecOutputHTML.setDataInput(XSDataString(strWorkingDir), "workingDir") #strBaseDir = os.path.join(strHTMLResultDir, "edna") #edPluginExecOutputHTML.setDataInput(XSDataString(strBaseDir), "basename") edPluginExecOutputHTML.setDataInput(XSDataString(strHTMLResultDir), "basename") edPluginExecOutputHTML.executeSynchronous() strPathToHTMLFile = "" if (edPluginExecOutputHTML.hasDataOutput("htmlFile")): strPathToHTMLFile = edPluginExecOutputHTML.getDataOutput( "htmlFile")[0].getPath().getValue() else: EDVerbose.ERROR( "edna-mxv1-wsgi-server: edPluginExecOutputHTML has no dataOutput htmlFile!" ) if strPathToHTMLFile == "": EDVerbose.ERROR("edna-mxv1-wsgi-server: Returning empty string") return strPathToHTMLFile else: return strInput