forked from drudilorenzo/generative_agents
-
Notifications
You must be signed in to change notification settings - Fork 32
Expand file tree
/
Copy pathrun_backend_automatic.sh
More file actions
executable file
·85 lines (78 loc) · 2.07 KB
/
run_backend_automatic.sh
File metadata and controls
executable file
·85 lines (78 loc) · 2.07 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
#!/bin/bash
BACKEND_SCRIPT_PATH="reverie/backend_server"
BACKEND_SCRIPT_FILE="automatic_execution.py"
CONDA_ENV="simulacra"
CONDA_PATH="/home/${USER}/anaconda3/bin/activate"
LOGS_PATH="../../logs"
FILE_NAME="Bash-Script"
cd ${BACKEND_SCRIPT_PATH}
# Parse conda-specific arguments first
while [[ $# -gt 0 ]]; do
case "$1" in
--conda_path)
CONDA_PATH="${2}"
shift 2
;;
--env_name)
CONDA_ENV="${2}"
shift 2
;;
*)
break
;;
esac
done
source "${CONDA_PATH}" "${CONDA_ENV}" || {
echo "Failed to activate conda environment. Please check your conda path and environment name."
exit 1
}
ARGS=""
while [[ $# -gt 0 ]]; do
case "$1" in
--origin|-o)
ARGS="${ARGS} --origin ${2}"
shift 2
;;
--target|-t)
ARGS="${ARGS} --target ${2}"
TARGET=${2}
shift 2
;;
--steps|-s)
ARGS="${ARGS} --steps ${2}"
shift 2
;;
--ui)
ARGS="${ARGS} --ui ${2}"
shift 2
;;
--browser_path|-bp)
ARGS="${ARGS} --browser_path ${2}"
shift 2
;;
--port|-p)
ARGS="${ARGS} --port ${2}"
echo "(${FILE_NAME}): Running backend server at: http://127.0.0.1:${2}/simulator_home"
shift 2
;;
--load_history|-h)
ARGS="${ARGS} --load_history ${2}"
shift 2
;;
--mqtt)
ARGS="${ARGS} --mqtt"
echo "(${FILE_NAME}): MQTT mode enabled"
shift
;;
*)
echo "Unknown argument: $1"
exit 1
;;
esac
done
set -- "${POSITIONAL_ARGS[@]}" # restore positional parameters
echo "(${FILE_NAME}): Arguments: ${ARGS}"
timestamp=$(date +"%Y-%m-%d_%H-%M-%S")
echo "(${FILE_NAME}): Timestamp: ${timestamp}"
mkdir -p ${LOGS_PATH}
python3 ${BACKEND_SCRIPT_FILE} ${ARGS} 2>&1 | tee ${LOGS_PATH}/${TARGET}_${timestamp}.txt