reflex/scripts/integration.sh
Masen Furer 8f396fc348
ImmutableVar perf optimizations (#3814)
* Use lru_cache on expensive typing-related functions

* Skip instantiation of VarData unless data was actually merged

* Revert "integration: bump listening timeout to 1800 seconds"

This reverts commit a94eedff6d.

* Revert "integration: bump listening timeout to 1200 seconds"

This reverts commit 86563b66a4.
2024-08-28 10:02:16 -07:00

38 lines
1.0 KiB
Bash
Executable File

#!/bin/bash
# Change directory to the first argument passed to the script
project_dir=$1
shift
pushd "$project_dir" || exit 1
echo "Changed directory to $project_dir"
# So we get stdout / stderr from Python ASAP. Without this, delays can be very long (e.g. on Windows, Github Actions)
export PYTHONUNBUFFERED=1
env_mode=$1
shift
check_ports=${1:-3000 8000}
shift
# Start the server in the background
export TELEMETRY_ENABLED=false
reflex run --loglevel debug --env "$env_mode" "$@" & pid=$!
# Within the context of this bash, $pid_in_bash is what we need to pass to "kill" on exit
# This is true on all platforms.
pid_in_bash=$pid
trap "kill -INT $pid_in_bash ||:" EXIT
echo "Started server with PID $pid"
# Assume we run from the root of the repo
popd
# In Windows, our Python script below needs to work with the WINPID
if [ -f /proc/$pid/winpid ]; then
pid=$(cat /proc/$pid/winpid)
echo "Windows detected, passing winpid $pid to port waiter"
fi
python scripts/wait_for_listening_port.py $check_ports --timeout=900 --server-pid "$pid"