Skip to content

Commit

Permalink
start and stop done
Browse files Browse the repository at this point in the history
  • Loading branch information
wangpatrick57 committed Oct 30, 2024
1 parent 4f9a4ae commit 5d8c468
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 12 deletions.
4 changes: 0 additions & 4 deletions demo.py

This file was deleted.

5 changes: 5 additions & 0 deletions experiments/load_per_machine_envvars.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,13 @@ host=$(hostname)

if [ "$host" == "dev4" ]; then
export DBDATA_PARENT_DPATH=/mnt/nvme1n1/phw2/dbgym_tmp/
export INTENDED_DBDATA_HARDWARE=ssd
elif [ "$host" == "dev6" ]; then
export DBDATA_PARENT_DPATH=/mnt/nvme0n1/phw2/dbgym_tmp/
export INTENDED_DBDATA_HARDWARE=ssd
elif [ "$host" == "patnuc" ]; then
export DBDATA_PARENT_DPATH=../dbgym_workspace/tmp/
export INTENDED_DBDATA_HARDWARE=hdd
else
echo "Did not recognize host \"$host\""
exit 1
Expand Down
4 changes: 2 additions & 2 deletions scripts/pat_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@
set -euxo pipefail

SCALE_FACTOR=0.01
INTENDED_DBDATA_HARDWARE=ssd
. ./experiments/load_per_machine_envvars.sh

# space for testing. uncomment this to run individual commands from the script (copy pasting is harder because there are envvars)
python3 task.py tune protox embedding train tpch --scale-factor $SCALE_FACTOR --iterations-per-epoch 1 --num-points-to-sample 1 --num-batches 1 --batch-size 64 --start-epoch 15 --num-samples 4 --train-max-concurrent 4 --num-curate 2
python3 task.py dbms postgres build
python3 task.py dbms postgres dbdata tpch --scale-factor $SCALE_FACTOR --intended-dbdata-hardware $INTENDED_DBDATA_HARDWARE --dbdata-parent-dpath $DBDATA_PARENT_DPATH
exit 0

# benchmark
Expand Down
25 changes: 19 additions & 6 deletions tune/demo/main.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import streamlit as st

from tune.env.pg_conn import PostgresConn
from util.pg import DEFAULT_POSTGRES_PORT
from util.pg import DEFAULT_POSTGRES_PORT, get_is_postgres_running
from util.workspace import (
DBGymConfig,
make_standard_dbgym_cfg,
Expand Down Expand Up @@ -40,11 +40,24 @@ def __init__(self):
False,
DEFAULT_BOOT_CONFIG_FPATH,
)

def main(self):
is_postgres_running = get_is_postgres_running()

if is_postgres_running:
st.write("Postgres is running")

if __name__ == "__main__":
if 'initialized' not in st.session_state:
st.session_state['initialized'] = True
demo = Demo()
if st.button("Stop Postgres"):
self.pg_conn.shutdown_postgres()
st.rerun()
else:
st.write("Postgres is not running")

if st.button("Start Postgres"):
self.pg_conn.restore_pristine_snapshot()
self.pg_conn.start_with_changes()
st.rerun()

st.write("hia")
if __name__ == "__main__":
demo = Demo()
demo.main()

0 comments on commit 5d8c468

Please sign in to comment.