コード例 #1
0
ファイル: Request.py プロジェクト: PerilousApricot/WMCore
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)