Exemple #1
0
    def validateTask(self, taskConf, taskArgumentDefinition):
        """
        _validateTask_

        Validate the task information against the given
        argument description
        """
        msg = validateArguments(taskConf, taskArgumentDefinition)
        if msg is not None:
            self.raiseValidationException(msg)
        # Also retrieve the "main" arguments which may be overriden in the task
        # Change them all to optional for validation
        baseArgs = self.getWorkloadArguments()
        for arg in baseArgs:
            baseArgs[arg]["optional"] = True
        msg = validateArguments(taskConf, baseArgs)
        if msg is not None:
            self.raiseValidationException(msg)
        return
Exemple #2
0
    def validateTask(self, taskConf, taskArgumentDefinition):
        """
        _validateTask_

        Validate the task information against the given
        argument description
        """
        msg = validateArguments(taskConf, taskArgumentDefinition)
        if msg is not None:
            self.raiseValidationException(msg)
        # Also retrieve the "main" arguments which may be overriden in the task
        # Change them all to optional for validation
        baseArgs = self.getWorkloadArguments()
        for arg in baseArgs:
            baseArgs[arg]["optional"] = True
        msg = validateArguments(taskConf, baseArgs)
        if msg is not None:
            self.raiseValidationException(msg)
        return
Exemple #3
0
    def validateSchema(self, schema):
        """
        _validateSchema_

        Check for required fields, and some skim facts
        """
        DataProcessing.validateSchema(self, schema)
        couchUrl = schema.get("ConfigCacheUrl", None) or schema["CouchURL"]
        mainOutputModules = self.validateConfigCacheExists(
            configID=schema["ConfigCacheID"],
            couchURL=couchUrl,
            couchDBName=schema["CouchDBName"],
            getOutputModules=True).keys()

        # Skim facts have to be validated outside the usual master validation
        skimArguments = self.getSkimArguments()
        skimIndex = 1
        skimInputs = set()
        while "SkimName%s" % skimIndex in schema:
            instanceArguments = {}
            for argument in skimArguments.keys():
                realArg = argument.replace("#N", str(skimIndex))
                instanceArguments[realArg] = skimArguments[argument]
            msg = validateArguments(schema, instanceArguments)
            if msg is not None:
                self.raiseValidationException(msg)

            self.validateConfigCacheExists(
                configID=schema["Skim%sConfigCacheID" % skimIndex],
                couchURL=couchUrl,
                couchDBName=schema["CouchDBName"])
            if schema["SkimInput%s" % skimIndex] not in mainOutputModules:
                error = "Processing config does not have the following output module: %s." % schema[
                    "SkimInput%s" % skimIndex]
                self.raiseValidationException(msg=error)
            skimInputs.add(schema["SkimInput%s" % skimIndex])
            skimIndex += 1

        # Validate that the transient output modules are used in a skim task
        if "TransientOutputModules" in schema:
            diffSet = set(schema["TransientOutputModules"]) - skimInputs
            if diffSet:
                self.raiseValidationException(
                    msg=
                    "A transient output module was specified but no skim was defined for it"
                )
Exemple #4
0
    def masterValidation(self, schema):
        """
        _masterValidation_

        This is validation for global inputs that have to be implemented for
        multiple types of workflows in the exact same way.

        This uses programatically the definitions in getWorkloadArguments
        for type-checking, existence, null tests and the specific validation functions.

        Any spec-specific extras are implemented in the overriden validateSchema
        """
        # Validate the arguments according to the workload arguments definition
        argumentDefinition = self.getWorkloadArguments()
        msg = validateArguments(schema, argumentDefinition)
        if msg is not None:
            self.raiseValidationException(msg)
        return
Exemple #5
0
    def masterValidation(self, schema):
        """
        _masterValidation_

        This is validation for global inputs that have to be implemented for
        multiple types of workflows in the exact same way.

        This uses programatically the definitions in getWorkloadArguments
        for type-checking, existence, null tests and the specific validation functions.

        Any spec-specific extras are implemented in the overriden validateSchema
        """
        # Validate the arguments according to the workload arguments definition
        argumentDefinition = self.getWorkloadArguments()
        msg = validateArguments(schema, argumentDefinition)
        if msg is not None:
            self.raiseValidationException(msg)
        return
Exemple #6
0
    def validateSchema(self, schema):
        """
        _validateSchema_

        Check for required fields, and some skim facts
        """
        DataProcessing.validateSchema(self, schema)
        couchUrl = schema.get("ConfigCacheUrl", None) or schema["CouchURL"]
        mainOutputModules = self.validateConfigCacheExists(configID = schema["ConfigCacheID"],
                                                           couchURL = couchUrl,
                                                           couchDBName = schema["CouchDBName"],
                                                           getOutputModules = True).keys()

        # Skim facts have to be validated outside the usual master validation
        skimArguments = self.getSkimArguments()
        skimIndex = 1
        skimInputs = set()
        while "SkimName%s" % skimIndex in schema:
            instanceArguments = {}
            for argument in skimArguments.keys():
                realArg = argument.replace("#N", str(skimIndex))
                instanceArguments[realArg] = skimArguments[argument]
            msg = validateArguments(schema, instanceArguments)
            if msg is not None:
                self.raiseValidationException(msg)

            self.validateConfigCacheExists(configID = schema["Skim%sConfigCacheID" % skimIndex],
                                           couchURL = couchUrl,
                                           couchDBName = schema["CouchDBName"])
            if schema["SkimInput%s" % skimIndex] not in mainOutputModules:
                error = "Processing config does not have the following output module: %s." % schema["SkimInput%s" % skimIndex]
                self.raiseValidationException(msg = error)
            skimInputs.add(schema["SkimInput%s" % skimIndex])
            skimIndex += 1

        # Validate that the transient output modules are used in a skim task
        if "TransientOutputModules" in schema:
            diffSet = set(schema["TransientOutputModules"]) - skimInputs
            if diffSet:
                self.raiseValidationException(msg = "A transient output module was specified but no skim was defined for it")