Пример #1
0
 def fetch(self, rid, **kwds):
     "Fetch document for given id"
     rid = rid.replace('request-', '')
     doc = self.reqmgr.getRequestByNames(rid)
     transitions = []
     tstamp = time.time()
     # get request tasks
     tasks = self.reqmgr.getRequestTasks(rid)
     if len(doc) == 1:
         try:
             doc = doc[rid]
         except:
             pass
         name = doc.get('RequestName', 'NA')
         title = 'Request %s' % name
         status = doc.get('RequestStatus', '')
         transitions = REQUEST_STATE_TRANSITION.get(status, [])
         if status in transitions:
             transitions.remove(status)
         visible_attrs = get_modifiable_properties(status)
         content = self.templatepage('doc', title=title, status=status, name=name, rid=rid,
                                     tasks=json2form(tasks, indent=2, keep_first_value=False),
                                     table=json2table(doc, web_ui_names(), visible_attrs),
                                     jsondata=json2form(doc, indent=2, keep_first_value=False),
                                     transitions=transitions, ts=tstamp, user=self.user(), userdn=self.user_dn())
     elif len(doc) > 1:
         jsondata = [pprint.pformat(d) for d in doc]
         content = self.templatepage('doc', title='Series of docs: %s' % rid,
                                     table="", jsondata=jsondata,
                                     transitions=transitions, ts=tstamp, user=self.user(), userdn=self.user_dn())
     else:
         doc = 'No request found for name=%s' % rid
     return self.abs_page('request', content)
Пример #2
0
 def create(self, **kwds):
     """create page"""
     # get list of standard specs from WMCore and new ones from local area
     #loc_specs_dir = os.path.join(self.spdir, 'Specs') # local specs
     #loc_specs = spec_list(loc_specs_dir, 'Specs')
     #all_specs = list(set(self.std_specs + loc_specs))
     #all_specs.sort()
     all_specs = self.std_specs
     spec = kwds.get('form', '')
     if not spec:
         spec = self.std_specs[0]
     # make spec first in all_specs list
     if spec in all_specs:
         all_specs.remove(spec)
     all_specs = [spec] + all_specs
     jsondata = get_request_template_from_type(spec)
     # create templatized page out of provided forms
     self.update_scripts()
     content = self.templatepage(
         'create',
         table=json2table(jsondata, web_ui_names()),
         jsondata=json2form(jsondata, indent=2, keep_first_value=True),
         name=spec,
         scripts=[s for s in self.sdict.keys() if s != 'ts'],
         specs=all_specs)
     return self.abs_page('create', content)
Пример #3
0
 def assign(self, **kwds):
     """assign page"""
     if not kwds:
         kwds = {}
     if 'status' not in kwds:
         kwds.update({'status': 'assignment-approved'})
     docs = []
     attrs = ['RequestName', 'RequestDate', 'Group', 'Requestor', 'RequestStatus']
     dataResult = self.reqmgr.getRequestByStatus(statusList=[kwds['status']])
     for data in dataResult:
         for val in data.values():
             docs.append(request_attr(val, attrs))
     sortby = kwds.get('sort', 'status')
     docs = [r for r in sort(docs, sortby)]
     assignDict = deepcopy(self.assignArgs)
     assignDict.update(getPropValueMap())
     assignDict['Team'] = self.getTeams()
     filter_sort = self.templatepage('filter_sort')
     content = self.templatepage('assign', sort=sortby,
                                 filter_sort_table=filter_sort,
                                 sites=SITE_CACHE.getData(),
                                 site_white_list=site_white_list(),
                                 site_black_list=site_black_list(),
                                 user=user(), user_dn=user_dn(), requests=toString(docs),
                                 misc_table=json2table(assignDict, web_ui_names(), "all_attributes"),
                                 misc_json=json2form(assignDict, indent=2, keep_first_value=True))
     return self.abs_page('assign', content)
Пример #4
0
 def assign(self, **kwds):
     """assign page"""
     if not kwds:
         kwds = {}
     if 'status' not in kwds:
         kwds.update({'status': 'assignment-approved'})
     docs = []
     attrs = [
         'RequestName', 'RequestDate', 'Group', 'Requestor', 'RequestStatus'
     ]
     data = self.reqmgr.getRequestByStatus(statusList=[kwds['status']])
     for val in data.values():
         docs.append(request_attr(val, attrs))
     sortby = kwds.get('sort', 'status')
     docs = [r for r in sort(docs, sortby)]
     misc_json = {
         'RequestPriority': 5000,
         'CMSSWVersion': releases(),
         'ScramArch': architectures(),
         'SiteWhitelist': SITE_CACHE.getData(),
         'SiteBlacklist': SITE_CACHE.getData(),
         'SubscriptionPriority': ['Low', 'Normal', 'High'],
         'CustodialSubType': ['Move', 'Replica'],
         'NonCustodialSubType': ['Move', 'Replica'],
         'MinMergeSize': 2147483648,
         'MaxMergeSize': 4294967296,
         'MaxMergeEvents': 50000,
         'MaxRSS': 20411724,
         'MaxVSize': 20411724,
         'SoftTimeout': 129600,
         'GracePeriod': 300,
         'BlockCloseMaxWaitTime': 66400,
         'BlockCloseMaxFiles': 500,
         'BlockCloseMaxEvents': 250000000,
         'BlockCloseMaxSize': 5000000000000,
         'AcquisitionEra': '',
         'ProcessingVersion': 1,
         'ProcessingString': '',
         'MergedLFNBase': lfn_bases(),
         'UnmergedLFNBase': lfn_unmerged_bases(),
         'Dashboard': dashboardActivities(),
         'Team': self.getTeams()
     }
     filter_sort = self.templatepage('filter_sort')
     content = self.templatepage('assign',
                                 sort=sortby,
                                 filter_sort_table=filter_sort,
                                 sites=SITE_CACHE.getData(),
                                 site_white_list=site_white_list(),
                                 site_black_list=site_black_list(),
                                 user=user(),
                                 user_dn=user_dn(),
                                 requests=toString(docs),
                                 misc_table=json2table(
                                     misc_json, web_ui_names(),
                                     "all_attributes"),
                                 misc_json=json2form(misc_json,
                                                     indent=2,
                                                     keep_first_value=True))
     return self.abs_page('assign', content)
Пример #5
0
 def assign(self, **kwds):
     """assign page"""
     if not kwds:
         kwds = {}
     if 'status' not in kwds:
         kwds.update({'status': 'assignment-approved'})
     docs = []
     attrs = ['RequestName', 'RequestDate', 'Group', 'Requestor', 'RequestStatus']
     dataResult = self.reqmgr.getRequestByStatus(statusList=[kwds['status']])
     for data in dataResult:
         for val in data.values():
             docs.append(request_attr(val, attrs))
     sortby = kwds.get('sort', 'status')
     docs = [r for r in sort(docs, sortby)]
     misc_json = {'RequestPriority': 5000,
                  'CMSSWVersion': releases(),
                  'ScramArch': architectures(),
                  'SiteWhitelist': SITE_CACHE.getData(),
                  'SiteBlacklist': SITE_CACHE.getData(),
                  'SubscriptionPriority': ['Low', 'Normal', 'High'],
                  'CustodialSubType': ['Move', 'Replica'],
                  'NonCustodialSubType': ['Move', 'Replica'],
                  'MinMergeSize': 2147483648,
                  'MaxMergeSize': 4294967296,
                  'MaxMergeEvents': 50000,
                  'MaxRSS': 20411724,
                  'MaxVSize': 20411724,
                  'SoftTimeout': 129600,
                  'GracePeriod': 300,
                  'BlockCloseMaxWaitTime': 66400,
                  'BlockCloseMaxFiles': 500,
                  'BlockCloseMaxEvents': 250000000,
                  'BlockCloseMaxSize': 5000000000000,
                  'AcquisitionEra': '',
                  'ProcessingVersion': 1,
                  'ProcessingString': '',
                  'MergedLFNBase': lfn_bases(),
                  'UnmergedLFNBase': lfn_unmerged_bases(),
                  'Dashboard': dashboardActivities(),
                  'Team': self.getTeams()}
     filter_sort = self.templatepage('filter_sort')
     content = self.templatepage('assign', sort=sortby,
                                 filter_sort_table=filter_sort,
                                 sites=SITE_CACHE.getData(),
                                 site_white_list=site_white_list(),
                                 site_black_list=site_black_list(),
                                 user=user(), user_dn=user_dn(), requests=toString(docs),
                                 misc_table=json2table(misc_json, web_ui_names(), "all_attributes"),
                                 misc_json=json2form(misc_json, indent=2, keep_first_value=True))
     return self.abs_page('assign', content)
Пример #6
0
 def fetch(self, rid, **kwds):
     "Fetch document for given id"
     rid = rid.replace('request-', '')
     doc = self.reqmgr.getRequestByNames(rid)
     transitions = []
     tstamp = time.time()
     if len(doc) == 1:
         try:
             doc = doc[rid]
         except:
             pass
         name = doc.get('RequestName', 'NA')
         title = 'Request %s' % name
         status = doc.get('RequestStatus', '')
         transitions = REQUEST_STATE_TRANSITION.get(status, [])
         if status in transitions:
             transitions.remove(status)
         content = self.templatepage('doc',
                                     title=title,
                                     status=status,
                                     name=name,
                                     table=json2table(doc, web_ui_names()),
                                     jsondata=json2form(
                                         doc,
                                         indent=2,
                                         keep_first_value=False),
                                     transitions=transitions,
                                     ts=tstamp,
                                     user=self.user(),
                                     userdn=self.user_dn())
     elif len(doc) > 1:
         jsondata = [pprint.pformat(d) for d in doc]
         content = self.templatepage('doc',
                                     title='Series of docs: %s' % rid,
                                     table="",
                                     jsondata=jsondata,
                                     transitions=transitions,
                                     ts=tstamp,
                                     user=self.user(),
                                     userdn=self.user_dn())
     else:
         doc = 'No request found for name=%s' % rid
     return self.abs_page('request', content)
Пример #7
0
 def create(self, **kwds):
     """create page"""
     # get list of standard specs from WMCore and new ones from local area
     loc_specs_dir = os.path.join(self.spdir, 'Specs') # local specs
     loc_specs = spec_list(loc_specs_dir, 'Specs')
     all_specs = list(set(self.std_specs + loc_specs))
     all_specs.sort()
     spec = kwds.get('form', '')
     if  not spec:
         spec = self.std_specs[0]
     # make spec first in all_specs list
     if  spec in all_specs:
         all_specs.remove(spec)
     all_specs = [spec] + all_specs
     jsondata = get_request_template_from_type(spec)
     # create templatized page out of provided forms
     self.update_scripts()
     content = self.templatepage('create', table=json2table(jsondata, web_ui_names()),
             jsondata=json2form(jsondata, indent=2, keep_first_value=True), name=spec,
             scripts=[s for s in self.sdict.keys() if s!='ts'],
             specs=all_specs)
     return self.abs_page('create', content)
Пример #8
0
    def fetch(self, rid):
        "Fetch document for given id"
        rid = rid.replace('request-', '')
        doc = self.reqmgr.getRequestByNames(rid)
        transitions = []
        tst = time.time()
        # get request tasks
        tasks = self.reqmgr.getRequestTasks(rid)
        if len(doc) == 1:
            try:
                doc = doc[0][rid]
            except:
                pass
            name = doc.get('RequestName', 'NA')
            title = 'Request %s' % name
            status = doc.get('RequestStatus', '')
            transitions = REQUEST_STATE_TRANSITION.get(status, [])
            if status in transitions:
                transitions.remove(status)
            visible_attrs = get_modifiable_properties(status)
            filterout_attrs = get_protected_properties()
            # extend filterout list with "RequestStatus" since it is passed separately
            filterout_attrs.append("RequestStatus")

            for key, val in self.assignArgs.items():
                if not doc.get(key):
                    doc[key] = val

            if visible_attrs == "all_attributes":
                filteredDoc = doc
                for prop in filterout_attrs:
                    if prop in filteredDoc:
                        del filteredDoc[prop]
            else:
                filteredDoc = {}
                for prop in visible_attrs:
                    filteredDoc[prop] = doc.get(prop, "")

            propValueMap = getPropValueMap()
            propValueMap['Team'] = self.getTeams()

            selected = {}
            for prop in propValueMap:
                if prop in filteredDoc:
                    filteredDoc[prop], selected[prop] = reorder_list(
                        propValueMap[prop], filteredDoc[prop])

            content = self.templatepage(
                'doc',
                title=title,
                status=status,
                name=name,
                rid=rid,
                tasks=json2form(tasks, indent=2, keep_first_value=False),
                table=json2table(filteredDoc, web_ui_names(), visible_attrs,
                                 selected),
                jsondata=json2form(doc, indent=2, keep_first_value=False),
                doc=json.dumps(doc),
                time=time,
                tasksConfigs=tasks_configs(doc, html=True),
                sTransition=state_transition(doc),
                pTransition=priority_transition(doc),
                transitions=transitions,
                ts=tst,
                user=user(),
                userdn=user_dn())
        elif len(doc) > 1:
            jsondata = [pprint.pformat(d) for d in doc]
            content = self.templatepage('doc',
                                        title='Series of docs: %s' % rid,
                                        table="",
                                        jsondata=jsondata,
                                        time=time,
                                        tasksConfigs=tasks_configs(doc,
                                                                   html=True),
                                        sTransition=state_transition(doc),
                                        pTransition=priority_transition(doc),
                                        transitions=transitions,
                                        ts=tst,
                                        user=user(),
                                        userdn=user_dn())
        else:
            doc = 'No request found for name=%s' % rid
        return self.abs_page('request', content)
Пример #9
0
    def fetch(self, rid):
        "Fetch document for given id"
        rid = rid.replace('request-', '')
        doc = self.reqmgr.getRequestByNames(rid)
        transitions = []
        tst = time.time()
        # get request tasks
        tasks = self.reqmgr.getRequestTasks(rid)
        if len(doc) == 1:
            try:
                doc = doc[0][rid]
            except:
                pass
            name = doc.get('RequestName', 'NA')
            title = 'Request %s' % name
            status = doc.get('RequestStatus', '')
            transitions = REQUEST_STATE_TRANSITION.get(status, [])
            if status in transitions:
                transitions.remove(status)
            visible_attrs = get_modifiable_properties(status)
            filterout_attrs = get_protected_properties()
            # extend filterout list with "RequestStatus" since it is passed separately
            filterout_attrs.append("RequestStatus")

            for key, val in self.assignArgs.items():
                if not doc.get(key):
                    doc[key] = val

            if visible_attrs == "all_attributes":
                filteredDoc = doc
                for prop in filterout_attrs:
                    if prop in filteredDoc:
                        del filteredDoc[prop]
            else:
                filteredDoc = {}
                for prop in visible_attrs:
                    filteredDoc[prop] = doc.get(prop, "")

            propValueMap = getPropValueMap()
            propValueMap['Team'] = self.getTeams()

            selected = {}
            for prop in propValueMap:
                if prop in filteredDoc:
                    filteredDoc[prop], selected[prop] = reorder_list(propValueMap[prop], filteredDoc[prop])

            content = self.templatepage('doc', title=title, status=status, name=name, rid=rid,
                                        tasks=json2form(tasks, indent=2, keep_first_value=False),
                                        table=json2table(filteredDoc, web_ui_names(), visible_attrs, selected),
                                        jsondata=json2form(doc, indent=2, keep_first_value=False),
                                        doc=json.dumps(doc), time=time,
                                        tasksConfigs=tasks_configs(doc, html=True),
                                        sTransition=state_transition(doc),
                                        pTransition=priority_transition(doc),
                                        transitions=transitions, humanStates=REQUEST_HUMAN_STATES,
                                        ts=tst, user=user(), userdn=user_dn())
        elif len(doc) > 1:
            jsondata = [pprint.pformat(d) for d in doc]
            content = self.templatepage('doc', title='Series of docs: %s' % rid,
                                        table="", jsondata=jsondata, time=time,
                                        tasksConfigs=tasks_configs(doc, html=True),
                                        sTransition=state_transition(doc),
                                        pTransition=priority_transition(doc),
                                        transitions=transitions, humanStates=REQUEST_HUMAN_STATES,
                                        ts=tst, user=user(), userdn=user_dn())
        else:
            doc = 'No request found for name=%s' % rid
        return self.abs_page('request', content)
Пример #10
0
    def fetch(self, rid):
        "Fetch document for given id"
        rid = rid.replace('request-', '')
        doc = self.reqmgr.getRequestByNames(rid)
        transitions = []
        tst = time.time()
        # get request tasks
        tasks = self.reqmgr.getRequestTasks(rid)
        if len(doc) == 1:
            try:
                doc = doc[rid]
            except:
                pass
            name = doc.get('RequestName', 'NA')
            title = 'Request %s' % name
            status = doc.get('RequestStatus', '')
            transitions = REQUEST_STATE_TRANSITION.get(status, [])
            if status in transitions:
                transitions.remove(status)
            visible_attrs = get_modifiable_properties(status)
            filterout_attrs = get_protected_properties()

            #extend filterout list with "RequestStatus" since it is passed separately
            filterout_attrs.append("RequestStatus")

            if visible_attrs == "all_attributes":
                filteredDoc = doc
                for prop in filterout_attrs:
                    if prop in filteredDoc:
                        del filteredDoc[prop]
            else:
                filteredDoc = {}
                for prop in visible_attrs:
                    filteredDoc[prop] = doc.get(prop, "")

            listPNNs = PNN_CACHE.getData()
            prop_value_map = {
                'CMSSWVersion': releases(),
                'SiteWhitelist': SITE_CACHE.getData(),
                'SiteBlacklist': SITE_CACHE.getData(),
                'SubscriptionPriority': ['Low', 'Normal', 'High'],
                'CustodialSites': listPNNs,
                'CustodialSubType': ['Move', 'Replica'],
                'NonCustodialSites': listPNNs,
                'NonCustodialSubType': ['Move', 'Replica'],
                'AutoApproveSubscriptionSites': listPNNs,
                'MergedLFNBase': lfn_bases(),
                'UnmergedLFNBase': lfn_unmerged_bases(),
                'TrustPUSitelists': [True, False],
                'TrustSitelists': [True, False],
                'Dashboard': dashboardActivities(),
                'Team': self.getTeams()
            }

            selected = {}
            for prop in prop_value_map:
                if prop in filteredDoc:
                    filteredDoc[prop], selected[prop] = reorder_list(
                        prop_value_map[prop], filteredDoc[prop])

            content = self.templatepage(
                'doc',
                title=title,
                status=status,
                name=name,
                rid=rid,
                tasks=json2form(tasks, indent=2, keep_first_value=False),
                table=json2table(filteredDoc, web_ui_names(), visible_attrs,
                                 selected),
                jsondata=json2form(doc, indent=2, keep_first_value=False),
                doc=json.dumps(doc),
                time=time,
                transitions=transitions,
                ts=tst,
                user=user(),
                userdn=user_dn())
        elif len(doc) > 1:
            jsondata = [pprint.pformat(d) for d in doc]
            content = self.templatepage('doc',
                                        title='Series of docs: %s' % rid,
                                        table="",
                                        jsondata=jsondata,
                                        time=time,
                                        transitions=transitions,
                                        ts=tst,
                                        user=user(),
                                        userdn=user_dn())
        else:
            doc = 'No request found for name=%s' % rid
        return self.abs_page('request', content)
Пример #11
0
    def fetch(self, rid):
        "Fetch document for given id"
        rid = rid.replace('request-', '')
        doc = self.reqmgr.getRequestByNames(rid)
        transitions = []
        tst = time.time()
        # get request tasks
        tasks = self.reqmgr.getRequestTasks(rid)
        if len(doc) == 1:
            try:
                doc = doc[rid]
            except:
                pass
            name = doc.get('RequestName', 'NA')
            title = 'Request %s' % name
            status = doc.get('RequestStatus', '')
            transitions = REQUEST_STATE_TRANSITION.get(status, [])
            if status in transitions:
                transitions.remove(status)
            visible_attrs = get_modifiable_properties(status)
            filterout_attrs = get_protected_properties()
            
            #extend filterout list with "RequestStatus" since it is passed separately
            filterout_attrs.append("RequestStatus")
            
            if visible_attrs == "all_attributes":
                filteredDoc = doc
                for prop in filterout_attrs:
                    if prop in filteredDoc:
                        del filteredDoc[prop]                    
            else:
                filteredDoc = {}
                for prop in visible_attrs:
                    filteredDoc[prop] = doc.get(prop, "")

            listPNNs = PNN_CACHE.getData()
            prop_value_map = {'CMSSWVersion': releases(),
                              'SiteWhitelist': SITE_CACHE.getData(),
                              'SiteBlacklist': SITE_CACHE.getData(),
                              'SubscriptionPriority': ['Low', 'Normal', 'High'],
                              'CustodialSites': listPNNs,
                              'CustodialSubType': ['Move', 'Replica'],
                              'NonCustodialSites': listPNNs,
                              'NonCustodialSubType': ['Move', 'Replica'],
                              'AutoApproveSubscriptionSites': listPNNs,
                              'MergedLFNBase': lfn_bases(),
                              'UnmergedLFNBase': lfn_unmerged_bases(),
                              'TrustPUSitelists': [True, False],
                              'TrustSitelists': [True, False],                    
                              'Dashboard': dashboardActivities(),
                              'Team': self.getTeams()}
            
            selected = {}
            for prop in prop_value_map:
                if prop in filteredDoc:
                    filteredDoc[prop], selected[prop] = reorder_list(prop_value_map[prop], filteredDoc[prop])
                    
            content = self.templatepage('doc', title=title, status=status, name=name, rid=rid,
                                        tasks=json2form(tasks, indent=2, keep_first_value=False),
                                        table=json2table(filteredDoc, web_ui_names(), visible_attrs, selected),
                                        jsondata=json2form(doc, indent=2, keep_first_value=False),
                                        doc=json.dumps(doc), time=time,
                                        transitions=transitions, ts=tst, user=user(), userdn=user_dn())
        elif len(doc) > 1:
            jsondata = [pprint.pformat(d) for d in doc]
            content = self.templatepage('doc', title='Series of docs: %s' % rid,
                                        table="", jsondata=jsondata, time=time,
                                        transitions=transitions, ts=tst, user=user(), userdn=user_dn())
        else:
            doc = 'No request found for name=%s' % rid
        return self.abs_page('request', content)