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


Python ChangeState.assignRequest方法代码示例

本文整理汇总了Python中WMCore.RequestManager.RequestDB.Interface.Request.ChangeState.assignRequest方法的典型用法代码示例。如果您正苦于以下问题:Python ChangeState.assignRequest方法的具体用法?Python ChangeState.assignRequest怎么用?Python ChangeState.assignRequest使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在WMCore.RequestManager.RequestDB.Interface.Request.ChangeState的用法示例。


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

示例1: handleAssignmentPage

# 需要导入模块: from WMCore.RequestManager.RequestDB.Interface.Request import ChangeState [as 别名]
# 或者: from WMCore.RequestManager.RequestDB.Interface.Request.ChangeState import assignRequest [as 别名]
    def handleAssignmentPage(self, **kwargs):
        """ handler for the main page """
        #Accept Json encoded strings
        decodedArgs = {}
        for key in kwargs.keys():
            try:
                decodedArgs[key] = JsonWrapper.loads(kwargs[key])
            except:
                #Probably wasn't JSON
                decodedArgs[key] = kwargs[key]
        kwargs = decodedArgs
        # handle the checkboxes
        teams = []
        requestNames = []
        for key, value in kwargs.iteritems():
            if isinstance(value, types.StringTypes):
                kwargs[key] = value.strip()
            if key.startswith("Team"):
                teams.append(key[4:])
            if key.startswith("checkbox"):
                requestName = key[8:]
                self.validate(requestName)
                requestNames.append(key[8:])
        
        for requestName in requestNames:
            if kwargs['action'] == 'Reject':
                ChangeState.changeRequestStatus(requestName, 'rejected', wmstatUrl = self.wmstatWriteURL) 
            else:
                assignments = GetRequest.getAssignmentsByName(requestName)
                if teams == [] and assignments == []:
                    raise cherrypy.HTTPError(400, "Must assign to one or more teams")
                self.assignWorkload(requestName, kwargs)
                for team in teams:
                    if not team in assignments:
                        ChangeState.assignRequest(requestName, team, wmstatUrl = self.wmstatWriteURL)
                priority = kwargs.get(requestName+':priority', '')
                if priority != '':
                    Utilities.changePriority(requestName, priority, self.wmstatWriteURL)
        participle=kwargs['action']+'ed'
        if self.opshold and kwargs['action'] == 'Assign':
            participle='put into "ops-hold" state (see <a href="%s">OpsClipboard</a>)' % self.clipboardUrl
            # this, previously used, call made all requests injected into OpsClipboard to
            # have campaign_id null since the call doesn't propagate request's 
            # CampaignName at all, AcquisitionEra remains default null and probably
            # a bunch of other things is wrong too
            #requests = [GetRequest.getRequestByName(requestName) for requestName in requestNames]
            requests = [Utilities.requestDetails(requestName) for requestName in requestNames]
            OpsClipboard.inject(self.couchUrl, self.clipboardDB, *requests)
            for request in requestNames:
                ChangeState.changeRequestStatus(requestName, 'ops-hold', wmstatUrl = self.wmstatWriteURL)

        return self.templatepage("Acknowledge", participle=participle, requests=requestNames)
开发者ID:stuartw,项目名称:WMCore,代码行数:54,代码来源:Assign.py

示例2: putAssignment

# 需要导入模块: from WMCore.RequestManager.RequestDB.Interface.Request import ChangeState [as 别名]
# 或者: from WMCore.RequestManager.RequestDB.Interface.Request.ChangeState import assignRequest [as 别名]
 def putAssignment(self, team, requestName):
     """ Assigns this request to this team """
     # see if it's already assigned
     team = urllib.unquote(team)
     if not team in ProdManagement.listTeams():
         raise cherrypy.HTTPError(404,"Cannot find this team")
     requestNamesAndIDs = ListRequests.listRequestsByTeam(team)
     if requestName in requestNamesAndIDs.keys():
         raise cherrypy.HTTPError(400,"Already assigned to this team")
     return ChangeState.assignRequest(requestName, team)
开发者ID:AndrewLevin,项目名称:WMCore,代码行数:12,代码来源:ReqMgrRESTModel.py

示例3: handleAssignmentPage

# 需要导入模块: from WMCore.RequestManager.RequestDB.Interface.Request import ChangeState [as 别名]
# 或者: from WMCore.RequestManager.RequestDB.Interface.Request.ChangeState import assignRequest [as 别名]
    def handleAssignmentPage(self, **kwargs):
        """ handler for the main page """
        # Accept Json encoded strings
        decodedArgs = {}
        for key in kwargs.keys():
            try:
                decodedArgs[key] = JsonWrapper.loads(kwargs[key])
            except Exception:
                # Probably wasn't JSON
                decodedArgs[key] = kwargs[key]
        kwargs = decodedArgs
        # handle the checkboxes
        teams = []
        requestNames = []
        for key, value in kwargs.iteritems():
            if isinstance(value, basestring):
                kwargs[key] = value.strip()
            if key.startswith("Team"):
                teams.append(key[4:])
            if key.startswith("checkbox"):
                requestName = key[8:]
                self.validate(requestName)
                requestNames.append(key[8:])

        for requestName in requestNames:
            if kwargs["action"] == "Reject":
                ChangeState.changeRequestStatus(requestName, "rejected", wmstatUrl=self.wmstatWriteURL)
            else:
                assignments = GetRequest.getAssignmentsByName(requestName)
                if teams == [] and assignments == []:
                    raise cherrypy.HTTPError(400, "Must assign to one or more teams")
                kwargs["Teams"] = teams
                self.assignWorkload(requestName, kwargs)
                for team in teams:
                    if not team in assignments:
                        ChangeState.assignRequest(requestName, team, wmstatUrl=self.wmstatWriteURL)
                priority = kwargs.get(requestName + ":priority", "")
                if priority != "":
                    Utilities.changePriority(requestName, priority, self.wmstatWriteURL)
        participle = kwargs["action"] + "ed"
        return self.templatepage("Acknowledge", participle=participle, requests=requestNames)
开发者ID:mmascher,项目名称:WMCore,代码行数:43,代码来源:Assign.py

示例4: handleAssignmentPage

# 需要导入模块: from WMCore.RequestManager.RequestDB.Interface.Request import ChangeState [as 别名]
# 或者: from WMCore.RequestManager.RequestDB.Interface.Request.ChangeState import assignRequest [as 别名]
 def handleAssignmentPage(self, **kwargs):
     """ handler for the main page """
     # handle the checkboxes
     teams = []
     requestNames = []
     for key, value in kwargs.iteritems():
         if isinstance(value, types.StringTypes):
             kwargs[key] = value.strip()
         if key.startswith("Team"):
             teams.append(key[4:])
         if key.startswith("checkbox"):
             requestName = key[8:]
             self.validate(requestName)
             requestNames.append(key[8:])
     
     for requestName in requestNames:
         if kwargs['action'] == 'Reject':
             ChangeState.changeRequestStatus(requestName, 'rejected') 
         else:
             assignments = GetRequest.getAssignmentsByName(requestName)
             if teams == [] and assignments == []:
                 raise cherrypy.HTTPError(400, "Must assign to one or more teams")
             self.assignWorkload(requestName, kwargs)
             for team in teams:
                 if not team in assignments:
                     ChangeState.assignRequest(requestName, team)
             priority = kwargs.get(requestName+':priority', '')
             if priority != '':
                 Utilities.changePriority(requestName, priority)
     participle=kwargs['action']+'ed'
     if self.hold and kwargs['action'] == 'Assign':
         participle='put into hold state (see <a href="%s">clipboard</a>)' % self.clipboardUrl
         requests = [GetRequest.getRequestByName(requestName) for requestName in requestNames]
         Clipboard.inject(self.couchUrl, self.clipboardDB, *requests)
         for request in requestNames:
             ChangeState.changeRequestStatus(requestName, 'ops-hold')
     return self.templatepage("Acknowledge", participle=participle, requests=requestNames)
开发者ID:zhiwenuil,项目名称:WMCore,代码行数:39,代码来源:Assign.py


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