Ejemplo n.º 1
0
def generateRequestName(request):
    currentTime = time.strftime('%y%m%d_%H%M%S', time.localtime(time.time()))
    seconds = int(10000 * (time.time() % 1.0))

    if "RequestString" not in request:
        raise InvalidSpecParameterValue("RequestString need to be specified")

    request["RequestName"] = "%s_%s" % (request["Requestor"], request["RequestString"])
    # add time info
    request["RequestName"] += "_%s_%s" % (currentTime, seconds)
    # then validate the final request name
    identifier(request["RequestName"])
Ejemplo n.º 2
0
def generateRequestName(request):
    currentTime = time.strftime('%y%m%d_%H%M%S', time.localtime(time.time()))
    seconds = int(10000 * (time.time() % 1.0))

    if "RequestString" not in request:
        raise InvalidSpecParameterValue("RequestString need to be specified")

    request["RequestName"] = "%s_%s" % (request["Requestor"],
                                        request["RequestString"])
    # add time info
    request["RequestName"] += "_%s_%s" % (currentTime, seconds)
    # then validate the final request name
    identifier(request["RequestName"])
Ejemplo n.º 3
0
    def requireValidateFields(self, fields, schema, validate = False):
        """
        _requireValidateFields_

        Standard tool for StdBase derived classes to make sure
        that a schema has a certain set of valid fields.  Uses WMCore.Lexicon.identifier

        To be used in validateWorkload()
        """

        for field in fields:
            if not field in schema.keys():
                msg = "Missing required field %s in workload validation!" % field
                self.raiseValidationException(msg = msg)
            if schema[field] == None:
                msg = "NULL value for required field %s!" % field
                self.raiseValidationException(msg = msg)
            if validate:
                try:
                    identifier(candidate = schema[field])
                except AssertionError, ex:
                    msg = "Schema value for field %s failed Lexicon validation" % field
                    self.raiseValidationException(msg = msg)
Ejemplo n.º 4
0
    def requireValidateFields(self, fields, schema, validate=False):
        """
        _requireValidateFields_

        Standard tool for StdBase derived classes to make sure
        that a schema has a certain set of valid fields.  Uses WMCore.Lexicon.identifier

        To be used in validateWorkload()
        """

        for field in fields:
            if not field in schema.keys():
                msg = "Missing required field '%s' in workload validation!" % field
                self.raiseValidationException(msg=msg)
            if schema[field] == None:
                msg = "NULL value for required field %s!" % field
                self.raiseValidationException(msg=msg)
            if validate:
                try:
                    identifier(candidate=schema[field])
                except AssertionError, ex:
                    msg = "Schema value for field '%s' failed Lexicon validation" % field
                    self.raiseValidationException(msg=msg)