Пример #1
0
 def approve(self, **kwargs):
     """
     Approve page: get list of request associated with user DN.
     Fetch their status list from ReqMgr and display if requests
     were seen by data-ops.
     """
     requests = []
     for rstat in ['new', 'new', 'assigned', 'running']:
         wdict = dict(date=time.ctime(), team='Team-A', status=rstat, ID=genid(time.time()))
         requests.append(wdict)
     print "Env:", os.environ['PYTHONPATH']
     content = self.templatepage('approve', requests=requests)
     return self.abs_page('generic', content)
Пример #2
0
 def request(self, **kwargs):
     "Get data example and expose it as json"
     dataset = kwargs.get('uinput', '')
     if  not dataset:
         return {'error':'no input dataset'}
     url = 'https://cmsweb.cern.ch/reqmgr/rest/outputdataset/%s' % dataset
     params = {}
     headers = {'Accept': 'application/json;text/json'}
     wdata = getdata(url, params)
     wdict = dict(date=time.ctime(), team='Team-A', status='Running', ID=genid(wdata))
     winfo = self.templatepage('workflow', wdict=wdict,
             dataset=dataset, code=pprint.pformat(wdata))
     content = self.templatepage('search', content=winfo)
     return self.abs_page('generic', content)
Пример #3
0
 def generate_objs(self, **kwargs):
     """create page interface: generate objects from givem JSON template"""
     jsondict = json.loads(kwargs.get('jsondict'))
     code = kwargs.get('code')
     if  code.find('def genobjs(jsondict)') == -1:
         return self.error("Improper python snippet, your code should start with <b>def genobjs(jsondict)</b> function")
     exec(code)
     objs = genobjs(jsondict)
     rids = []
     for iobj in objs:
         print "### generate JSON"
         print iobj
         rids.append(genid(iobj))
     content = self.templatepage('confirm', ticket=rids, user=self.user())
     return self.abs_page('generic', content)
Пример #4
0
 def requests(self, **kwargs):
     """Check status of requests"""
     wdict = dict(date=time.ctime(), team='Team-A', status='Pending', ID=genid(time.time()))
     requests = [wdict, wdict, wdict]
     content = self.templatepage('requests', requests=requests)
     return self.abs_page('generic', content)
Пример #5
0
 def confirm_create(self, **kwargs):
     """create page"""
     rid = genid(kwargs)
     content = self.templatepage('confirm', ticket=rid, user=self.user())
     return self.abs_page('generic', content)
Пример #6
0
 def add_team(self, **kwargs):
     """add_team action"""
     rid = genid(kwargs)
     content = self.templatepage('confirm', ticket=rid, user=self.user())
     return self.abs_page('generic', content)