当前位置: 首页>>代码示例>>Python>>正文


Python Request.Campaign类代码示例

本文整理汇总了Python中WMCore.RequestManager.RequestDB.Interface.Request.Campaign的典型用法代码示例。如果您正苦于以下问题:Python Campaign类的具体用法?Python Campaign怎么用?Python Campaign使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了Campaign类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: getCampaign

 def getCampaign(self, campaign=None):
     """ returns a list of all campaigns if no argument, and a list of
          all requests in a campaign if there is an argument """
     if campaign == None:
         return Campaign.listCampaigns()
     else:
         return Campaign.listRequestsByCampaign(campaign)
开发者ID:AndrewLevin,项目名称:WMCore,代码行数:7,代码来源:ReqMgrRESTModel.py

示例2: putCampaign

 def putCampaign(self, campaign, request=None):
     """ Adds a campaign if it doesn't already exist, and optionally
         associates a request with it """
     if request:
         requestID = GetRequest.requestID(request)
         if requestID:
             return Campaign.associateCampaign(campaign, requestID)
         else:
             return False
     else:
         Campaign.addCampaign(campaign)
开发者ID:zhiwenuil,项目名称:WMCore,代码行数:11,代码来源:ReqMgrRESTModel.py

示例3: putCampaign

 def putCampaign(self, campaign, request=None):
     """ Adds a campaign if it doesn't already exist, and optionally
         associates a request with it """
     if request:
         requestID = GetRequest.requestID(request)
         if requestID:
             result = Campaign.associateCampaign(campaign, requestID)
             Utilities.associateCampaign(campaign = campaign,
                                         requestName = request,
                                         couchURL = self.couchUrl,
                                         couchDBName = self.workloadDBName)
             return result
         else:
             return False
     else:
         Campaign.addCampaign(campaign)
开发者ID:AndrewLevin,项目名称:WMCore,代码行数:16,代码来源:ReqMgrRESTModel.py

示例4: deleteCampaign

 def deleteCampaign(self, campaign):
     return Campaign.deleteCampaign(campaign)
开发者ID:AndrewLevin,项目名称:WMCore,代码行数:2,代码来源:ReqMgrRESTModel.py

示例5: checkIn

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"]))
开发者ID:dciangot,项目名称:WMCore,代码行数:95,代码来源:CheckIn.py


注:本文中的WMCore.RequestManager.RequestDB.Interface.Request.Campaign类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。