Exemplo n.º 1
0
    def run(self):
        'Run the web server'
        from SimpleSeer.Web import WebServer, make_app
        from SimpleSeer import models as M
        from pymongo import Connection, DESCENDING, ASCENDING
        from SimpleSeer.models.Inspection import Inspection, Measurement
        import mongoengine

        # Plugins must be registered for queries
        Inspection.register_plugins('seer.plugins.inspection')
        Measurement.register_plugins('seer.plugins.measurement')

        db = mongoengine.connection.get_db() 
        # Ensure indexes created for filterable fields
        # TODO: should make this based on actual plugin params or filter data
        try:
            db.frame.ensure_index([('results', 1)])
            db.frame.ensure_index([('results.measurement_name', 1)])
            db.frame.ensure_index([('results.numeric', 1)])
            db.frame.ensure_index([('results.string', 1)])
        except:
            self.log.info('Could not create indexes')
        web = WebServer(make_app(test = self.options.test))
        
        from SimpleSeer.Backup import Backup
        Backup.importAll(None, False, True, True)
        
        try:
            web.run_gevent_server()
        except KeyboardInterrupt as e:
            print "Interrupted by user"
Exemplo n.º 2
0
def WebCommand(self):
    'Run the web server'
    from SimpleSeer.Web import WebServer, make_app
    from SimpleSeer import models as M
    from pymongo import Connection, DESCENDING, ASCENDING
    from SimpleSeer.models.Inspection import Inspection, Measurement

    # Plugins must be registered for queries
    Inspection.register_plugins('seer.plugins.inspection')
    Measurement.register_plugins('seer.plugins.measurement')

    dbName = self.session.database
    if not dbName:
        dbName = 'default'
    db = Connection()[dbName]
    # Ensure indexes created for filterable fields
    # TODO: should make this based on actual plugin params or filter data
    try:
        db.frame.ensure_index([('results', 1)])
        db.frame.ensure_index([('results.measurement_name', 1)])
        db.frame.ensure_index([('results.numeric', 1)])
        db.frame.ensure_index([('results.string', 1)])
    except:
        self.log.info('Could not create indexes')
        
    web = WebServer(make_app())
    web.run_gevent_server()
Exemplo n.º 3
0
def WebCommand(self):
    'Run the web server'
    from SimpleSeer.Web import WebServer, make_app
    from SimpleSeer import models as M
    from pymongo import Connection, DESCENDING, ASCENDING

    # Ensure indexes created for filterable fields
    db = Connection().default
    for f in self.session.ui_filters:
        db.frame.ensure_index([(f['filter_name'], ASCENDING), (f['filter_name'], DESCENDING)])
    
    
    web = WebServer(make_app())
    web.run_gevent_server()