示例#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"])
示例#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"])
示例#3
0
文件: StdBase.py 项目: stuartw/WMCore
    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)
示例#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)