How to use the mindsdb.config function in MindsDB

To help you get started, we’ve selected a few MindsDB examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github mindsdb / mindsdb / mindsdb / proxies / web / web_proxy.py View on Github external
def startProxy(self):

        logging_real.info('Starting MindsDB webserver ... ')
        app = self.startWebServer()
        print('aaaaaa')
        logging_real.info('Starting MindsDB Logging websocket server on {config}'.format(config=config.LOGGING_WEBSOCKET_URL))
        port = int(config.LOGGING_WEBSOCKET_URL.split(':')[-1])
        sio = self.startWebSocketServer()

        app = socketio.Middleware(sio, app)

        # deploy as an eventlet WSGI server
        #app.run()
        eventlet.wsgi.server(eventlet.listen(('', port)), app)
github mindsdb / mindsdb / mindsdb / proxies / web / web_proxy.py View on Github external
def root():
            print('aaaaa')
            r = open('static/index.html')
            vars_to_expose = ['WEBSOCKET_URL', 'LOGGING_WEBSOCKET_URL']
            text = r.read()
            config_vars = json.dumps({var_name: value for var_name, value in vars(config).items() if var_name in vars_to_expose})
            text = text.format(ts_var=time.time(), config_vars=config_vars)

            return text
github mindsdb / mindsdb / mindsdb / libs / data_types / persistent_object_mongo.py View on Github external
def __init__(self):

        self._mongo = MongoClient(CONFIG.MONGO_SERVER_HOST)
        self._collection =  self._mongo.mindsdb[self._entity_name]
        self.setup()
github mindsdb / mindsdb / mindsdb / libs / data_types / persistent_object_tinydb.py View on Github external
def __init__(self):

        self._mongo = TinyMongoClient(CONFIG.LOCALSTORE_PATH)
        try:
            self._collection =  self._mongo.mindsdb[self._entity_name]
        except:
            logging.error('No collection will be found, db corrupted, truncating it')
            shutil.rmtree(CONFIG.LOCALSTORE_PATH)
            raise ValueError('MindsDB local document store corruped. No other way to put this, trained model data will be lost')

        self.setup()
github mindsdb / mindsdb / mindsdb / libs / data_types / persistent_object_tinydb.py View on Github external
def __init__(self):

        self._mongo = TinyMongoClient(CONFIG.LOCALSTORE_PATH)
        try:
            self._collection =  self._mongo.mindsdb[self._entity_name]
        except:
            logging.error('No collection will be found, db corrupted, truncating it')
            shutil.rmtree(CONFIG.LOCALSTORE_PATH)
            raise ValueError('MindsDB local document store corruped. No other way to put this, trained model data will be lost')

        self.setup()
github mindsdb / mindsdb / mindsdb / libs / ml_models / pytorch / libs / torch_helpers.py View on Github external
def storeTorchObject(object, id = None):

    if id is None:
        # generate a random uuid
        id = str(uuid.uuid1())

    # create if it does not exist
    if not os.path.exists(CONFIG.MINDSDB_STORAGE_PATH):
        os.makedirs(CONFIG.MINDSDB_STORAGE_PATH)
    # tmp files
    tmp_file = CONFIG.MINDSDB_STORAGE_PATH + '/{id}.pt'.format(id=id)

    if not os.path.exists(CONFIG.MINDSDB_STORAGE_PATH):
        os.makedirs(CONFIG.MINDSDB_STORAGE_PATH)

    torch.save(object, tmp_file)

    return id, tmp_file
github mindsdb / mindsdb / mindsdb / libs / ml_models / pytorch / libs / torch_helpers.py View on Github external
def arrayToFloatVariable(arr):
    if CONFIG.USE_CUDA:
        ret = Variable(torch.FloatTensor(arr))
        ret = ret.cuda()
        return ret
    else:
        return Variable(torch.FloatTensor(arr))