Ejemplo n.º 1
0
 def testSetXSConfigurationItem(self):
     xsPluginItem = XSPluginItem()
     xsPluginItem.name = "EDPluginTestSetConfig"
     edConfiguration = EDConfiguration()
     edConfiguration.setXSConfigurationItem(xsPluginItem)
     xsDataPluginItem = edConfiguration.getXSConfigurationItem("EDPluginTestSetConfig")
     EDAssert.equal(True, xsDataPluginItem is not None, "Obtanied set configuration")
Ejemplo n.º 2
0
 def testSetXSConfigurationItem(self):
     xsPluginItem = XSPluginItem()
     xsPluginItem.name = "EDPluginTestSetConfig"
     edConfiguration = EDConfiguration()
     edConfiguration.setXSConfigurationItem(xsPluginItem)
     xsDataPluginItem = edConfiguration.getXSConfigurationItem(
         "EDPluginTestSetConfig")
     EDAssert.equal(True, xsDataPluginItem is not None,
                    "Obtanied set configuration")
Ejemplo n.º 3
0
 def configure(self):
     """
     setup two configurations:
     --> MAX_OFFSET_VALUE 
     --> FILL_VALUE 
     
     """
     EDPluginExec.configure(self)
     if not self.__class__.CONFIGURED:
         with self.__class__._clsLock:
             if not self.__class__.CONFIGURED:
                 self.DEBUG("EDPluginExecShiftImagev1_1.configure")
                 xsPluginItem = self.getConfiguration()
                 if (xsPluginItem == None):
                     self.WARNING(
                         "EDPluginExecShiftImagev1_1.configure: No plugin item defined."
                     )
                     xsPluginItem = XSPluginItem()
                 strFill = EDConfiguration.getStringParamValue(
                     xsPluginItem, self.__class__.FILL_KEY)
                 if (strFill == None):
                     self.WARNING("EDPluginExecShiftImagev1_1.configure: No configuration parameter found for: %s using default value: %s\n%s"\
                                 % (self.FILL_KEY, self.FILL_VALUE, xsPluginItem.marshal()))
                 else:
                     strFill = strFill.strip().lower()
                     if strFill in ["min", "max", "mean"]:
                         self.__class__.FILL_VALUE = strFill
                     else:
                         try:
                             self.__class__.FILL_VALUE = float(strFill)
                         except ValueError, error:
                             self.ERROR(
                                 "unable to convert %s to float: %s" %
                                 (strFill, error))
                 strMaxOffset = EDConfiguration.getStringParamValue(
                     xsPluginItem, self.__class__.MAX_OFFSET_KEY)
                 if (strMaxOffset == None):
                     self.WARNING("EDPluginExecShiftImagev1_1.configure: No configuration parameter found for: %s using default value: %s\n%s"\
                                 % (self.MAX_OFFSET_KEY, self.MAX_OFFSET_VALUE, xsPluginItem.marshal()))
                 else:
                     if strMaxOffset.isdigit():
                         try:
                             self.__class__.MAX_OFFSET_VALUE = int(
                                 strMaxOffset)
                         except ValueError, error:
                             self.ERROR("unable to convert %s to int: %s" %
                                        (strMaxOffset, error))
                     else:
                         self.WARNING("EDPluginExecShiftImagev1_1.configure: No configuration parameter found for: %s using default value: %s\n%s"\
                                 % (self.MAX_OFFSET_KEY, self.MAX_OFFSET_VALUE, xsPluginItem.marshal()))
Ejemplo n.º 4
0
 def configure(self):
     """
     setup two configurations:
     --> MAX_OFFSET_VALUE 
     --> FILL_VALUE 
     
     """
     EDPluginExec.configure(self)
     if not self.__class__.CONFIGURED:
         with self.__class__._clsLock:
             if not self.__class__.CONFIGURED:
                 self.DEBUG("EDPluginExecShiftImagev1_1.configure")
                 xsPluginItem = self.getConfiguration()
                 if xsPluginItem == None:
                     self.WARNING("EDPluginExecShiftImagev1_1.configure: No plugin item defined.")
                     xsPluginItem = XSPluginItem()
                 strFill = EDConfiguration.getStringParamValue(xsPluginItem, self.__class__.FILL_KEY)
                 if strFill == None:
                     self.WARNING(
                         "EDPluginExecShiftImagev1_1.configure: No configuration parameter found for: %s using default value: %s\n%s"
                         % (self.FILL_KEY, self.FILL_VALUE, xsPluginItem.marshal())
                     )
                 else:
                     strFill = strFill.strip().lower()
                     if strFill in ["min", "max", "mean"]:
                         self.__class__.FILL_VALUE = strFill
                     else:
                         try:
                             self.__class__.FILL_VALUE = float(strFill)
                         except ValueError, error:
                             self.ERROR("unable to convert %s to float: %s" % (strFill, error))
                 strMaxOffset = EDConfiguration.getStringParamValue(xsPluginItem, self.__class__.MAX_OFFSET_KEY)
                 if strMaxOffset == None:
                     self.WARNING(
                         "EDPluginExecShiftImagev1_1.configure: No configuration parameter found for: %s using default value: %s\n%s"
                         % (self.MAX_OFFSET_KEY, self.MAX_OFFSET_VALUE, xsPluginItem.marshal())
                     )
                 else:
                     if strMaxOffset.isdigit():
                         try:
                             self.__class__.MAX_OFFSET_VALUE = int(strMaxOffset)
                         except ValueError, error:
                             self.ERROR("unable to convert %s to int: %s" % (strMaxOffset, error))
                     else:
                         self.WARNING(
                             "EDPluginExecShiftImagev1_1.configure: No configuration parameter found for: %s using default value: %s\n%s"
                             % (self.MAX_OFFSET_KEY, self.MAX_OFFSET_VALUE, xsPluginItem.marshal())
                         )
Ejemplo n.º 5
0
    def configure(self):
        """
        Configures the plugin from the configuration file with the following parameters:
        - CONF_MAX_THREAD max number of threads in the action cluster
        - CONF_FILE_SIZE minimum file size 
        """
        EDPluginControl.configure(self)
        self.DEBUG("EDPluginBioSaxsToSASv1_0.configure")

        if (self.__class__.size is None) or (self.__class__.maxThreads is None):
            xsPluginItem = self.getConfiguration()
            if (xsPluginItem == None):
                self.warning("EDPluginBioSaxsToSASv1_0.configure: No plugin item defined.")
                xsPluginItem = XSPluginItem()
            conf_size = self.config.get(self.CONF_FILE_SIZE, None)
            if conf_size is None:
                strMessage = 'EDPluginBioSaxsToSASv1_0.configure: Configuration parameter missing: \
    %s for %s, defaulting to "1000"' % (self.CONF_FILE_SIZE, EDUtilsPath.EDNA_SITE)
                self.WARNING(strMessage)
                self.addErrorWarningMessagesToExecutiveSummary(strMessage)
                self.__class__.size = 1000
            else:
                self.__class__.size = int(conf_size)
            maxThreads = self.config.get(self.CONF_MAX_THREAD, None)
            if maxThreads is None:
                strMessage = 'EDPluginBioSaxsToSASv1_0.configure: Configuration parameter missing: \
    %s for %s, defaulting to "max"' % (self.CONF_MAX_THREAD, EDUtilsPath.EDNA_SITE)
                self.WARNING(strMessage)
                self.addErrorWarningMessagesToExecutiveSummary(strMessage)
                self.__class__.maxThreads = None
            else:
                self.__class__.maxThreads = int(maxThreads)
Ejemplo n.º 6
0
    def configure(self):
        """
        Here we override the EDPluginExecProcessScript.configure method BEFORE calling it.
        we define especially the executable that should come from the input-XML and not from the Site-XML.
        This is the main difference with EDPluginExecProcessScript.

        The configure method modifies also the stdout from .log to .out ... if we are re-using stdout for the result  

        """
        self.DEBUG("EDPluginExecCommandLinev10.configure")
        self.setScriptExecutable(self.dataInput.commandLineProgram.path.value)
        if self.dataInput.getCommandLineOptions() :
            strOptions = self.dataInput.getCommandLineOptions().value + " " + self.dataInput.inputFileName.path.value
        else:
            strOptions = self.dataInput.inputFileName.path
        self.setScriptCommandline(strOptions)
        xsPluginItem = XSPluginItem()
        self.setConfiguration(xsPluginItem)

        if self.dataInput.getOutfileFromStdout() is not None:
            if self.dataInput.getOutfileFromStdout().value :
                if (self.getScriptBaseName() == None):
                    self.setScriptBaseName(self.getBaseName())
                if (self.getScriptLogFileName() == None):
                    self.setScriptLogFileName(self.getScriptBaseName() + ".out")
        # And finally we call the configure method of the parent.  
        EDPluginExecProcessScript.configure(self)
Ejemplo n.º 7
0
 def configure(self):
     """
     Add the dtype to the configuration file, probably "float32" or "float64"
     """
     EDPluginExec.configure(self)
     self.DEBUG("EDPluginExecNormalizeImagev1_1.configure")
     if self.__class__.dtype is None:
         with self.__class__.semaphore:
             xsPluginItem = self.getConfiguration()
             if (xsPluginItem == None):
                 self.WARNING("EDPluginExecNormalizeImagev1_1.configure: No plugin item defined.")
                 xsPluginItem = XSPluginItem()
             strDtype = EDConfiguration.getStringParamValue(xsPluginItem, self.CONF_DTYPE_KEY)
             if(strDtype == None):
                 self.WARNING("EDPluginExecNormalizeImagev1_1.configure: No configuration parameter found for: %s using default value: %s\n%s"\
                             % (self.CONF_DTYPE_KEY, self.CONF_DTYPE_DEFAULT, xsPluginItem.marshal()))
                 self.__class__.dtype = self.CONF_DTYPE_DEFAULT
             else:
                 self.__class__.dtype = str(strDtype.strip().lower())
Ejemplo n.º 8
0
 def getXSConfigurationItem(self, _strPluginName):
     "Method offering compatibility with XML structure: deprecated !!!"
     config = None
     if _strPluginName in self._dictPluginConfiguration:
         config = self._dictPluginConfiguration[_strPluginName]
     else:  # Try to load "project" configuration
         config = self.get(_strPluginName)
     if config is not None:
         return XSPluginItem(name=_strPluginName,
                             XSParamList=XSParamList([
                                 XSParamItem(name=i, value=str(config[i]))
                                 for i in config
                             ]))
 def configure(self):
     """
     Configures the plugin from the configuration file with the following parameters
      - The CONVOLUTION method
     """
     EDPluginExec.configure(self)
     if self.CONF_CONVOLUTION is None:
         self.synchronizeOn()
         self.DEBUG("EDPluginExecMeasureOffsetv1_0.configure")
         xsPluginItem = self.getConfiguration()
         if xsPluginItem == None:
             self.WARNING("EDPluginExecMeasureOffsetv1_0.configure: No plugin item defined.")
             xsPluginItem = XSPluginItem()
         strCONVOLUTION = EDConfiguration.getStringParamValue(xsPluginItem, self.CONF_CONVOLUTION_KEY)
         if strCONVOLUTION == None:
             self.WARNING(
                 "EDPluginExecMeasureOffsetv1_0.configure: No configuration parameter found for: %s using default value: %s\n%s"
                 % (self.CONF_CONVOLUTION_KEY, self.CONF_CONVOLUTION_DEFAULT, xsPluginItem.marshal())
             )
             self.CONF_CONVOLUTION = self.CONF_CONVOLUTION_DEFAULT
         else:
             self.CONF_CONVOLUTION = strCONVOLUTION.strip().lower()
         self.synchronizeOff()
Ejemplo n.º 10
0
 def configure(self):
     """
     Configures the plugin from the configuration file with the following parameters
      - Script executable to be invoked
      - number of worker 
      - The 3rd party executable installed version
     """
     EDPluginExecProcess.configure(self)
     self.DEBUG(" EDPluginSPDCorrect.configure")
     xsPluginItem = self.getConfiguration()
     if (xsPluginItem == None):
         self.WARNING(
             "EDPluginSPDCorrect.configure: No plugin item defined.")
         xsPluginItem = XSPluginItem()
     if (self.getExecutable() is None):
         edStringScriptExecutable = EDConfiguration.getStringParamValue(
             xsPluginItem, CONF_EXEC_PROCESS_SCRIPT_EXECUTABLE)
         if (edStringScriptExecutable == None):
             errorMessage = EDMessage.ERROR_EXECUTION_03 % ('EDPluginSPDCorrect.process', self.getClassName(), "Configuration parameter missing: " \
                                                            + CONF_EXEC_PROCESS_SCRIPT_EXECUTABLE)
             self.error(errorMessage)
             self.addErrorMessage(errorMessage)
             raise RuntimeError, errorMessage
         else:
             # Check that the executable file exists
             if not os.path.isfile(edStringScriptExecutable):
                 errorMessage = EDMessage.ERROR_EXECUTION_03 % ('EDPluginSPDCorrect.process', self.getClassName(), "Cannot find configured " \
                                                                + CONF_EXEC_PROCESS_SCRIPT_EXECUTABLE + " : " + edStringScriptExecutable)
                 self.error(errorMessage)
                 self.addErrorMessage(errorMessage)
                 raise RuntimeError, errorMessage
             else:
                 self.setExecutable(edStringScriptExecutable)
     edStringConfigSetupNbWorker = EDConfiguration.getStringParamValue(
         xsPluginItem, CONF_EXEC_MAX_MAX_NUMBER_OF_WORKERS)
     if (edStringConfigSetupNbWorker == None):
         self.DEBUG(
             "EDPluginSPDCorrect.configure: No configuration parameter found for: "
             + CONF_EXEC_MAX_MAX_NUMBER_OF_WORKERS + ", NO default value!")
     else:
         self._iConfigNumberOfWorker = int(edStringConfigSetupNbWorker)
     edStringVersion = EDConfiguration.getStringParamValue(
         xsPluginItem, CONF_EXEC_PROCESS_SCRIPT_VERSION_STRING)
     if (edStringVersion == None):
         self.DEBUG(
             "EDPluginSPDCorrect.configure: No configuration parameter found for: "
             + CONF_EXEC_PROCESS_SCRIPT_VERSION_STRING +
             ", NO default value!")
     else:
         self.setStringVersion(edStringVersion)
Ejemplo n.º 11
0
 def configure(self):
     """
     Configures the plugin from the configuration file with the following parameters
      - The CONVOLUTION method
     """
     EDPluginExec.configure(self)
     if self.CONF_CONVOLUTION is None:
         with self.__class__.__sem:
             self.DEBUG("EDPluginExecMeasureOffsetv1_0.configure")
             xsPluginItem = self.getConfiguration()
             if xsPluginItem is None:
                 self.WARNING(
                     "EDPluginExecMeasureOffsetv1_0.configure: No plugin item defined."
                 )
                 xsPluginItem = XSPluginItem()
             strCONVOLUTION = EDConfiguration.getStringParamValue(
                 xsPluginItem, self.CONF_CONVOLUTION_KEY)
             if strCONVOLUTION is None:
                 self.WARNING("EDPluginExecMeasureOffsetv1_0.configure: No configuration parameter found for: %s using default value: %s\n%s"\
                             % (self.CONF_CONVOLUTION_KEY, self.CONF_CONVOLUTION_DEFAULT, xsPluginItem.marshal()))
                 self.__class__CONF_CONVOLUTION = self.CONF_CONVOLUTION_DEFAULT
             else:
                 self.__class__.CONF_CONVOLUTION = strCONVOLUTION.strip(
                 ).lower()
Ejemplo n.º 12
0
 def configure(self):
     EDPluginExecProcessScript.configure(self)
     self.DEBUG("EDPluginControlLabelitv10.configure")
     xsPluginItem = self.getConfiguration()
     if (xsPluginItem == None):
         self.warning("EDPluginControlLabelitv10.configure: No Labelit plugin item defined.")
         xsPluginItem = XSPluginItem()
     strPathToLabelitSetpathScript = EDConfiguration.getStringParamValue(xsPluginItem, self.strCONF_PATH_TO_LABELIT_SETPATH_SCRIPT)
     if(strPathToLabelitSetpathScript == None):
         errorMessage = EDMessage.ERROR_EXECUTION_03 % ('EDPluginControlLabelitv10.configure', self.getClassName(), "Configuration parameter missing: " + self.strCONF_PATH_TO_LABELIT_SETPATH_SCRIPT)
         self.error(errorMessage)
         self.addErrorMessage(errorMessage)
         raise RuntimeError, errorMessage
     else:
         self.setPathToLabelitSetpathScript(strPathToLabelitSetpathScript)
Ejemplo n.º 13
0
 def configure(self):
     EDPluginExecProcessScript.configure(self)
     self.DEBUG("EDPluginLabelitv1_1.configure")
     xsPluginItem = self.getConfiguration()
     if (xsPluginItem == None):
         self.warning("EDPluginLabelitv1_1.configure: No Labelit plugin item defined.")
         xsPluginItem = XSPluginItem()
     strPathToLabelitSetpathScript = EDConfiguration.getStringParamValue(xsPluginItem, \
                                                                         EDPluginLabelitv1_1.CONF_PATH_TO_LABELIT_SETPATH_SCRIPT)
     if(strPathToLabelitSetpathScript == None):
         strErrorMessage = "EDPluginLabelitv1_1.configure : Configuration parameter missing: " + \
                             EDPluginLabelitv1_1.CONF_PATH_TO_LABELIT_SETPATH_SCRIPT
         self.error(strErrorMessage)
         self.addErrorMessage(strErrorMessage)
         self.setFailure()
     else:
         self.setPathToLabelitSetpathScript(strPathToLabelitSetpathScript)
 def configure(self):
     """
     Configures the plugin from the configuration file with the following parameters
      - Excpected image size
     """
     EDPluginControl.configure(self)
     EDVerbose.DEBUG("EDPluginControlDiffractionCTv1_2.configure")
     xsPluginItem = self.getConfiguration()
     if (xsPluginItem == None):
         EDVerbose.warning("EDPluginControlDiffractionCTv1_2.configure: No plugin item defined.")
         xsPluginItem = XSPluginItem()
     strImageSize = EDConfiguration.getStringParamValue(xsPluginItem, EDPluginControlDiffractionCTv1_2.CONF_INPUT_IMAGE_SIZE)
     if(strImageSize == None):
         EDVerbose.WARNING("EDPluginControlDiffractionCTv1_2.configure: No configuration parameter found for: %s, using default value: %s " % (\
                      EDPluginControlDiffractionCTv1_2.CONF_INPUT_IMAGE_SIZE, self.iImageSize))
     else:
         self.iImageSize = int(strImageSize)
Ejemplo n.º 15
0
    def configure(self):
        """
        Configures the plugin from the configuration file with the following parameters:
         - DummyPixelValue: the value to be assigned to dummy pixels.
        """
        EDPluginControl.configure(self)
        self.DEBUG("EDPluginBioSaxsNormalizev1_1.configure")
        xsPluginItem = self.getConfiguration()
        if (xsPluginItem == None):
            self.warning("EDPluginBioSaxsNormalizev1_1.configure: No plugin item defined.")
            xsPluginItem = XSPluginItem()
        self.dummy = EDConfiguration.getStringParamValue(xsPluginItem, self.CONF_DUMMY_PIXEL_VALUE)
        if self.dummy is None:
            strMessage = 'EDPluginBioSaxsNormalizev1_1.configure: %s Configuration parameter missing: \
%s, defaulting to "-1"' % (self.getBaseName(), self.CONF_DUMMY_PIXEL_VALUE)
            self.WARNING(strMessage)
            self.addErrorWarningMessagesToExecutiveSummary(strMessage)
            self.dummy = -1
Ejemplo n.º 16
0
    def configure(self):
        """
        Configures the plugin from the configuration file with the following
        parameters
         - The shell that will execute the script
         - Script executor
         - Script executable to be invoked
         - Path to CCP4 setup file if required
         - The 3rd party executable installed version
        """
        EDPluginExec.configure(self)
        EDVerbose.DEBUG("EDPluginExecProcessXIA2CORE.configure")
        xsPluginItem = self.getConfiguration()
        if (xsPluginItem == None):
            EDVerbose.warning(
                "EDPluginExecProcessXIA2CORE.configure: No plugin item defined."
            )
            xsPluginItem = XSPluginItem()

        if (self.getExecutable() is None):
            strExecutable = EDConfiguration.getStringParamValue(
                xsPluginItem,
                EDPluginExecProcessXIA2CORE.CONF_EXEC_PROCESS_EXECUTABLE)
            if (strExecutable == None):
                strErrorMessage = "Configuration parameter missing: " + \
                                  EDPluginExecProcessXIA2CORE.CONF_EXEC_PROCESS_EXECUTABLE
                EDVerbose.error(strErrorMessage)
                self.addErrorMessage(strErrorMessage)
                self.setFailure()
                if (EDVerbose.isVerboseDebug()):
                    raise RuntimeError, strErrorMessage
            else:
                # Check that the executable file exists
                if (os.path.exists(strExecutable) == False):
                    strErrorMessage = "Cannot find configured " + EDPluginExecProcessXIA2CORE.CONF_EXEC_PROCESS_EXECUTABLE + " : " + strExecutable
                    EDVerbose.error(strErrorMessage)
                    self.addErrorMessage(strErrorMessage)
                    self.setFailure()
                    if (EDVerbose.isVerboseDebug()):
                        raise RuntimeError, strErrorMessage
                else:
                    self.setExecutable(strExecutable)

        if (self.getConfigXIA2COREType() is None):
            strXIA2COREType = EDConfiguration.getStringParamValue(
                xsPluginItem,
                EDPluginExecProcessXIA2CORE.CONF_EXEC_PROCESS_XIA2CORE_TYPE)
            if (strXIA2COREType == None):
                strErrorMessage = "Configuration parameter not set: " + \
                                  EDPluginExecProcessXIA2CORE.CONF_EXEC_PROCESS_XIA2CORE_TYPE
                EDVerbose.DEBUG(strErrorMessage)
            else:
                # FIXME test that this is a legal name
                self.__strConfigXIA2COREType = strXIA2COREType

        strVersion = EDConfiguration.getStringParamValue(
            xsPluginItem,
            EDPluginExecProcessXIA2CORE.CONF_EXEC_PROCESS_VERSION_STRING)
        if (strVersion == None):
            EDVerbose.DEBUG("EDPluginExecProcessXIA2CORE.configure: No configuration parameter found for: " + \
                            EDPluginExecProcessXIA2CORE.CONF_EXEC_PROCESS_VERSION_STRING + ", NO default value!")
        else:
            self.setStringVersion(strVersion)
        if (self.__strLogFileName == None):
            self.setLogFileName(self.getBaseName() + ".log")
        if (self.__strErrorLogFileName == None):
            self.setErrorLogFileName(self.getBaseName() + ".err")

        if self.__strExecutable is None:
            EDVerbose.ERROR("Executable not defined in configuration file")
            # shall we raise an exception?

        self.__strPathToHostNamePidFile = os.path.join(
            self.getWorkingDirectory(),
            os.path.basename(self.__strExecutable) + "_hostNamePid.txt")

        return