示例#1
0
def checkIn(request):
    """
    _CheckIn_

    Check in of a request manager

    Given a new request, check it in to the DB and add the
    appropriate IDs.
    """
    #  //
    # // First try and register the request in the DB
    #//
    requestName = request['RequestName']

    # test if the software versions are registered first
    versions = SoftwareManagement.listSoftware()
    for version in request.get('SoftwareVersions', []):
        if not version in versions:
            raise RuntimeError, "Cannot find software version %s in ReqMgr" % version

    try:
        reqId = MakeRequest.createRequest(
        request['Requestor'],
        request['Group'],
        requestName,
        request['RequestType'],
        request['RequestWorkflow'],
        request.get('PrepID', None)
    )
    except Exception, ex:
        msg = "Error creating new request:\n"
        msg += str(ex)
        raise RuntimeError, msg
示例#2
0
文件: CheckIn.py 项目: ticoann/WMCore
def checkIn(request, requestType = 'None'):
    """
    _CheckIn_

    Check in of a request manager

    Given a new request, check it in to the DB and add the
    appropriate IDs.
    """
    #  //
    # // First try and register the request in the DB
    #//
    requestName = request['RequestName']
    
    # test if the software versions are registered first
    versions  = SoftwareManagement.listSoftware()
    scramArch = request.get('ScramArch')
    if requestType.lower() in ['resubmission']:
        # Do nothing, as we have no valid software version yet
        pass
    else:
        if not scramArch in versions.keys():
            m = ("Cannot find scramArch %s in ReqMgr (the one(s) available: %s)" %
                 (scramArch, versions))
            raise RequestCheckInError(m)
        for version in request.get('SoftwareVersions', []):
            if not version in versions[scramArch]:
                raise RequestCheckInError("Cannot find software version %s in ReqMgr for "
                                          "scramArch %s. Supported versions: %s" %
                                          (version, scramArch, versions[scramArch]))

    try:
        reqId = MakeRequest.createRequest(
        request['Requestor'],
        request['Group'],
        requestName,
        request['RequestType'],
        request['RequestWorkflow'],
        request.get('PrepID', None),
        request.get('ReqMgrRequestBasePriority', None)
    )
    except Exception, ex:
        msg = "Error creating new request:\n"
        msg += str(ex)
        raise RequestCheckInError( msg )
示例#3
0
def checkIn(request, requestType = 'None'):
    """
    _CheckIn_

    Check in of a request manager

    Given a new request, check it in to the DB and add the
    appropriate IDs.
    """
    #  //
    # // First try and register the request in the DB
    #//
    requestName = request['RequestName']
    
    # test if the software versions are registered first
    versions  = SoftwareManagement.listSoftware()
    scramArch = request.get('ScramArch')
    if requestType.lower() in ['resubmission']:
        # Do nothing, as we have no valid software version yet
        pass
    else:
        if not scramArch in versions.keys():
            m = ("Cannot find scramArch %s in ReqMgr (the one(s) available: %s)" %
                 (scramArch, versions))
            raise RequestCheckInError(m)
        for version in request.get('SoftwareVersions', []):
            if not version in versions[scramArch]:
                raise RequestCheckInError("Cannot find software version %s in ReqMgr for "
                                          "scramArch %s. Supported versions: %s" %
                                          (version, scramArch, versions[scramArch]))

    try:
        reqId = MakeRequest.createRequest(
        request['Requestor'],
        request['Group'],
        requestName,
        request['RequestType'],
        request['RequestWorkflow'],
        request.get('PrepID', None),
        request.get('RequestPriority', None)
    )
    except Exception, ex:
        msg = "Error creating new request:\n"
        msg += str(ex)
        raise RequestCheckInError( msg )
示例#4
0
文件: CheckIn.py 项目: stuartw/WMCore
def checkIn(request, requestType="None", wmstatSvc=None):
    """
    _CheckIn_

    Check in of a request manager

    Given a new request, check it in to the DB and add the
    appropriate IDs.
    """
    #  //
    # // First try and register the request in the DB
    # //
    requestName = request["RequestName"]

    # test if the software versions are registered first
    versions = SoftwareManagement.listSoftware()
    scramArch = request.get("ScramArch")
    if requestType.lower() in ["resubmission"]:
        # Do nothing, as we have no valid software version yet
        pass
    else:
        if not scramArch in versions.keys():
            m = "Cannot find scramArch %s in ReqMgr (the one(s) available: %s)" % (scramArch, versions)
            raise RequestCheckInError(m)
        for version in request.get("SoftwareVersions", []):
            if not version in versions[scramArch]:
                raise RequestCheckInError(
                    "Cannot find software version %s in ReqMgr for scramArch %s" % (version, scramArch)
                )

    try:
        reqId = MakeRequest.createRequest(
            request["Requestor"],
            request["Group"],
            requestName,
            request["RequestType"],
            request["RequestWorkflow"],
            request.get("PrepID", None),
        )
    except Exception, ex:
        msg = "Error creating new request:\n"
        msg += str(ex)
        raise RequestCheckInError(msg)
示例#5
0
        msg += str(ex)
        raise RequestCheckInError( msg )
    #FIXME LAST_INSERT_ID doesn't work on oracle
    reqId = GetRequest.requestID(requestName)
    request['RequestID'] = reqId
    logging.info("Request %s created with request id %s" % (
        requestName, request['RequestID'])
                 )

    #  //
    # // add metadata about the request
    #//
    try:
        if request['InputDatasetTypes'] != {}:
            for ds, dsType in request['InputDatasetTypes'].items():
                MakeRequest.associateInputDataset(
                    requestName, ds, dsType)
        elif isinstance(request['InputDatasets'], list):
            for ds in request['InputDatasets']:
                MakeRequest.associateInputDataset(requestName, ds)
        else:
            MakeRequest.associateInputDataset(requestName, request['InputDatasets'])
    except Exception, ex:
        _raiseCheckInError(request, ex, "Unable to Associate input datasets to request")
    try:
        for ds in request['OutputDatasets']:
            # request['OutputDatasets'] may contain a list of lists (each sublist for a task)
            # which is actually not understood why but seems to be correct (Steve)
            # dirty
            if isinstance(ds, list):
                for dss in ds:
                    MakeRequest.associateOutputDataset(requestName, dss)
示例#6
0
def checkIn(request, requestType='None'):
    """
    _CheckIn_

    Check in of a request manager

    Given a new request, check it in to the DB and add the
    appropriate IDs.
    """
    #  //
    # // First try and register the request in the DB
    #//
    requestName = request['RequestName']

    # test if the software versions are registered first
    versions = SoftwareManagement.listSoftware()
    scramArch = request.get('ScramArch')
    if requestType.lower() in ['resubmission']:
        # Do nothing, as we have no valid software version yet
        pass
    else:
        if not scramArch in versions.keys():
            m = (
                "Cannot find scramArch %s in ReqMgr (the one(s) available: %s)"
                % (scramArch, versions))
            raise RequestCheckInError(m)
        for version in request.get('SoftwareVersions', []):
            if not version in versions[scramArch]:
                raise RequestCheckInError(
                    "Cannot find software version %s in ReqMgr for "
                    "scramArch %s. Supported versions: %s" %
                    (version, scramArch, versions[scramArch]))

    try:
        reqId = MakeRequest.createRequest(request['Requestor'],
                                          request['Group'], requestName,
                                          request['RequestType'],
                                          request['RequestWorkflow'],
                                          request.get('PrepID', None),
                                          request.get('RequestPriority', None))
    except Exception as ex:
        msg = "Error creating new request:\n"
        msg += str(ex)
        raise RequestCheckInError(msg)
    #FIXME LAST_INSERT_ID doesn't work on oracle
    reqId = GetRequest.requestID(requestName)
    request['RequestID'] = reqId
    logging.info("Request %s created with request id %s" %
                 (requestName, request['RequestID']))

    #  //
    # // add metadata about the request
    #//
    try:
        if request['InputDatasetTypes'] != {}:
            for ds, dsType in request['InputDatasetTypes'].items():
                MakeRequest.associateInputDataset(requestName, ds, dsType)
        elif isinstance(request['InputDatasets'], list):
            for ds in request['InputDatasets']:
                MakeRequest.associateInputDataset(requestName, ds)
        else:
            MakeRequest.associateInputDataset(requestName,
                                              request['InputDatasets'])
    except Exception as ex:
        _raiseCheckInError(request, ex,
                           "Unable to Associate input datasets to request")
    try:
        for ds in request['OutputDatasets']:
            # request['OutputDatasets'] may contain a list of lists (each sublist for a task)
            # which is actually not understood why but seems to be correct (Steve)
            # dirty
            if isinstance(ds, list):
                for dss in ds:
                    MakeRequest.associateOutputDataset(requestName, dss)
            else:
                MakeRequest.associateOutputDataset(requestName, ds)
    except Exception as ex:
        _raiseCheckInError(request, ex,
                           "Unable to Associate output datasets to request")

    try:
        for sw in request['SoftwareVersions']:
            MakeRequest.associateSoftware(requestName, sw)
    except Exception as ex:
        _raiseCheckInError(request, ex,
                           "Unable to associate software for this request")

    MakeRequest.updateRequestSize(requestName,
                                  request.get("RequestNumEvents", 0),
                                  request.get("RequestSizeFiles", 0),
                                  request.get("SizePerEvent", 0))

    campaign = request.get("Campaign", "")
    if campaign != "" and campaign != None:
        Campaign.associateCampaign(campaign, reqId)

    logging.info("Request '%s' built with request id '%s"
                 '' % (requestName, request['RequestID']))
示例#7
0
文件: CheckIn.py 项目: ticoann/WMCore
        msg = "Error creating new request:\n"
        msg += str(ex)
        raise RequestCheckInError(msg)
    #FIXME LAST_INSERT_ID doesn't work on oracle
    reqId = GetRequest.requestID(requestName)
    request['RequestID'] = reqId
    logging.info("Request %s created with request id %s" %
                 (requestName, request['RequestID']))

    #  //
    # // add metadata about the request
    #//
    try:
        if request['InputDatasetTypes'] != {}:
            for ds, dsType in request['InputDatasetTypes'].items():
                MakeRequest.associateInputDataset(requestName, ds, dsType)
        elif isinstance(request['InputDatasets'], list):
            for ds in request['InputDatasets']:
                MakeRequest.associateInputDataset(requestName, ds)
        else:
            MakeRequest.associateInputDataset(requestName,
                                              request['InputDatasets'])
    except Exception, ex:
        _raiseCheckInError(request, ex,
                           "Unable to Associate input datasets to request")
    try:
        for ds in request['OutputDatasets']:
            # request['OutputDatasets'] may contain a list of lists (each sublist for a task)
            # which is actually not understood why but seems to be correct (Steve)
            # dirty
            if isinstance(ds, list):
示例#8
0
def checkIn(request, requestType="None"):
    """
    _CheckIn_

    Check in of a request manager

    Given a new request, check it in to the DB and add the
    appropriate IDs.
    """
    #  //
    # // First try and register the request in the DB
    # //
    requestName = request["RequestName"]

    # test if the software versions are registered first
    versions = SoftwareManagement.listSoftware()
    scramArch = request.get("ScramArch")
    if requestType.lower() in ["resubmission"]:
        # Do nothing, as we have no valid software version yet
        pass
    else:
        if not scramArch in versions.keys():
            m = "Cannot find scramArch %s in ReqMgr (the one(s) available: %s)" % (scramArch, versions)
            raise RequestCheckInError(m)
        for version in request.get("SoftwareVersions", []):
            if not version in versions[scramArch]:
                raise RequestCheckInError(
                    "Cannot find software version %s in ReqMgr for "
                    "scramArch %s. Supported versions: %s" % (version, scramArch, versions[scramArch])
                )

    try:
        reqId = MakeRequest.createRequest(
            request["Requestor"],
            request["Group"],
            requestName,
            request["RequestType"],
            request["RequestWorkflow"],
            request.get("PrepID", None),
            request.get("RequestPriority", None),
        )
    except Exception as ex:
        msg = "Error creating new request:\n"
        msg += str(ex)
        raise RequestCheckInError(msg)
    # FIXME LAST_INSERT_ID doesn't work on oracle
    reqId = GetRequest.requestID(requestName)
    request["RequestID"] = reqId
    logging.info("Request %s created with request id %s" % (requestName, request["RequestID"]))

    #  //
    # // add metadata about the request
    # //
    try:
        if request["InputDatasetTypes"] != {}:
            for ds, dsType in request["InputDatasetTypes"].items():
                MakeRequest.associateInputDataset(requestName, ds, dsType)
        elif isinstance(request["InputDatasets"], list):
            for ds in request["InputDatasets"]:
                MakeRequest.associateInputDataset(requestName, ds)
        else:
            MakeRequest.associateInputDataset(requestName, request["InputDatasets"])
    except Exception as ex:
        _raiseCheckInError(request, ex, "Unable to Associate input datasets to request")
    try:
        for ds in request["OutputDatasets"]:
            # request['OutputDatasets'] may contain a list of lists (each sublist for a task)
            # which is actually not understood why but seems to be correct (Steve)
            # dirty
            if isinstance(ds, list):
                for dss in ds:
                    MakeRequest.associateOutputDataset(requestName, dss)
            else:
                MakeRequest.associateOutputDataset(requestName, ds)
    except Exception as ex:
        _raiseCheckInError(request, ex, "Unable to Associate output datasets to request")

    try:
        for sw in request["SoftwareVersions"]:
            MakeRequest.associateSoftware(requestName, sw)
    except Exception as ex:
        _raiseCheckInError(request, ex, "Unable to associate software for this request")

    MakeRequest.updateRequestSize(
        requestName,
        request.get("RequestNumEvents", 0),
        request.get("RequestSizeFiles", 0),
        request.get("SizePerEvent", 0),
    )

    campaign = request.get("Campaign", "")
    if campaign != "" and campaign != None:
        Campaign.associateCampaign(campaign, reqId)

    logging.info("Request '%s' built with request id '%s" "" % (requestName, request["RequestID"]))