Example #1
0
    def __init__(self, config={}):

        RESTModel.__init__(self, config)

        self.serviceURL = self.config.serviceURL
        self.serviceLevel = self.config.serviceLevel
        self.workloadSummaryCouchURL = self.config.workloadSummaryCouchURL

        self._addMethod("GET",
                        "requestmonitor",
                        self.getRequestMonitor,
                        secured=True)  #expires=16000
        self._addMethod("GET",
                        "agentmonitor",
                        self.getAgentMonitor,
                        args=['detail'],
                        secured=True)
        self._addMethod("GET",
                        "sitemonitor",
                        self.getSiteMonitor,
                        secured=True)
        self._addMethod("GET", "env", self.getEnvValues, secured=True)
        self._addMethod("GET",
                        "requests",
                        self.getRequests,
                        args=['name'],
                        secured=True)  #expires=16000
Example #2
0
    def __init__(self, config={}):
        RESTModel.__init__(self, config)

        self._addMethod('POST', 'file', self.uploadFile,
                        args=['file1'])

        cherrypy.engine.subscribe('start_thread', self.initThread)
Example #3
0
    def __init__(self, config={}):
        RESTModel.__init__(self, config)

        self._addMethod('POST', 'file', self.uploadFile,
                        args=['file1'])

        cherrypy.engine.subscribe('start_thread', self.initThread)
Example #4
0
    def __init__(self, config):
        RESTModel.__init__(self, config)

        self.methods['POST'] = {
            'plot': {
                'version': 1,
                'call': self.plot,
                'args': ['type', 'data', 'url'],
                'expires': 300
            }
        }
        self.methods['GET'] = {
            'plot': {
                'version': 1,
                'call': self.plot,
                'args': ['type', 'data', 'url'],
                'expires': 300
            },
            'doc': {
                'version': 1,
                'call': self.doc,
                'args': ['type'],
                'expires': 300
            }
        }
        self.factory = WMFactory('plot_fairy',
                                 'WMCore.HTTPFrontEnd.PlotFairy.Plots')
Example #5
0
    def __init__(self, config):
        '''
        Initialise the RESTModel and add some methods to it.
        '''
        RESTModel.__init__(self, config)

        del self.methods['POST']
        del self.methods['GET']

        self.methods['PUT'] = {
            'list': {
                'args': [
                    'cms_name', 'site_name', 'country', 'usage', 'url',
                    'logourl'
                ],
                'call':
                self.add_site,
                'version':
                1
            },
            'links': {
                'args': ['name', 'url'],
                'call': self.add_link,
                'version': 1
            }
        }
Example #6
0
    def __init__(self, config):
        '''
        Initialise the RESTModel and add some methods to it.
        '''
        RESTModel.__init__(self, config)

        del self.methods['POST']
        del self.methods['GET']
Example #7
0
 def __init__(self, config):
     '''
     Initialise the RESTModel and add some methods to it.
     '''
     RESTModel.__init__(self, config)
     
     del self.methods['POST']
     del self.methods['GET']
Example #8
0
 def __init__(self, config):
     '''
     Initialise the RESTModel and add some methods to it.
     '''
     RESTModel.__init__(self, config)
     # Import the GET methods
     get = Get(config)
     self.methods['GET'] = get.methods['GET']
Example #9
0
 def __init__(self, config):
     '''
     Initialise the RESTModel and add some methods to it.
     '''
     RESTModel.__init__(self, config)
     # Import the GET methods
     get = Get(config)
     self.methods['GET'] = get.methods['GET']
     
    def __init__(self, config={}):
        RESTModel.__init__(self, config)

        self.mapme = imp.load_source('', os.path.join( os.path.dirname(__file__), "../../../data/mapper.py"))

        self.defaulturi = self.mapme.defaulturi

        self._addMethod('POST', 'user', self.addNewUser,
                        args=[],
                        validation=[self.isalnum])

        self._addMethod('POST', 'task', self.postRequest,
                        args=['requestName'],
                        validation=[self.isalnum])

        self._addMethod('DELETE', 'task', self.deleteRequest,
                        args=['requestID'],
                        validation=[self.isalnum])

        self._addMethod('GET', 'task', self.getTaskStatus,
                        args=['requestID'],
                        validation=[self.isalnum])
        #/data
        self._addMethod('GET', 'data', self.getDataLocation,
                       args=['requestID','jobRange'], validation=[self.isalnum])

        self._addMethod('POST', 'publish', self.publish,
                        args=['requestName'],
                        validation=[self.isalnum])

        #/goodLumis
        self._addMethod('GET', 'goodLumis', self.getGoodLumis,
                       args=['requestID'], validation=[self.isalnum])
        #
        self._addMethod('POST', 'lumiMask', self.postLumiMask,
                       args=[], validation=[self.isalnum])

        # Server
        self._addMethod('GET', 'info', self.getServerInfo,
                        args=[],
                        validation=[self.isalnum])

        self._addMethod('GET', 'requestmapping', self.getClientMapping,
                        args=[],
                        validation=[self.isalnum])

        self._addMethod('GET', 'jobErrors', self.getJobErrors,
                        args=['requestID'],
                        validation=[self.isalnum])

        self._addMethod('POST', 'resubmit', self.reSubmit,
                        args=['requestID'],
                        validation=[self.isalnum])

        cherrypy.engine.subscribe('start_thread', self.initThread)
Example #11
0
    def __init__(self, config):
        """
        All parameters are provided through DBSConfig module
        """
        RESTModel.__init__(self, config)
	
        self.addMethod('POST', 'submit', self.submit)
        self.addMethod('POST', 'remove', self.remove)
        self.addMethod('GET',  'status', self.status)

	self.dbsMigrate = DBSMigrate(self.logger, self.dbi, config.dbowner)
Example #12
0
    def __init__(self, config={}):

        RESTModel.__init__(self, config)
        # print config
        self.serviceURL = self.config.serviceURL
        self.serviceLevel = self.config.serviceLevel
        self.workloadSummaryCouchURL = self.config.workloadSummaryCouchURL

        self._addMethod("GET", "requestmonitor", self.getRequestMonitor)  # expires=16000
        self._addMethod("GET", "agentmonitor", self.getAgentMonitor, args=["detail"])
        self._addMethod("GET", "sitemonitor", self.getSiteMonitor)
        self._addMethod("GET", "env", self.getEnvValues)
Example #13
0
    def __init__(self, config = {}):
        RESTModel.__init__(self, config)

        self.daofactory = DAOFactory(package = "WMCore.Agent.Database", 
                                     logger = self, dbinterface = self.dbi)

        self._addDAO('GET', "heartbeatInfo", "GetHeartbeatInfo")
        self._addDAO('GET', "heartbeatInfoDetail", "GetAllHeartbeatInfo")
        self._addDAO('GET', "agentstatus", "CheckComponentStatus")
        self._addMethod('GET', "heartbeat", self.getHeartBeatWarning)
         #External couch call
        self._addMethod('GET', "acdclink", self.getACDCInfo)
Example #14
0
    def __init__(self, config):
        '''
        Initialise the RESTModel and add some methods to it.
        '''
        RESTModel.__init__(self, config)
        self.defaultExpires = config.default_expires

        self.methods = {'GET':{
                               'ping': {'default_data':1234,
                                        'call':self.ping,
                                        'version': 1,
                                        'args': [],
                                        'expires': 3600,
                                        'validation': []},
                               #'list1': {'call':self.list1,
                               #         'version': 1}
                               },
                        'POST':{
                               'echo': {'call':self.echo,
                                        'version': 1,
                                        'args': ['message'],
                                        'validation': []},
                               }
                         }

        self._addMethod('GET', 'gen', self.gen)

        self._addMethod('GET', 'list', self.list, args=['input_int', 'input_str'],
                              validation=[self.val_0,
                                          self.val_1,
                                          self.val_2,
                                          self.val_3,
                                          self.val_4 ],
                              version=2)

        self._addMethod('GET', 'list1', self.list1)
        self._addMethod('GET', 'list2', self.list2, args=['num0', 'num1', 'num2'])
        self._addMethod('GET', 'list3', self.list3, args=['a', 'b'])
        self._addMethod('POST', 'list3', self.list3, args=['a', 'b'])
        self._addMethod('PUT', 'list1', self.list1, secured = True,
                        security_params = {'role':DUMMY_ROLE,
                                           'group': DUMMY_GROUP,
                                           'site':DUMMY_SITE})

        # a will take list of numbers. i.e. a[1,2,3]
        self._addMethod('GET', 'listTypeArgs', self.listTypeArgs, args=['aList'],
                       validation = [self.listTypeValidate])

        self.daofactory = DummyDAOFac()
        self._addDAO('GET', 'data1', 'DummyDAO1', [])
        self._addDAO('GET', 'data2', 'DummyDAO2', ['num'])
        self._addDAO('GET', 'data3', 'DummyDAO3', ['num', 'thing'])
Example #15
0
    def __init__(self, config={}):
        RESTModel.__init__(self, config)

        self.daofactory = DAOFactory(package="WMCore.Agent.Database",
                                     logger=self,
                                     dbinterface=self.dbi)

        self._addDAO('GET', "heartbeatInfo", "GetHeartbeatInfo")
        self._addDAO('GET', "heartbeatInfoDetail", "GetAllHeartbeatInfo")
        self._addDAO('GET', "agentstatus", "CheckComponentStatus")
        self._addMethod('GET', "heartbeat", self.getHeartBeatWarning)
        #External couch call
        self._addMethod('GET', "acdclink", self.getACDCInfo)
Example #16
0
 def __init__(self, config, dbi=None):
     """
     All parameters are provided through DBSConfig module
     """
     config.__dict__['default_expires'] = config.dbs.default_expires
     RESTModel.__init__(self, config)
     dbowner = config.database.dbowner
     if dbi:
         self.dbi = dbi
         self.logger = logger
     self.dbsDataset = DBSDataset(self.logger, self.dbi, dbowner)
     self.dbsFile = DBSFile(self.logger, self.dbi, dbowner)
     self.dbsBlock = DBSBlock(self.logger, self.dbi, dbowner)
Example #17
0
    def __init__(self, config = {}):

        RESTModel.__init__(self, config)
        
        self.serviceURL = self.config.serviceURL
        self.serviceLevel = self.config.serviceLevel
        self.workloadSummaryCouchURL = self.config.workloadSummaryCouchURL

        self._addMethod("GET", "requestmonitor", self.getRequestMonitor, secured=True) #expires=16000
        self._addMethod("GET", "agentmonitor", self.getAgentMonitor,
                       args = ['detail'], secured=True)
        self._addMethod("GET", "sitemonitor", self.getSiteMonitor, secured=True)
        self._addMethod("GET", "env", self.getEnvValues, secured=True)
        self._addMethod("GET", "requests", self.getRequests, args=['name'], secured=True) #expires=16000
Example #18
0
 def __init__(self, config):
     '''
     Initialise the RESTModel and add some methods to it.
     '''
     RESTModel.__init__(self, config)
     
     self.methods['GET'] = {}
     self.methods['GET']['generic_exception'] = {'args': [],
                                      'call': self.generic_exception,
                                      'version': 1}
                          
     self._addMethod('GET', 'specific_400_exception', self.specific_400_exception)
     self._addMethod('GET', 'specific_500_exception', self.specific_500_exception)
     self._addMethod('GET', 'specific_404_exception', self.specific_404_exception)
     self._addMethod('GET', 'not_serialisable', self.not_serialisable)
Example #19
0
 def __init__(self, config):
     '''
     Initialise the RESTModel and add some methods to it.
     '''
     RESTModel.__init__(self, config)
     validator = Validator({'dbi':self.dbi})
     
     self.methods['POST'] = {'software':{'args': ['ce', 'release', 'arch'],
                                         'call': self.software,
                                         'version': 2,
                                         'validation': [validator.validate_release,
                                                        validate_architecture,
                                                        validate_is_ce]}
     }
     del self.methods['GET']
Example #20
0
    def __init__(self, config):
        """
        All parameters are provided through Config module
        """
        RESTModel.__init__(self, config)
    
        self.methods = {'GET':{}, 'POST':{}}
	self.addMethod('GET', 'services', self.getServices)
	self.addMethod('POST', 'services', self.addService)
	#self.dbsSrvcReg = DBSServicesRegistry(self.logger, self.dbi, config.dbowner)
	daofactory = DAOFactory(package='dbs.dao', logger=self.logger, dbinterface=self.dbi, owner=config.dbowner)
	self.servicesadd = daofactory(classname="Service.Insert")
	self.serviceslist = daofactory(classname="Service.List")
	self.servicesupdate = daofactory(classname="Service.Update")
	self.sm = daofactory(classname = "SequenceManager")
Example #21
0
    def __init__(self, config):
        """
        Initialise the RESTModel and add some methods to it.
        """
        RESTModel.__init__(self, config)
        validator = Validator({"dbi": self.dbi})

        self.methods["POST"] = {
            "software": {
                "args": ["ce", "release", "arch"],
                "call": self.software,
                "version": 2,
                "validation": [validator.validate_release, validate_architecture, validate_is_ce],
            }
        }
        del self.methods["GET"]
Example #22
0
 def __init__(self, config):
     RESTModel.__init__(self, config)
     
     self.methods['POST'] = {'plot': {'version':1,
                                      'call':self.plot,
                                      'args': ['type', 'data', 'url'],
                                      'expires': 300}}
     self.methods['GET'] = {'plot': {'version':1,
                                      'call':self.plot,
                                      'args': ['type', 'data', 'url'],
                                      'expires': 300},
                            'doc':  {'version':1,
                                      'call':self.doc,
                                      'args': ['type'],
                                      'expires':300}}
     self.factory = WMFactory('plot_fairy',
                              'WMCore.HTTPFrontEnd.PlotFairy.Plots')
Example #23
0
 def __init__(self, config):
     '''
     Initialise the RESTModel and add some methods to it.
     '''
     RESTModel.__init__(self, config)
     
     del self.methods['POST']
     del self.methods['GET']
     
     self.methods['PUT'] = {'list': {'args':['cms_name', 'site_name', 
                                             'country', 'usage', 'url', 
                                             'logourl'],
                                     'call': self.add_site,
                                     'version': 1},
                           'links': {'args':['name', 'url'],
                                     'call': self.add_link,
                                     'version': 1}}
Example #24
0
    def __init__(self, config):
        """
        All parameters are provided through DBSConfig module
        """
        RESTModel.__init__(self, config)
        self.version = self.getServerVersion()
	self.register()
        self.methods = {'GET':{}, 'PUT':{}, 'POST':{}, 'DELETE':{}}
	self.addMethod('GET', 'serverinfo', self.getServerInfo)
        self.addMethod('GET', 'primarydatasets', self.listPrimaryDatasets)
        self.addMethod('GET', 'datasets', self.listDatasets)
        self.addMethod('GET', 'blocks', self.listBlocks)
        self.addMethod('GET', 'files', self.listFiles)
        self.addMethod('GET', 'datasetparents', self.listDatasetParents)
        self.addMethod('GET', 'datasetchildren', self.listDatasetChildren)
        self.addMethod('GET', 'outputconfigs', self.listOutputConfigs)
        self.addMethod('GET', 'fileparents', self.listFileParents)
        self.addMethod('GET', 'filechildren', self.listFileChildren)
        self.addMethod('GET', 'filelumis', self.listFileLumis)
        self.addMethod('GET', 'runs', self.listRuns)
        self.addMethod('GET', 'sites', self.listSites)
        self.addMethod('GET', 'datatypes', self.listDataTypes)
        self.addMethod('GET', 'datatiers', self.listDataTiers)
        self.addMethod('GET', 'blockparents', self.listBlockParents)
        self.addMethod('GET', 'blockchildren', self.listBlockChildren)
        self.addMethod('GET', 'blockdump', self.dumpBlock)
        self.addMethod('GET', 'acquisitioneras', self.listAcquisitionEras)
        self.addMethod('GET', 'processingeras', self.listProcessingEras)
	self.addMethod('GET', 'help', self.getHelp)
	self.addMethod('GET', 'register', self.register)

        self.dbsPrimaryDataset = DBSPrimaryDataset(self.logger, self.dbi, config.dbowner)
        self.dbsDataset = DBSDataset(self.logger, self.dbi, config.dbowner)
        self.dbsBlock = DBSBlock(self.logger, self.dbi, config.dbowner)
        self.dbsFile = DBSFile(self.logger, self.dbi, config.dbowner)
        self.dbsAcqEra = DBSAcquisitionEra(self.logger, self.dbi, config.dbowner)
        self.dbsOutputConfig = DBSOutputConfig(self.logger, self.dbi, config.dbowner)
        self.dbsProcEra = DBSProcessingEra(self.logger, self.dbi, config.dbowner)
        self.dbsSite = DBSSite(self.logger, self.dbi, config.dbowner)
	self.dbsRun = DBSRun(self.logger, self.dbi, config.dbowner)
	self.dbsDataType = DBSDataType(self.logger, self.dbi, config.dbowner)
	self.dbsDataTier = DBSDataTier(self.logger, self.dbi, config.dbowner)
	self.dbsStatus = DBSStatus(self.logger, self.dbi, config.dbowner)
	self.dbsMigrate = DBSMigrate(self.logger, self.dbi, config.dbowner)

	self.dbsUtils = DBSUtils()
Example #25
0
    def __init__(self, config):
        """
        All parameters are provided through DBSConfig module
        """
        dbowner = config.database.dbowner

        RESTModel.__init__(self, config)
        self.methods = {'GET':{}, 'PUT':{}, 'POST':{}, 'DELETE':{}}
        self.security_params = config.security.params
       
        self._addMethod('POST', 'submit', self.submit,  secured=True,
            security_params={'role':self.security_params, 'authzfunc': authInsert})
        self._addMethod('POST', 'remove', self.remove, secured=True,
            security_params={'role':self.security_params, 'authzfunc': authInsert})
        self._addMethod('GET', 'status', self.status, args=['migration_rqst_id', 'block_name', 'dataset', 'user'],
                        secured=True, security_params={'role':self.security_params, 'authzfunc': authInsert})
        
        self.dbsMigrate = DBSMigrate(self.logger, self.dbi, dbowner)
Example #26
0
    def __init__(self, config):
        """
        All parameters are provided through Config module
        """
        RESTModel.__init__(self, config)

        self.methods = {'GET': {}, 'POST': {}}
        self.addMethod('GET', 'services', self.getServices)
        self.addMethod('POST', 'services', self.addService)
        #self.dbsSrvcReg = DBSServicesRegistry(self.logger, self.dbi,
        #                                      config.dbowner)
        daofactory = DAOFactory(package='dbs.dao',
                                logger=self.logger,
                                dbinterface=self.dbi,
                                owner=config.dbowner)
        self.servicesadd = daofactory(classname="Service.Insert")
        self.serviceslist = daofactory(classname="Service.List")
        self.servicesupdate = daofactory(classname="Service.Update")
        self.sm = daofactory(classname="SequenceManager")
Example #27
0
    def __init__(self, config):
        '''
        Initialise the RESTModel and add some methods to it.
        '''
        RESTModel.__init__(self, config)

        self.methods['GET'] = {}
        self.methods['GET']['generic_exception'] = {
            'args': [],
            'call': self.generic_exception,
            'version': 1
        }

        self._addMethod('GET', 'specific_400_exception',
                        self.specific_400_exception)
        self._addMethod('GET', 'specific_500_exception',
                        self.specific_500_exception)
        self._addMethod('GET', 'specific_404_exception',
                        self.specific_404_exception)
        self._addMethod('GET', 'not_serialisable', self.not_serialisable)
Example #28
0
    def __init__(self, config):
        """
        All parameters are provided through DBSConfig module
        """
        dbowner = config.database.dbowner

        RESTModel.__init__(self, config)

        # set proper logger name
        self.logger.name = __name__

        self.methods = {'GET':{}, 'PUT':{}, 'POST':{}, 'DELETE':{}}
        self.security_params = config.security.params
       
        self._addMethod('POST', 'submit', self.submit,  secured=True,
            security_params={'role':self.security_params, 'authzfunc': authInsert})
        self._addMethod('POST', 'remove', self.remove, secured=True,
            security_params={'role':self.security_params, 'authzfunc': authInsert})
        self._addMethod('GET', 'status', self.status, args=['migration_rqst_id', 'block_name', 'dataset', 'user'],
                        secured=True, security_params={'role':self.security_params, 'authzfunc': authInsert})
        
        self.dbsMigrate = DBSMigrate(self.logger, self.dbi, dbowner)
Example #29
0
    def __init__(self, config={}):

        RESTModel.__init__(self, config)

        # External couch call
        self._addMethod("GET", "jobsummary", self.getJobSummary)
        self._addMethod("GET", "jobstatebysite", self.getJobStateBySite)
        # batch system status
        bossAirDAOFactory = DAOFactory(package="WMCore.BossAir",
                                       logger=self,
                                       dbinterface=self.dbi)

        self._addDAO('GET',
                     'batchjobstatus',
                     "JobStatusForMonitoring",
                     daoFactory=bossAirDAOFactory)

        self._addDAO('GET',
                     'batchjobstatusbysite',
                     "JobStatusByLocation",
                     daoFactory=bossAirDAOFactory)

        self.daofactory = DAOFactory(package="WMCore.WMBS",
                                     logger=self,
                                     dbinterface=self.dbi)

        self._addDAO('GET', 'listsites', "Locations.List")
        self._addDAO('GET', "listsubtypes", "Monitoring.ListSubTypes")
        self._addDAO('GET', "listjobstates", "Monitoring.ListJobStates")
        self._addDAO('GET',
                     "listjobsbysub",
                     "Monitoring.ListJobsBySub",
                     args=["subscriptionId"],
                     validation=[self.subscriptionIDValidate])
        self._addDAO('GET',
                     "subscriptionstatus",
                     "Monitoring.SubscriptionStatus",
                     args=["subscriptionType"],
                     validation=[self.subTypeValidate])
        self._addDAO('GET', "listrunningjobs", "Monitoring.ListRunningJobs")
        self._addMethod('GET',
                        "listjobstatus",
                        self.listJobStatus,
                        args=["jobState", "interval"],
                        validation=[self.jobStatusValidate])

        self._addDAO('GET', "workflowstatus", "Workflow.Status")
        self._addDAO('GET', "workflowsummary", "Monitoring.WorkflowSummary")
        self._addDAO('GET',
                     "tasksummary",
                     "Monitoring.TaskSummaryByWorkflow",
                     args=["workflowName"])

        self._addDAO('GET',
                     "failedjobsbyworkflow",
                     "Monitoring.FailedJobsByWorkflow",
                     args=["workflowName"])

        self._addDAO('GET',
                     "failedjobsbytask",
                     "Monitoring.FailedJobsByTask",
                     args=["taskID"])

        self._addDAO('GET', "test", "Workflow.Test")

        resourceDAOFactory = DAOFactory(package="WMCore.ResourceControl",
                                        logger=self,
                                        dbinterface=self.dbi)

        self._addDAO('GET',
                     "listthresholdsforsubmit",
                     "ListThresholdsForSubmit",
                     args=["tableFormat"],
                     validation=[self.setTableFormat],
                     daoFactory=resourceDAOFactory)

        self._addDAO('GET',
                     "listthresholdsforcreate",
                     "ListThresholdsForCreate",
                     args=["tableFormat"],
                     validation=[self.setTableFormat],
                     daoFactory=resourceDAOFactory)

        self._addDAO('GET',
                     "thresholdbysite",
                     "ThresholdBySite",
                     args=["site"],
                     daoFactory=resourceDAOFactory)

        self._addDAO('GET',
                     "listtaskbysite",
                     "ListWorkloadsForTaskSite",
                     args=["taskType", "siteName"],
                     daoFactory=resourceDAOFactory)

        self._addDAO('GET',
                     "listthresholds",
                     "ListThresholds",
                     daoFactory=resourceDAOFactory)

        # self._addDAO('GET', "updatethresholds", "UpdateThresholdsInBulk",
        #             args = ['sitename', 'tasktype', 'maxslots'],
        #             daoFactory = resourceDAOFactory)

        self._addDAO('GET',
                     "updatethreshold",
                     "InsertThreshold",
                     args=['siteName', 'taskType', 'maxSlots'],
                     daoFactory=resourceDAOFactory)

        dbsDAOFactory = DAOFactory(package="WMComponent.DBSBuffer.Database",
                                   logger=self,
                                   dbinterface=self.dbi)

        self._addDAO('GET',
                     "dbsbufferstatus",
                     "Status",
                     daoFactory=dbsDAOFactory)

        self._addMethod('GET', 'jobinfobyid', self.jobInfoByID, args=['jobID'])

        return
Example #30
0
    def __init__(self, config={}):
        RESTModel.__init__(self, config)

        self.mapme = imp.load_source(
            '',
            os.path.join(os.path.dirname(__file__), "../../../data/mapper.py"))

        self.defaulturi = self.mapme.defaulturi

        self._addMethod('POST',
                        'user',
                        self.addNewUser,
                        args=[],
                        validation=[self.isalnum])

        self._addMethod('POST',
                        'task',
                        self.postRequest,
                        args=['requestName'],
                        validation=[self.isalnum])

        self._addMethod('DELETE',
                        'task',
                        self.deleteRequest,
                        args=['requestID'],
                        validation=[self.isalnum])

        self._addMethod('GET',
                        'task',
                        self.getTaskStatus,
                        args=['requestID'],
                        validation=[self.isalnum])
        #/data
        self._addMethod('GET',
                        'data',
                        self.getDataLocation,
                        args=['requestID', 'jobRange'],
                        validation=[self.isalnum])

        self._addMethod('POST',
                        'publish',
                        self.publish,
                        args=['requestName'],
                        validation=[self.isalnum])

        #/goodLumis
        self._addMethod('GET',
                        'goodLumis',
                        self.getGoodLumis,
                        args=['requestID'],
                        validation=[self.isalnum])
        #
        self._addMethod('POST',
                        'lumiMask',
                        self.postLumiMask,
                        args=[],
                        validation=[self.isalnum])

        # Server
        self._addMethod('GET',
                        'info',
                        self.getServerInfo,
                        args=[],
                        validation=[self.isalnum])

        self._addMethod('GET',
                        'requestmapping',
                        self.getClientMapping,
                        args=[],
                        validation=[self.isalnum])

        self._addMethod('GET',
                        'jobErrors',
                        self.getJobErrors,
                        args=['requestID'],
                        validation=[self.isalnum])

        self._addMethod('POST',
                        'resubmit',
                        self.reSubmit,
                        args=['requestID'],
                        validation=[self.isalnum])

        cherrypy.engine.subscribe('start_thread', self.initThread)
Example #31
0
 def __init__(self, config):
     RESTModel.__init__(self, config)
     self.methods.update({'sitelist':{'args':['name', 'type'],
                                      'call': self.sitelist,
                                      'version':2}})
Example #32
0
    def __init__(self, config):
        RESTModel.__init__(self, config)
        self.couchUrl = config.couchUrl
        self.workloadDBName = config.workloadDBName
        self.configDBName = config.configDBName
        self.wmstatWriteURL = "%s/%s" % (self.couchUrl.rstrip('/'),
                                         config.wmstatDBName)
        self.acdcURL = "%s/%s" % (self.couchUrl.rstrip('/'), config.acdcDBName)
        self.security_params = {'roles': config.security_roles}

        # Optional values for individual methods
        self.reqPriorityMax = getattr(config, 'maxReqPriority', 100)

        self._addMethod('GET',
                        'request',
                        self.getRequest,
                        args=['requestName'],
                        secured=True,
                        validation=[self.isalnum],
                        expires=0)
        self._addMethod('GET',
                        'assignment',
                        self.getAssignment,
                        args=['teamName', 'request'],
                        secured=True,
                        validation=[self.isalnum],
                        expires=0)
        self._addMethod('GET',
                        'user',
                        self.getUser,
                        args=['userName'],
                        secured=True,
                        validation=[self.isalnum],
                        expires=0)
        self._addMethod('GET',
                        'group',
                        self.getGroup,
                        args=['group', 'user'],
                        secured=True,
                        expires=0)
        self._addMethod('GET',
                        'version',
                        self.getVersion,
                        args=[],
                        secured=True,
                        expires=0)
        self._addMethod('GET',
                        'team',
                        self.getTeam,
                        args=[],
                        secured=True,
                        expires=0)
        self._addMethod('GET',
                        'workQueue',
                        self.getWorkQueue,
                        args=['request', 'workQueue'],
                        secured=True,
                        validation=[self.isalnum],
                        expires=0)
        self._addMethod('GET',
                        'message',
                        self.getMessage,
                        args=['request'],
                        secured=True,
                        validation=[self.isalnum],
                        expires=0)
        self._addMethod('GET',
                        'inputdataset',
                        self.getInputDataset,
                        args=['prim', 'proc', 'tier'],
                        secured=True)
        self._addMethod('GET',
                        'outputdataset',
                        self.getOutputDataset,
                        args=['prim', 'proc', 'tier'],
                        secured=True)
        self._addMethod('GET',
                        'campaign',
                        self.getCampaign,
                        args=['campaign'],
                        secured=True,
                        validation=[self.isalnum],
                        expires=0)
        self._addMethod('PUT',
                        'request',
                        self.putRequest,
                        args=['requestName', 'status', 'priority', 'stats'],
                        secured=True,
                        validation=[
                            self.isalnumExceptStats, self.reqPriority,
                            self.validateStats
                        ])
        self._addMethod('PUT',
                        'clone',
                        self.cloneRequest,
                        args=['requestName'],
                        secured=True,
                        validation=[self.isalnum])
        self._addMethod('PUT',
                        'assignment',
                        self.putAssignment,
                        args=['team', 'requestName'],
                        secured=True,
                        security_params=self.security_params,
                        validation=[self.isalnum])
        self._addMethod('PUT',
                        'user',
                        self.putUser,
                        args=['userName', 'email', 'dnName'],
                        secured=True,
                        security_params=self.security_params,
                        validation=[self.validateUser])
        self._addMethod('PUT',
                        'group',
                        self.putGroup,
                        args=['group', 'user'],
                        secured=True,
                        security_params=self.security_params,
                        validation=[self.isalnum])
        self._addMethod('PUT',
                        'version',
                        self.putVersion,
                        args=['version', 'scramArch'],
                        secured=True,
                        security_params=self.security_params,
                        validation=[self.validateVersion])
        self._addMethod('PUT',
                        'team',
                        self.putTeam,
                        args=['team'],
                        secured=True,
                        security_params=self.security_params,
                        validation=[self.isalnum])
        self._addMethod('PUT',
                        'workQueue',
                        self.putWorkQueue,
                        args=['request', 'url'],
                        secured=True,
                        security_params=self.security_params,
                        validation=[self.validatePutWorkQueue])
        self._addMethod('PUT',
                        'message',
                        self.putMessage,
                        args=['request'],
                        secured=True,
                        security_params=self.security_params,
                        validation=[self.isalnum])
        self._addMethod('PUT',
                        'campaign',
                        self.putCampaign,
                        args=['campaign', 'request'],
                        secured=True,
                        validation=[self.isalnum])
        self._addMethod('POST',
                        'request',
                        self.postRequest,
                        args=[
                            'requestName', 'events_written', 'events_merged',
                            'files_written', 'files_merged', 'percent_written',
                            'percent_success', 'dataset'
                        ],
                        secured=True,
                        validation=[self.validateUpdates])
        self._addMethod('POST',
                        'closeout',
                        self.closeOutRequest,
                        args=['requestName', 'cascade'],
                        secured=True,
                        validation=[self.isalnum],
                        expires=0)
        self._addMethod('POST',
                        'announce',
                        self.announceRequest,
                        args=['requestName', 'cascade'],
                        secured=True,
                        validation=[self.isalnum],
                        expires=0)
        self._addMethod('DELETE',
                        'request',
                        self.deleteRequest,
                        args=['requestName'],
                        secured=True,
                        security_params=self.security_params,
                        validation=[self.isalnum])
        self._addMethod('DELETE',
                        'user',
                        self.deleteUser,
                        args=['user'],
                        secured=True,
                        security_params=self.security_params,
                        validation=[self.isalnum])
        self._addMethod('DELETE',
                        'group',
                        self.deleteGroup,
                        args=['group', 'user'],
                        secured=True,
                        security_params=self.security_params,
                        validation=[self.isalnum])
        self._addMethod('DELETE',
                        'version',
                        self.deleteVersion,
                        args=['version', 'scramArch'],
                        secured=True,
                        validation=[self.validateVersion])
        self._addMethod('DELETE',
                        'team',
                        self.deleteTeam,
                        args=['team'],
                        secured=True,
                        security_params=self.security_params,
                        validation=[self.isalnum])
        self._addMethod('DELETE',
                        'campaign',
                        self.deleteCampaign,
                        args=['campaign'],
                        secured=True,
                        security_params=self.security_params,
                        validation=[self.isalnum])
        self._addMethod('GET',
                        'requestnames',
                        self.getRequestNames,
                        args=[],
                        secured=True,
                        expires=0)
        self._addMethod('GET',
                        'outputDatasetsByRequestName',
                        self.getOutputForRequest,
                        args=['requestName'],
                        secured=True,
                        validation=[self.isalnum],
                        expires=0)
        self._addMethod('GET',
                        'outputDatasetsByPrepID',
                        self.getOutputForPrepID,
                        args=['prepID'],
                        secured=True,
                        validation=[self.isalnum],
                        expires=0)
        self._addMethod('GET',
                        'mostRecentOutputDatasetsByPrepID',
                        self.getMostRecentOutputForPrepID,
                        args=['prepID'],
                        secured=True,
                        validation=[self.isalnum],
                        expires=0)
        self._addMethod('GET',
                        'configIDs',
                        self.getConfigIDs,
                        args=['prim', 'proc', 'tier'],
                        secured=True,
                        validation=[self.isalnum],
                        expires=0)
        self._addMethod('GET',
                        'requestsByStatusAndTeam',
                        self.getRequestsByStatusAndTeam,
                        args=['teamName', 'status'],
                        secured=True,
                        validation=[self.isalnum],
                        expires=0)

        cherrypy.engine.subscribe('start_thread', self.initThread)
Example #33
0
    def __init__(self, config):
        RESTModel.__init__(self, config)
        self.couchUrl = config.couchUrl
        self.workloadDBName = config.workloadDBName
        self.configDBName = config.configDBName
        self.security_params = {'roles':config.security_roles}
        self._addMethod('GET', 'request', self.getRequest, 
                       args = ['requestName'],
                       secured=True, validation=[self.isalnum], expires = 0)
        self._addMethod('GET', 'assignment', self.getAssignment,
                       args = ['teamName', 'request'],
                       secured=True, validation = [self.isalnum], expires = 0)
        self._addMethod('GET', 'user', self.getUser,
                       args = ['userName'], 
                       secured=True, validation = [self.isalnum], expires = 0)
        self._addMethod('GET', 'group', self.getGroup,
                       args = ['group', 'user'], secured=True, expires = 0)
        self._addMethod('GET', 'version', self.getVersion, args = [], 
                        secured=True, expires = 0)
        self._addMethod('GET', 'team', self.getTeam, args = [], 
                        secured=True, expires = 0)
        self._addMethod('GET', 'workQueue', self.getWorkQueue,
                       args = ['request', 'workQueue'], 
                       secured=True, validation = [self.isalnum], expires = 0)
        self._addMethod('GET', 'message', self.getMessage,
                       args = ['request'], 
                       secured=True, validation = [self.isalnum], expires = 0)
        self._addMethod('GET', 'inputdataset', self.getInputDataset,
                       args = ['prim', 'proc', 'tier'],
                       secured=True)
        self._addMethod('GET', 'outputdataset', self.getOutputDataset,
                       args = ['prim', 'proc', 'tier'],
                       secured=True)
        self._addMethod('GET', 'campaign', self.getCampaign,
                       args = ['campaign'],
                       secured=True, validation = [self.isalnum], expires = 0)
        self._addMethod('PUT', 'request', self.putRequest,
                       args = ['requestName', 'status', 'priority'],
                       secured=True, validation = [self.isalnum, self.intpriority])
        self._addMethod('PUT', 'assignment', self.putAssignment,
                       args = ['team', 'requestName'],
                       secured=True, security_params=self.security_params,
                       validation = [self.isalnum])
        self._addMethod('PUT', 'user', self.putUser,
                       args = ['userName', 'email', 'dnName'],
                       secured=True, security_params=self.security_params,
                       validation = [self.validateUser])
        self._addMethod('PUT', 'group', self.putGroup,
                       args = ['group', 'user'],
                       secured=True, security_params=self.security_params,
                       validation = [self.isalnum])
        self._addMethod('PUT', 'version', self.putVersion,
                       args = ['version'],
                       secured=True, security_params=self.security_params,
                       validation = [self.validateVersion])
        self._addMethod('PUT', 'team', self.putTeam,
                       args = ['team'],
                       secured=True, security_params=self.security_params,
                       validation = [self.isalnum])
        self._addMethod('PUT', 'workQueue', self.putWorkQueue, 
                       args = ['request', 'url'],
                       secured=True, security_params=self.security_params,
                       validation = [self.validatePutWorkQueue])
        self._addMethod('PUT', 'message', self.putMessage,
                       args = ['request'],
                       secured=True, security_params=self.security_params,
                       validation = [self.isalnum])
        self._addMethod('PUT', 'campaign', self.putCampaign,
                       args = ['campaign', 'request'],
                       secured=True, 
                       validation = [self.isalnum])
        self._addMethod('POST', 'request', self.postRequest,
                        args = ['requestName', 'events_written', 
                                'events_merged', 'files_written',
                                'files_merged', 'percent_written', 
                                'percent_success', 'dataset'],
                        secured=True, validation = [self.validateUpdates])
        self._addMethod('POST', 'user', self.postUser,
                        args = ['user', 'priority'],
                        secured=True, security_params=self.security_params,
                        validation = [self.isalnum, self.intpriority])
        self._addMethod('POST',  'group', self.postGroup,
                        args = ['group', 'priority'],
                        secured=True, security_params=self.security_params,
                        validation = [self.isalnum, self.intpriority])
        self._addMethod('DELETE', 'request', self.deleteRequest,
                        args = ['requestName'],
                        secured=True, security_params=self.security_params,
                        validation = [self.isalnum])
        self._addMethod('DELETE', 'user', self.deleteUser,
                        args = ['user'],
                        secured=True, security_params=self.security_params,
                        validation = [self.isalnum])
        self._addMethod('DELETE', 'group', self.deleteGroup,
                        args = ['group', 'user'],
                        secured=True, security_params=self.security_params,
                        validation = [self.isalnum])
        self._addMethod('DELETE', 'version', self.deleteVersion,
                        args = ['version'],
                        secured=True, validation = [self.validateVersion])
        self._addMethod('DELETE', 'team', self.deleteTeam,
                        args = ['team'],
                        secured=True, security_params=self.security_params,
                        validation = [self.isalnum])
        self._addMethod('DELETE', 'campaign', self.deleteCampaign,
                        args = ['campaign'],
                        secured=True, security_params=self.security_params,
                        validation = [self.isalnum])
        self._addMethod('GET', 'requestnames', self.getRequestNames,
                       args = [], secured=True, expires = 0)
        self._addMethod('GET', 'outputDatasetsByRequestName', self.getOutputForRequest,
                       args = ['requestName'], secured=True,
                       validation=[self.isalnum], expires = 0)
        self._addMethod('GET', 'outputDatasetsByPrepID', self.getOutputForPrepID,
                       args = ['prepID'], secured=True, 
                       validation=[self.isalnum], expires = 0)        
        self._addMethod('GET', 'mostRecentOutputDatasetsByPrepID', self.getMostRecentOutputForPrepID,
                       args = ['prepID'], secured=True, 
                       validation=[self.isalnum], expires = 0)

        cherrypy.engine.subscribe('start_thread', self.initThread)
Example #34
0
    def __init__(self, config={}):

        RESTModel.__init__(self, config)



        # External couch call
        self._addMethod("GET", "jobsummary", self.getJobSummary)
        self._addMethod("GET", "jobstatebysite", self.getJobStateBySite)
        # batch system status
        bossAirDAOFactory = DAOFactory(package="WMCore.BossAir",
                                       logger=self,
                                       dbinterface=self.dbi)

        self._addDAO('GET', 'batchjobstatus', "JobStatusForMonitoring",
                     daoFactory=bossAirDAOFactory)

        self._addDAO('GET', 'batchjobstatusbysite',
                     "JobStatusByLocation",
                     daoFactory=bossAirDAOFactory)

        self.daofactory = DAOFactory(package="WMCore.WMBS", logger=self,
                                     dbinterface=self.dbi)

        self._addDAO('GET', 'listsites', "Locations.List")
        self._addDAO('GET', "listsubtypes", "Monitoring.ListSubTypes")
        self._addDAO('GET', "listjobstates", "Monitoring.ListJobStates")
        self._addDAO('GET', "listjobsbysub", "Monitoring.ListJobsBySub",
                     args=["subscriptionId"],
                     validation=[self.subscriptionIDValidate])
        self._addDAO('GET', "subscriptionstatus",
                     "Monitoring.SubscriptionStatus",
                     args=["subscriptionType"],
                     validation=[self.subTypeValidate])
        self._addDAO('GET', "listrunningjobs", "Monitoring.ListRunningJobs")
        self._addMethod('GET', "listjobstatus", self.listJobStatus,
                        args=["jobState", "interval"],
                        validation=[self.jobStatusValidate])

        self._addDAO('GET', "workflowstatus", "Workflow.Status")
        self._addDAO('GET', "workflowsummary", "Monitoring.WorkflowSummary")
        self._addDAO('GET', "tasksummary", "Monitoring.TaskSummaryByWorkflow",
                     args=["workflowName"])

        self._addDAO('GET', "failedjobsbyworkflow", "Monitoring.FailedJobsByWorkflow",
                     args=["workflowName"])

        self._addDAO('GET', "failedjobsbytask", "Monitoring.FailedJobsByTask",
                     args=["taskID"])

        self._addDAO('GET', "test", "Workflow.Test")

        resourceDAOFactory = DAOFactory(package="WMCore.ResourceControl",
                                        logger=self, dbinterface=self.dbi)

        self._addDAO('GET', "listthresholdsforsubmit", "ListThresholdsForSubmit",
                     args=["tableFormat"],
                     validation=[self.setTableFormat],
                     daoFactory=resourceDAOFactory)

        self._addDAO('GET', "listthresholdsforcreate", "ListThresholdsForCreate",
                     args=["tableFormat"],
                     validation=[self.setTableFormat],
                     daoFactory=resourceDAOFactory)

        self._addDAO('GET', "thresholdbysite", "ThresholdBySite",
                     args=["site"],
                     daoFactory=resourceDAOFactory)

        self._addDAO('GET', "listtaskbysite", "ListWorkloadsForTaskSite",
                     args=["taskType", "siteName"],
                     daoFactory=resourceDAOFactory)

        self._addDAO('GET', "listthresholds", "ListThresholds",
                     daoFactory=resourceDAOFactory)

        # self._addDAO('GET', "updatethresholds", "UpdateThresholdsInBulk",
        #             args = ['sitename', 'tasktype', 'maxslots'],
        #             daoFactory = resourceDAOFactory)

        self._addDAO('GET', "updatethreshold", "InsertThreshold",
                     args=['siteName', 'taskType', 'maxSlots'],
                     daoFactory=resourceDAOFactory)

        dbsDAOFactory = DAOFactory(package="WMComponent.DBSBuffer.Database",
                                   logger=self, dbinterface=self.dbi)

        self._addDAO('GET', "dbsbufferstatus", "Status",
                     daoFactory=dbsDAOFactory)

        self._addMethod('GET', 'jobinfobyid', self.jobInfoByID,
                        args=['jobID'])

        return
Example #35
0
    def __init__(self, config):
        RESTModel.__init__(self, config)
        self.couchUrl = config.couchUrl
        self.workloadDBName = config.workloadDBName
        self.configDBName = config.configDBName
        self.wmstatWriteURL = "%s/%s" % (self.couchUrl.rstrip('/'), config.wmstatDBName)
        self.acdcURL = "%s/%s" % (self.couchUrl.rstrip('/'), config.acdcDBName)
        self.security_params = {'roles':config.security_roles}
        
        # Optional values for individual methods
        self.reqPriorityMax = getattr(config, 'maxReqPriority', 100)


        self._addMethod('GET', 'request', self.getRequest,
                       args = ['requestName'],
                       secured=True, validation=[self.isalnum], expires = 0)
        self._addMethod('GET', 'assignment', self.getAssignment,
                       args = ['teamName', 'request'],
                       secured=True, validation = [self.isalnum], expires = 0)
        self._addMethod('GET', 'user', self.getUser,
                       args = ['userName'],
                       secured=True, validation = [self.isalnum], expires = 0)
        self._addMethod('GET', 'group', self.getGroup,
                       args = ['group', 'user'], secured=True, expires = 0)
        self._addMethod('GET', 'version', self.getVersion, args = [],
                        secured=True, expires = 0)
        self._addMethod('GET', 'team', self.getTeam, args = [],
                        secured=True, expires = 0)
        self._addMethod('GET', 'workQueue', self.getWorkQueue,
                       args = ['request', 'workQueue'],
                       secured=True, validation = [self.isalnum], expires = 0)
        self._addMethod('GET', 'message', self.getMessage,
                       args = ['request'],
                       secured=True, validation = [self.isalnum], expires = 0)
        self._addMethod('GET', 'inputdataset', self.getInputDataset,
                       args = ['prim', 'proc', 'tier'],
                       secured=True)
        self._addMethod('GET', 'outputdataset', self.getOutputDataset,
                       args = ['prim', 'proc', 'tier'],
                       secured=True)
        self._addMethod('GET', 'campaign', self.getCampaign,
                       args = ['campaign'],
                       secured=True, validation = [self.isalnum], expires = 0)
        self._addMethod('PUT', 'request', self.putRequest,
                       args = ['requestName', 'status', 'priority', 'stats'],
                       secured=True, validation = [self.isalnumExceptStats, self.reqPriority, self.validateStats])
        self._addMethod('PUT', 'clone', self.cloneRequest,
                       args = ['requestName'],
                       secured=True, validation = [self.isalnum])
        self._addMethod('PUT', 'assignment', self.putAssignment,
                       args = ['team', 'requestName'],
                       secured=True, security_params=self.security_params,
                       validation = [self.isalnum])
        self._addMethod('PUT', 'user', self.putUser,
                       args = ['userName', 'email', 'dnName'],
                       secured=True, security_params=self.security_params,
                       validation = [self.validateUser])
        self._addMethod('PUT', 'group', self.putGroup,
                       args = ['group', 'user'],
                       secured=True, security_params=self.security_params,
                       validation = [self.isalnum])
        self._addMethod('PUT', 'version', self.putVersion,
                       args = ['version', 'scramArch'],
                       secured=True, security_params=self.security_params,
                       validation = [self.validateVersion])
        self._addMethod('PUT', 'team', self.putTeam,
                       args = ['team'],
                       secured=True, security_params=self.security_params,
                       validation = [self.isalnum])
        self._addMethod('PUT', 'workQueue', self.putWorkQueue,
                       args = ['request', 'url'],
                       secured=True, security_params=self.security_params,
                       validation = [self.validatePutWorkQueue])
        self._addMethod('PUT', 'message', self.putMessage,
                       args = ['request'],
                       secured=True, security_params=self.security_params,
                       validation = [self.isalnum])
        self._addMethod('PUT', 'campaign', self.putCampaign,
                       args = ['campaign', 'request'],
                       secured=True,
                       validation = [self.isalnum])
        self._addMethod('POST', 'request', self.postRequest,
                        args = ['requestName', 'events_written',
                                'events_merged', 'files_written',
                                'files_merged', 'percent_written',
                                'percent_success', 'dataset'],
                        secured=True, validation = [self.validateUpdates])
        self._addMethod('POST', 'closeout', self.closeOutRequest,
                        args = ['requestName', 'cascade'], secured=True,
                        validation=[self.isalnum], expires = 0)
        self._addMethod('POST', 'announce', self.announceRequest,
                        args = ['requestName', 'cascade'], secured=True,
                        validation=[self.isalnum], expires = 0)
        self._addMethod('DELETE', 'request', self.deleteRequest,
                        args = ['requestName'],
                        secured=True, security_params=self.security_params,
                        validation = [self.isalnum])
        self._addMethod('DELETE', 'user', self.deleteUser,
                        args = ['user'],
                        secured=True, security_params=self.security_params,
                        validation = [self.isalnum])
        self._addMethod('DELETE', 'group', self.deleteGroup,
                        args = ['group', 'user'],
                        secured=True, security_params=self.security_params,
                        validation = [self.isalnum])
        self._addMethod('DELETE', 'version', self.deleteVersion,
                        args = ['version', 'scramArch'],
                        secured=True, validation = [self.validateVersion])
        self._addMethod('DELETE', 'team', self.deleteTeam,
                        args = ['team'],
                        secured=True, security_params=self.security_params,
                        validation = [self.isalnum])
        self._addMethod('DELETE', 'campaign', self.deleteCampaign,
                        args = ['campaign'],
                        secured=True, security_params=self.security_params,
                        validation = [self.isalnum])
        self._addMethod('GET', 'requestnames', self.getRequestNames,
                       args = [], secured=True, expires = 0)
        self._addMethod('GET', 'outputDatasetsByRequestName', self.getOutputForRequest,
                       args = ['requestName'], secured=True,
                       validation=[self.isalnum], expires = 0)
        self._addMethod('GET', 'outputDatasetsByPrepID', self.getOutputForPrepID,
                       args = ['prepID'], secured=True,
                       validation=[self.isalnum], expires = 0)
        self._addMethod('GET', 'mostRecentOutputDatasetsByPrepID', self.getMostRecentOutputForPrepID,
                       args = ['prepID'], secured=True,
                       validation=[self.isalnum], expires = 0)
        self._addMethod('GET', 'configIDs', self.getConfigIDs,
                        args = ['prim', 'proc', 'tier'],
                        secured=True, validation=[self.isalnum], expires = 0)
        self._addMethod('GET', 'requestsByStatusAndTeam', self.getRequestsByStatusAndTeam,
                        args = ['teamName', 'status'], secured=True,
                        validation=[self.isalnum], expires = 0)

        cherrypy.engine.subscribe('start_thread', self.initThread)
Example #36
0
 def __init__(self, config):
     '''
     Initialise the RESTModel and add some methods to it.
     '''
     RESTModel.__init__(self, config)
     
     del self.methods['POST']
     
     validator = Validator({'dbi':self.dbi})
     
     self.dashboard = Dashboard(dict = {
               'endpoint': self.config.services.dashboard,
               'cachepath': self.config.services.cachepath,
               'logger': self})
     self.samtests = SAM(dict = {
               'endpoint': self.config.services.sam,
               'cachepath': self.config.services.cachepath,
               'cert': config.services.hostcert,
               'key': config.services.hostkey,
               'logger': self})
     
     self.methods['GET'] = {'list':{'args':['name', 'scheme'],
                                     'call': self.list,
                                     'version': 2,
                                     'validation': [validator.validate_scheme, 
                                                    validator.validate_name]},
                           'status':{'args': ['name'],
                                     'call': self.status,
                                     'version': 2,
                                     'validation': [validator.validate_scheme, 
                                                    validator.validate_name]},
                           'software':{'args': ['name'],
                                     'call': self.software,
                                     'version': 2,
                                     'validation': [validator.validate_scheme, 
                                                    validator.validate_name]},
                           'resource_element':{'args':['name', 'type'],
                                     'call': self.resource_element,
                                     'version': 2,
                                     'validation': [validator.validate_scheme,
                                                    validator.validate_name,
                                                    validator.validate_resource_type]},
                           'resource_pledge':{'args':['name', 'quarter'],
                                     'call': self.resource_pledge,
                                     'version': 2,
                                     'validation': [validator.validate_scheme,
                                                    validator.validate_name,
                                                    validator.validate_quarter]},
                           'pledge_history':{'args':['name'],
                                     'call': self.pledge_history,
                                     'version': 1},
                           'contacts':{'args':['name', 'role'],
                                     'call': self.contacts,
                                     'version': 2,
                                     'validation': [validator.validate_scheme,
                                                    validator.validate_name,
                                                    validator.validate_role]},
                           'groups':{'args': ['name'],
                                     'call': self.groups,
                                     'version': 1},
                           'links':{'args': ['name'],
                                     'call': self.links,
                                     'version': 1,
                                     'validation': [validator.validate_scheme,
                                                    validator.validate_name]},
                           'associations':{'args': ['parent', 'child', 'scheme'],
                                     'call': self.associations,
                                     'version': 1,
                                     'validation': [validator.validate_scheme,
                                                    validator.validate_associations]},
                           'names':{'args':['name', 'scheme', 'limit'],
                                     'call': self.names,
                                     'version': 1,
                                     'validation': [validator.validate_scheme,
                                                    validator.validate_limit_scheme, 
                                                    validator.validate_name]}}