Start EVA Server#
Run on Google Colab | View source on GitHub | Download notebook |
Launch EVA server#
We use this notebook for launching the EVA server.
## Install EVA package if needed
#%pip install "evadb[udf]" --quiet
import os
import time
def shell(command):
print(command)
os.system(command)
def stop_eva_server():
# Kill any process listening on EVA's standard port
shell('[ -z "$(lsof -ti:5432)" ] || kill -9 "$(lsof -ti:5432)"')
def launch_eva_server():
# Stop EVA server if it is running
stop_eva_server()
os.environ['GPU_DEVICES'] = '0'
# Start EVA server
shell("nohup eva_server > eva.log 2>&1 &")
try:
with open('eva.log', 'r') as f:
print(f.read())
except FileNotFoundError:
pass
# Wait for server to start
time.sleep(10)
def connect_to_server():
from eva.server.db_api import connect
%pip install nest_asyncio --quiet
import nest_asyncio
nest_asyncio.apply()
# Connect client with server
connection = connect(host = '127.0.0.1', port = 5432)
cursor = connection.cursor()
return cursor
# Launch server
launch_eva_server()
[ -z "$(lsof -ti:5432)" ] || kill -9 "$(lsof -ti:5432)"
nohup eva_server > eva.log 2>&1 &