示例#1
0
文件: Data.py 项目: nikmagini/sitedb
 def __init__(self, app, config, mount):
   """
   :arg app: reference to application object; passed to all entities.
   :arg config: reference to configuration; passed to all entities.
   :arg str mount: API URL mount point; passed to all entities."""
   DatabaseRESTApi.__init__(self, app, config, mount)
   self._add({ "whoami":                 WhoAmI(app, self, config, mount),
               "ldapsync":               LdapSync(app, self, config, mount),
               "rebusfetch":             RebusFetch(app, self, config, mount),
               "roles":                  Roles(app, self, config, mount),
               "groups":                 Groups(app, self, config, mount),
               "people":                 People(app, self, config, mount),
               "sites":                  Sites(app, self, config, mount),
               "site-names":             SiteNames(app, self, config, mount),
               "site-resources":         SiteResources(app, self, config, mount),
               "site-associations":      SiteAssociations(app, self, config, mount),
               "resource-pledges":       Pledges(app, self, config, mount),
               "pinned-software":        Software(app, self, config, mount),
               "site-responsibilities":  UserSites(app, self, config, mount),
               "group-responsibilities": UserGroups(app, self, config, mount),
               "data-responsibilities":  UserPNNs(app, self, config, mount),
               "data-processing":        Processing(app, self, config, mount),
               "federations":            Federations(app, self, config, mount),
               "federations-sites":      FederationsSites(app, self, config, mount),
               "federations-pledges":    FederationsPledges(app, self, config, mount),
               "esp-credit":             ESPCredit(app, self, config, mount)})
示例#2
0
    def __init__(self, app, config, mount):
        DatabaseRESTApi.__init__(self, app, config, mount)

        self.formats = [ ('application/json', JSONFormat()) ]

        status, serverdn = getstatusoutput('openssl x509 -noout -subject -in %s | cut -f2- -d\ ' % config.serverhostcert)
        if status is not 0:
            raise ExecutionError("Internal issue when retrieving crabserver service DN.")

        extconfig = Utils.ConfigCache(centralconfig=Utils.getCentralConfig(extconfigurl=config.extconfigurl, mode=config.mode),
                                      cachetime=mktime(gmtime()))

        #Global initialization of Data objects. Parameters coming from the config should go here
        DataUserWorkflow.globalinit(config)
        DataWorkflow.globalinit(dbapi=self, phedexargs={'endpoint': config.phedexurl},\
                                credpath=config.credpath, centralcfg=extconfig, config=config)
        DataFileMetadata.globalinit(dbapi=self, config=config)
        RESTTask.globalinit(centralcfg=extconfig)
        Utils.globalinit(config.serverhostkey, config.serverhostcert, serverdn, config.credpath)

        ## TODO need a check to verify the format depending on the resource
        ##      the RESTFileMetadata has the specifc requirement of getting xml reports
        self._add( {'workflow': RESTUserWorkflow(app, self, config, mount, extconfig),
                    'campaign': RESTCampaign(app, self, config, mount),
                    'info': RESTServerInfo(app, self, config, mount, serverdn, extconfig),
                    'filemetadata': RESTFileMetadata(app, self, config, mount),
                    'workflowdb': RESTWorkerWorkflow(app, self, config, mount),
                    'task': RESTTask(app, self, config, mount),
                   } )

        self._initLogger( getattr(config, 'loggingFile', None), getattr(config, 'loggingLevel', None) )
示例#3
0
    def __init__(self, app, config, mount):
        DatabaseRESTApi.__init__(self, app, config, mount)

        self.formats = [ ('application/json', JSONFormat()) ]

        status, serverdn = getstatusoutput('openssl x509 -noout -subject -in %s | cut -f2- -d\ ' % config.serverhostcert)
        if status is not 0:
            raise ExecutionError("Internal issue when retrieving crabserver service DN.")

        extconfig = Utils.ConfigCache(centralconfig=Utils.getCentralConfig(extconfigurl=config.extconfigurl, mode=config.mode),
                                      cachetime=mktime(gmtime()))

        #Global initialization of Data objects. Parameters coming from the config should go here
        DataUserWorkflow.globalinit(config)
        DataWorkflow.globalinit(dbapi=self, phedexargs={'endpoint': config.phedexurl},\
                                credpath=config.credpath, centralcfg=extconfig, config=config)
        DataFileMetadata.globalinit(dbapi=self, config=config)
        RESTTask.globalinit(centralcfg=extconfig)
        Utils.globalinit(config.serverhostkey, config.serverhostcert, serverdn, config.credpath)

        ## TODO need a check to verify the format depending on the resource
        ##      the RESTFileMetadata has the specifc requirement of getting xml reports
        self._add( {'workflow': RESTUserWorkflow(app, self, config, mount, extconfig),
                    'info': RESTServerInfo(app, self, config, mount, serverdn, extconfig),
                    'filemetadata': RESTFileMetadata(app, self, config, mount),
                    'workflowdb': RESTWorkerWorkflow(app, self, config, mount),
                    'task': RESTTask(app, self, config, mount),
                    'filetransfers': RESTFileTransfers(app, self, config, mount),
                    'fileusertransfers': RESTFileUserTransfers(app, self, config, mount),
                   })

        self._initLogger( getattr(config, 'loggingFile', None), getattr(config, 'loggingLevel', None) )
示例#4
0
文件: Data.py 项目: nikmagini/sitedb
 def __init__(self, app, config, mount):
     """
 :arg app: reference to application object; passed to all entities.
 :arg config: reference to configuration; passed to all entities.
 :arg str mount: API URL mount point; passed to all entities."""
     DatabaseRESTApi.__init__(self, app, config, mount)
     self._add(
         {
             "whoami": WhoAmI(app, self, config, mount),
             "ldapsync": LdapSync(app, self, config, mount),
             "rebusfetch": RebusFetch(app, self, config, mount),
             "roles": Roles(app, self, config, mount),
             "groups": Groups(app, self, config, mount),
             "people": People(app, self, config, mount),
             "sites": Sites(app, self, config, mount),
             "site-names": SiteNames(app, self, config, mount),
             "site-resources": SiteResources(app, self, config, mount),
             "site-associations": SiteAssociations(app, self, config, mount),
             "resource-pledges": Pledges(app, self, config, mount),
             "pinned-software": Software(app, self, config, mount),
             "site-responsibilities": UserSites(app, self, config, mount),
             "group-responsibilities": UserGroups(app, self, config, mount),
             "data-responsibilities": UserPNNs(app, self, config, mount),
             "data-processing": Processing(app, self, config, mount),
             "federations": Federations(app, self, config, mount),
             "federations-sites": FederationsSites(app, self, config, mount),
             "federations-pledges": FederationsPledges(app, self, config, mount),
             "esp-credit": ESPCredit(app, self, config, mount),
         }
     )
示例#5
0
 def __init__(self, app, config, mount):
   """
   :arg app: reference to application object; passed to all entities.
   :arg config: reference to configuration; passed to all entities.
   :arg str mount: API URL mount point; passed to all entities."""
   DatabaseRESTApi.__init__(self, app, config, mount)
   self._add({ "hello": Hello(app, self, config, mount) })
示例#6
0
    def __init__(self, app, config, mount):
        DatabaseRESTApi.__init__(self, app, config, mount)

        self.formats = [('application/json', JSONFormat())]

        status, serverdn = getstatusoutput(
            'openssl x509 -noout -subject -in %s | cut -f2- -d\ ' %
            config.serverhostcert)
        if status is not 0:
            raise ExecutionError(
                "Internal issue when retrieving crabserver service DN.")

        hbuf = StringIO.StringIO()
        bbuf = StringIO.StringIO()

        curl = pycurl.Curl()
        curl.setopt(pycurl.URL, config.extconfigurl)
        curl.setopt(pycurl.WRITEFUNCTION, bbuf.write)
        curl.setopt(pycurl.HEADERFUNCTION, hbuf.write)
        curl.setopt(pycurl.FOLLOWLOCATION, 1)
        curl.perform()
        curl.close()

        header = ResponseHeader(hbuf.getvalue())
        if header.status < 200 or header.status >= 300:
            cherrypy.log("Problem %d reading from %s." %
                         (config.extconfigurl, header.status))
            raise ExecutionError(
                "Internal issue when retrieving external confifuration")
        extconfig = json.decode(bbuf.getvalue())

        #Global initialization of Data objects. Parameters coming from the config should go here
        DataUserWorkflow.globalinit(config.workflowManager)
        DataWorkflow.globalinit(dbapi=self, phedexargs={'endpoint': config.phedexurl}, dbsurl=config.dbsurl,\
                                        credpath=config.credpath, transformation=config.transformation)
        DataFileMetadata.globalinit(dbapi=self)
        Utils.globalinit(config.serverhostkey, config.serverhostcert, serverdn,
                         config.credpath)

        ## TODO need a check to verify the format depending on the resource
        ##      the RESTFileMetadata has the specifc requirement of getting xml reports
        self._add({
            'workflow':
            RESTUserWorkflow(app, self, config, mount),
            'campaign':
            RESTCampaign(app, self, config, mount),
            'info':
            RESTServerInfo(app, self, config, mount, serverdn,
                           extconfig.get('delegate-dn', [])),
            'filemetadata':
            RESTFileMetadata(app, self, config, mount),
        })

        self._initLogger(getattr(config, 'loggingFile', None),
                         getattr(config, 'loggingLevel', None))
示例#7
0
 def __init__(self, app, config, mount):
     """
 :arg app: reference to application object; passed to all entities.
 :arg config: reference to configuration; passed to all entities.
 :arg str mount: API URL mount point; passed to all entities."""
     DatabaseRESTApi.__init__(self, app, config, mount)
     self._add({
         "link-events": LinkEvents(app, self, config, mount),
         "link-stats": LinkStats(app, self, config, mount),
         "dest-stats": DestStats(app, self, config, mount),
         "block-latency": BlockLatency(app, self, config, mount)
     })
示例#8
0
 def __init__(self, app, config, mount):
     """
 :arg app: reference to application object; passed to all entities.
 :arg config: reference to configuration; passed to all entities.
 :arg str mount: API URL mount point; passed to all entities."""
     DatabaseRESTApi.__init__(self, app, config, mount)
     self._add(
         {
             "link-events": LinkEvents(app, self, config, mount),
             "link-stats": LinkStats(app, self, config, mount),
             "dest-stats": DestStats(app, self, config, mount),
             "block-latency": BlockLatency(app, self, config, mount),
         }
     )
示例#9
0
  def __init__(self, app, config, mount):
    """
    :arg app: reference to application object; passed to all entities.
    :arg config: reference to configuration; passed to all entities.
    :arg str mount: API URL mount point; passed to all entities."""

    DatabaseRESTApi.__init__(self, app, config, mount)
    # Makes raw format as default
    self.formats.insert(0, ('application/raw', RawFormat()))
    self._add({ "hello": Hello(app, self, config, mount),
                "runid": RunId(app, self, config, mount),
                "run":   Run(app, self, config, mount),
                "express_config": ExpressConfig(app, self, config, mount),
                "firstconditionsaferun": FirstConditionSafeRun(app, self, config, mount)
                })
示例#10
0
文件: Data.py 项目: dmwm/t0wmadatasvc
  def __init__(self, app, config, mount):
    """
    :arg app: reference to application object; passed to all entities.
    :arg config: reference to configuration; passed to all entities.
    :arg str mount: API URL mount point; passed to all entities."""

    DatabaseRESTApi.__init__(self, app, config, mount)
    # Makes raw format as default
    self.formats.insert(0, ('application/raw', RawFormat()))
    self._add({ "hello": Hello(app, self, config, mount),
                "express_config": ExpressConfig(app, self, config, mount),
                "reco_config": RecoConfig(app, self, config, mount),
                "run_config": RunConfig(app, self, config, mount),
                "firstconditionsaferun": FirstConditionSafeRun(app, self, config, mount),
                "run_stream_done": RunStreamDone(app, self, config, mount),
                "run_dataset_done": RunDatasetDone(app,self, config, mount),
                "dataset_locked": DatasetLocked(app, self, config, mount),
                "promptreco_status": PromptRecoStatus(app, self, config, mount)
                })
示例#11
0
    def __init__(self, app, config, mount):
        DatabaseRESTApi.__init__(self, app, config, mount)

        self.formats = [ ('application/json', JSONFormat()) ]

        status, serverdn = getstatusoutput('openssl x509 -noout -subject -in %s | cut -f2- -d\ ' % config.serverhostcert)
        if status is not 0:
            raise ExecutionError("Internal issue when retrieving crabserver service DN.")

        hbuf = StringIO.StringIO()
        bbuf = StringIO.StringIO()

        curl = pycurl.Curl()
        curl.setopt(pycurl.URL, config.extconfigurl)
        curl.setopt(pycurl.WRITEFUNCTION, bbuf.write)
        curl.setopt(pycurl.HEADERFUNCTION, hbuf.write)
        curl.setopt(pycurl.FOLLOWLOCATION, 1)
        curl.perform()
        curl.close()

        header = ResponseHeader(hbuf.getvalue())
        if header.status < 200 or header.status >= 300:
            cherrypy.log("Problem %d reading from %s." %(config.extconfigurl, header.status))
            raise ExecutionError("Internal issue when retrieving external confifuration")
        extconfig = json.decode(bbuf.getvalue())

        #Global initialization of Data objects. Parameters coming from the config should go here
        DataUserWorkflow.globalinit(config.workflowManager)
        DataWorkflow.globalinit(dbapi=self, phedexargs={'endpoint': config.phedexurl}, dbsurl=config.dbsurl,\
                                        credpath=config.credpath, transformation=config.transformation)
        DataFileMetadata.globalinit(dbapi=self)
        Utils.globalinit(config.serverhostkey, config.serverhostcert, serverdn, config.credpath)

        ## TODO need a check to verify the format depending on the resource
        ##      the RESTFileMetadata has the specifc requirement of getting xml reports
        self._add( {'workflow': RESTUserWorkflow(app, self, config, mount),
                    'campaign': RESTCampaign(app, self, config, mount),
                    'info': RESTServerInfo(app, self, config, mount, serverdn, extconfig.get('delegate-dn', [])),
                    'filemetadata': RESTFileMetadata(app, self, config, mount),
                   } )

        self._initLogger( getattr(config, 'loggingFile', None), getattr(config, 'loggingLevel', None) )
示例#12
0
文件: Data.py 项目: lat/sitedb
 def __init__(self, app, config, mount):
   """
   :arg app: reference to application object; passed to all entities.
   :arg config: reference to configuration; passed to all entities.
   :arg str mount: API URL mount point; passed to all entities."""
   DatabaseRESTApi.__init__(self, app, config, mount)
   self._add({ "whoami":                 WhoAmI(app, self, config, mount),
               "hnsync":                 HNSync(app, self, config, mount),
               "mycert":                 Certificate(app, self, config, mount),
               "roles":                  Roles(app, self, config, mount),
               "groups":                 Groups(app, self, config, mount),
               "people":                 People(app, self, config, mount),
               "sites":                  Sites(app, self, config, mount),
               "site-names":             SiteNames(app, self, config, mount),
               "site-resources":         SiteResources(app, self, config, mount),
               "site-associations":      SiteAssociations(app, self, config, mount),
               "resource-pledges":       Pledges(app, self, config, mount),
               "pinned-software":        Software(app, self, config, mount),
               "site-responsibilities":  UserSites(app, self, config, mount),
               "group-responsibilities": UserGroups(app, self, config, mount) })
示例#13
0
    def __init__(self, app, config, mount):
        """
    :arg app: reference to application object; passed to all entities.
    :arg config: reference to configuration; passed to all entities.
    :arg str mount: API URL mount point; passed to all entities."""

        DatabaseRESTApi.__init__(self, app, config, mount)
        # Makes raw format as default
        self.formats.insert(0, ('application/raw', RawFormat()))
        self._add({
            "hello":
            Hello(app, self, config, mount),
            "runid":
            RunId(app, self, config, mount),
            "run":
            Run(app, self, config, mount),
            "express_config":
            ExpressConfig(app, self, config, mount),
            "firstconditionsaferun":
            FirstConditionSafeRun(app, self, config, mount)
        })