Ejemplo n.º 1
0
    def on_start(self):
        #these values should come in from a config file, maybe pyon.yml
        self.pydap_host = self.CFG.get_safe('server.pydap.host', 'localhost')
        self.pydap_port = self.CFG.get_safe('server.pydap.port', '8001')
        self.pydap_url  = 'http://%s:%s/' % (self.pydap_host, self.pydap_port)
        self.pydap_data_path = self.CFG.get_safe('server.pydap.data_path', 'RESOURCE:ext/pydap')
        self.datasets_xml_path = self.CFG.get_safe('server.pydap.datasets_xml_path', "RESOURCE:ext/datasets.xml")
        self.pydap_data_path = FileSystem.get_extended_url(self.pydap_data_path) + '/'

        filename = self.datasets_xml_path.split('/')[-1]
        base = '/'.join(self.datasets_xml_path.split('/')[:-1])
        real_path = FileSystem.get_extended_url(base)
        self.datasets_xml_path = os.path.join(real_path, filename)
        self.setup_filesystem(real_path)
Ejemplo n.º 2
0
    def get_datasets_xml_path(cls, cfg):
        datasets_xml_path = cfg.get_safe('server.pydap.datasets_xml_path', 'RESOURCE:ext/datasets.xml')
        base, filename = os.path.split(datasets_xml_path)
        base = FileSystem.get_extended_url(base)
        path = os.path.join(base, filename)

        return path
 def _get_cov(self, name, nt):
     path = CFG.get_safe('server.pydap.data_path', "RESOURCE:ext/pydap")
     ext_path = FileSystem.get_extended_url(path)
     cov,filename = _make_coverage(ext_path, "the_cov")
     cov.insert_timesteps(nt) 
     cov.set_parameter_values("time", value=nt)
     return cov, filename
Ejemplo n.º 4
0
    def refresh_datasets_xml(self):
        datasets_xml_path = self.CFG.get_safe('server.pydap.datasets_xml_path', "RESOURCE:ext/datasets.xml")
        filename = datasets_xml_path.split('/')[-1]
        base = '/'.join(datasets_xml_path.split('/')[:-1])
        real_path = FileSystem.get_extended_url(base)
        datasets_xml_path = os.path.join(real_path, filename)

        os.remove(datasets_xml_path)
    def get_datasets_xml_path(cls, cfg):
        datasets_xml_path = cfg.get_safe('server.pydap.datasets_xml_path',
                                         'RESOURCE:ext/datasets.xml')
        base, filename = os.path.split(datasets_xml_path)
        base = FileSystem.get_extended_url(base)
        path = os.path.join(base, filename)

        return path
Ejemplo n.º 6
0
    def on_start(self):
        #these values should come in from a config file, maybe pyon.yml
        self.pydap_host = self.CFG.get_safe('server.pydap.host', 'localhost')
        self.pydap_port = self.CFG.get_safe('server.pydap.port', '8001')
        self.pydap_url = 'http://%s:%s/' % (self.pydap_host, self.pydap_port)
        self.pydap_data_path = self.CFG.get_safe('server.pydap.data_path',
                                                 'RESOURCE:ext/pydap')
        self.datasets_xml_path = self.CFG.get_safe(
            'server.pydap.datasets_xml_path', "RESOURCE:ext/datasets.xml")
        self.pydap_data_path = FileSystem.get_extended_url(
            self.pydap_data_path) + '/'

        filename = self.datasets_xml_path.split('/')[-1]
        base = '/'.join(self.datasets_xml_path.split('/')[:-1])
        real_path = FileSystem.get_extended_url(base)
        self.datasets_xml_path = os.path.join(real_path, filename)
        self.setup_filesystem(real_path)
Ejemplo n.º 7
0
    def refresh_datasets_xml(self):
        datasets_xml_path = self.CFG.get_safe('server.pydap.datasets_xml_path', "RESOURCE:ext/datasets.xml")
        filename = datasets_xml_path.split('/')[-1]
        base = '/'.join(datasets_xml_path.split('/')[:-1])
        real_path = FileSystem.get_extended_url(base)
        datasets_xml_path = os.path.join(real_path, filename)

        try:
            os.remove(datasets_xml_path)
        except OSError:
            pass # File doesn't exist
Ejemplo n.º 8
0
    def on_start(self):
        #these values should come in from a config file, maybe pyon.yml
        self.pydap_host = self.CFG.get_safe('server.pydap.host', 'localhost')
        self.pydap_port = self.CFG.get_safe('server.pydap.port', '8001')
        self.pydap_url  = 'http://%s:%s/' % (self.pydap_host, self.pydap_port)
        self.pydap_data_path = self.CFG.get_safe('server.pydap.data_path', 'RESOURCE:ext/pydap')
        self.datasets_xml_path = self.get_datasets_xml_path(self.CFG)
        self.pydap_data_path = FileSystem.get_extended_url(self.pydap_data_path) + '/'
        self.setup_filesystem(self.datasets_xml_path)

        self.ux_url = self.CFG.get_safe('system.web_ui_url','http://localhost:3000/')
Ejemplo n.º 9
0
 def on_start(self):
     #these values should come in from a config file, maybe pyon.yml
     self.pydap_host = self.CFG.get_safe('server.pydap.host', 'localhost')
     self.pydap_port = self.CFG.get_safe('server.pydap.port', '8001')
     self.pydap_url  = 'http://%s:%s/' % (self.pydap_host, self.pydap_port)
     self.pydap_data_path = self.CFG.get_safe('server.pydap.data_path', 'RESOURCE:ext/pydap')
     self.datasets_xml_path = self.get_datasets_xml_path(self.CFG)
     self.pydap_data_path = FileSystem.get_extended_url(self.pydap_data_path) + '/'
     self.ux_url = self.CFG.get_safe('system.web_ui_url','http://localhost:3000/')
     self.jenv = Environment(loader=FileSystemLoader('res/templates'), trim_blocks=True, lstrip_blocks=True)
     self.resource_registry = self.container.resource_registry
     self.setup_filesystem(self.datasets_xml_path)
Ejemplo n.º 10
0
 def setUp(self):
     self._start_container()
     self.container.start_rel_from_url('res/deploy/r2deploy.yml')
     path = CFG.get_safe('server.pydap.data_path', "RESOURCE:ext/pydap")
     ext_path = FileSystem.get_extended_url(path)
     self.cov,self.filename = _make_coverage(ext_path)
     self.nt = 5
     self.cov.insert_timesteps(self.nt) 
     self.time_data = [i+1 for i in range(self.nt)]
     self.cov.set_parameter_values("time", value=self.time_data)
     host = CFG.get_safe('container.pydap_gateway.web_server.host', 'localhost')
     port = CFG.get_safe('container.pydap_gateway.web_server.port', '8001')
     self.request_url = "http://"+host+":"+str(port)+os.sep+os.path.basename(self.filename)
Ejemplo n.º 11
0
    def on_start(self):
        super(LightweightPyDAP,self).on_start()
        self.pydap_host = self.CFG.get_safe('server.pydap.host', 'localhost')
        self.pydap_port = self.CFG.get_safe('server.pydap.port', '8001')

        self.pydap_data_path = self.CFG.get_safe('server.pydap.data_path', 'RESOURCE:ext/pydap')

        self.pydap_data_path = FileSystem.get_extended_url(self.pydap_data_path)

        self.app = make_app(None, self.pydap_data_path, 'ion/core/static/templates/')
        self.log = getLogger('pydap')
        self.log.write = self.log.info
        self.server = WSGIServer((self.pydap_host, int(self.pydap_port)), self.app, log=self.log)
        self.server.start()
 def on_start(self):
     #these values should come in from a config file, maybe pyon.yml
     self.pydap_host = self.CFG.get_safe('server.pydap.host', 'localhost')
     self.pydap_port = self.CFG.get_safe('server.pydap.port', '8001')
     self.pydap_url = 'http://%s:%s/' % (self.pydap_host, self.pydap_port)
     self.pydap_data_path = self.CFG.get_safe('server.pydap.data_path',
                                              'RESOURCE:ext/pydap')
     self.datasets_xml_path = self.get_datasets_xml_path(self.CFG)
     self.pydap_data_path = FileSystem.get_extended_url(
         self.pydap_data_path) + '/'
     self.ux_url = self.CFG.get_safe('system.web_ui_url',
                                     'http://localhost:3000/')
     self.jenv = Environment(loader=FileSystemLoader('res/templates'),
                             trim_blocks=True,
                             lstrip_blocks=True)
     self.resource_registry = self.container.resource_registry
     self.setup_filesystem(self.datasets_xml_path)
Ejemplo n.º 13
0
    def on_start(self):
        try:
            SimpleProcess.on_start(self)
            self.pydap_host = self.CFG.get_safe('container.pydap_gateway.web_server.host', 'localhost')
            self.pydap_port = self.CFG.get_safe('container.pydap_gateway.web_server.port', '8001')

            self.pydap_data_path = self.CFG.get_safe('server.pydap.data_path', 'RESOURCE:ext/pydap')

            self.pydap_data_path = FileSystem.get_extended_url(self.pydap_data_path)
            self.app = make_app(None, self.pydap_data_path, 'ion/core/static/templates/')
            self.log = getLogger('pydap')
            self.log.write = self.log.info
            self.server = WSGIServer((self.pydap_host, int(self.pydap_port)), self.app, log=self.log)
            self.server.start()
        except: 
            log.exception('Unable to start PyDAP server')
            raise
Ejemplo n.º 14
0
    def on_start(self):
        try:
            SimpleProcess.on_start(self)
            self.pydap_host = self.CFG.get_safe(
                'container.pydap_gateway.web_server.host', 'localhost')
            self.pydap_port = self.CFG.get_safe(
                'container.pydap_gateway.web_server.port', '8001')

            self.pydap_data_path = self.CFG.get_safe('server.pydap.data_path',
                                                     'RESOURCE:ext/pydap')

            self.pydap_data_path = FileSystem.get_extended_url(
                self.pydap_data_path)
            self.app = make_app(None, self.pydap_data_path,
                                'ion/core/static/templates/')
            self.log = getLogger('pydap')
            self.log.write = self.log.info
            self.server = WSGIServer((self.pydap_host, int(self.pydap_port)),
                                     self.app,
                                     log=self.log)
            self.server.start()
        except:
            log.exception('Unable to start PyDAP server')
            raise